Hi all
Intially i get some markers loaded automaticlly when my map loads
My issue is i want to display markers under the circle that is a
geofence with one colorimage
my draw circle code is here
function drawCircle1(lat1, lng1, map,radius)
{
circleLat= (radius / earthsradius) * r2d;;
circleLng = circleLat / Math.cos(lat1 * d2r);
document.getElementById ('<%=hdminlat.ClientID %>').value=circleLat;
document.getElementById('<%=hdminlng.ClientID %>').value=circleLng;
var circles=new Array();
for (var i = 0; i < 361; i+=10)
{
var theta = Math.PI * (i / (points/2));
vertexLng=lng1 + (circleLng * Math.cos(theta));
vertexLat= lat1 + (circleLat * Math.sin(theta));
mapCordinates.push(new GLatLng(vertexLat, vertexLng));
updatePoints();
}
map.addOverlay(new GPolygon(mapCordinates, "#FD942D", 1, 1,
"#FD942D", 0.5));
}
am drawing a circle wt the above code
After doing R&D i came to know that we need to find the distance bet
pt and center of circle
and if distance is less than radius then its pt is in circle
so based on this i wrote the below method
function updatePoints()
{
for(var m in markers)
{
gDir = new GDirections();
//GEvent.addListener(gDir, "load", updatePoints);
var marker = markers[m];
var markerpoint = marker.getLatLng();
circlelatlng=new GLatLng(circleLat, circleLng);
clicked(circlelatlng);
}
gDir.load(address,markeraddress);
var drivingDistanceMiles = gDir.getDistance().meters / 1609.344;
var drivingDistanceKilometers = gDir.getDistance().meters / 1000;
var miledistance=circlelatlng.distanceFrom(markerpoint,radius).toFixed
(1);
var kmdistance=(miledistance*1.609344).toFixed(1);
if(kmdistance<radius)
{
marker.setImage(iconIncluded);
}
else
{ marker.setImage(iconExcluded);}
}
function clicked(latlng)
{
geocoder.getLocations(circlelatlng, function(addresses)
{
if (latlng)
{
if(addresses.Status.code != 200)
{alert("reverse geocoder failed to find an address for " +
circlelatlng.toUrlValue());}
else
{
var result = addresses.Placemark[0];
address=result;
}}
});
here am using GDirections class to get the distance between the 2 lats
and lngs
but GDirection class requires 2 address to find the distance
i have given one address of the marker( this marker i get when i click
on map)
the other address i want to pass lat and lng of circle and get address
using reverse geocoding
but unable to get it
am i going in correct way or not?
Please giud me past from 1 week iam trying, i have changed my code
many times
--
You received this message because you are subscribed to the Google Groups
"Google Maps API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-api?hl=en.