How to know when all addresses have been geocoded

In the Google Maps API, multiple calls are google.maps.ClientGeocoder.getLatLng(address, callback)

not guaranteed in any order. What is an elegant way to determine that all addresses have been geocoded given an array of addresses?

Should I just calculate based on the length of the array and execute the code in the callback only if the countdown reaches zero, or is there a better way to do this in the Google Maps API?

thanks

+1


a source to share


1 answer


Unless you do special case handling for each lat lng response (i.e. just do something when everyone is back), I see no flaw with your counting solution.



+3


a source







All Articles