1

I have a latitude and longitude for a proper location and by using them I created a circle on google map and now I want to check a point(latitude, longitude) exist inside the circle or not. Simply I need true of false only. if any one having any idear regarding this please share your idea. Thanks a ton in advance

google map api

<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&signed_in=true&libraries=geometry"></script>

Index.html

<!DOCTYPE html>
<html>
<head>

<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&signed_in=true&libraries=geometry"></script>

<script>

var myCity;
var amsterdam=new google.maps.LatLng(52.395715,4.888916);

function initialize()
{
var mapProp = {
  center:amsterdam,
  zoom:7,
  mapTypeId:google.maps.MapTypeId.ROADMAP
  };

var map = new google.maps.Map(document.getElementById("googleMap"),mapProp);

myCity = new google.maps.Circle({
  center:amsterdam,
  radius:20000,
  strokeColor:"#0000FF",
  strokeOpacity:0.8,
  strokeWeight:2,
  fillColor:"#0000FF",
  fillOpacity:0.4
  });

myCity.setMap(map);
}

google.maps.event.addDomListener(window, 'load', initialize);

function pointInCircle(var latitude, var longitude){

    //want to write code here to check latitude and longitude exist in above circle or not
}
</script>


</head>

<body>
<div id="googleMap" style="width:500px;height:380px;"></div>

<button onclick="pointInCircle(55.22,3.55)">Check For cordinates</button>
</body>
</html>
dom
  • 1,086
  • 11
  • 24

0 Answers0