1. Don't bother fetching the driving distance, it's slow and wastes 
resources.

>var drivingDistanceMiles = gDir.getDistance().meters / 1609.344;


2. distanceFrom() returns results in metres, not miles.

>var miledistance=circlelatlng.distanceFrom(markerpoint,radius).toFixed


3. Converting the Number to a String with .toFixed() and then comparing 
it to a Number might be dodgy. I think you might get away with in 
Javascript. In some languages that would force a String comparison. Note 
that "2">"10" when you do String comparison but 2<10 when you do numeric 
comparison.

>var kmdistance=(miledistance*1.609344).toFixed(1);
>if(kmdistance<radius)


4. The "radius" variable shown in your snippet is local to 
drawCircle1(), so it's out of scope in updatePoints(). Perhaps you've 
got another global "radius" variable that you're not showing us.


5. You can have problems with the "for var in array" syntax if you use 
utilities like Prototype. It's safer to use "for (m=0; m<markers.length; 
m++)". [What happens is that Prototype adds extra properties to the 
Array() class, and they get included in the "for var in array".

>for(var m in markers)


6. Performing reverse geocoding in a tight loop (which will happen if 
there are several markers outside the fence) is likely to cause some of 
them to be rejected for making too many requests per second. You're not 
checking for Status.code 620.


7. Do check the Terms carefully. There are some circumstances in which 
operations similar to geofencing are allowed using the free API key. I 
suspect that your application may not be permissible with the free key, 
in which case you'll need a Premier licence.

-- 
Mike Williams
http://econym.org.uk/gmap


--

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.


Reply via email to