You're not taking account of the asynchronous nature of getLocations
> while(addressIndex < stations.length) {
> geocoder.getLocations(stations[addressIndex], addAddressToMap);
> addressIndex++;}
This fires off a whole bunch of geocoding requests.
(Note - the later ones in the bunch will probably break the geocoding
speed limit and fail anyway, but worry about that later)
> alert("entered: " + enter + "nstations added: " + countMarker + ....
This runs immediately after the loop firing requests.
Geocoding takes time, and no responses will yet have come back, so the
alert displays zeroes.
By the time you've looked at the alert box and pressed the button, the
responses will have come back ...
See -
http://econym.org.uk/gmap/async.htm
and
http://econym.org.uk/gmap/geomulti.htm
cheers, Ross K
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---