Thank you, I'm going to change up the code and try option. I'll let you know how it goes
On Nov 2, 11:55 am, Andrew Leach <[email protected]> wrote: > On Nov 2, 4:44 pm, Kevin G <[email protected]> wrote: > > > After setting some break points I noticed the loop is only > > going to the function(point) line then going back to the top of the > > loop. Any Idea why? > > If you're using Firebug, it doesn't handle asychronous callback > functions very well. > > However... > > > This is the for Loop > > > for (i=0;i<JSArray.length-1;i++) > > { > > var ZipC = JSArray[i]; > > var Amount = JSArray[i+1]; > > geocoder.getLatLng(JSArray[i], > > function(point) { <<<<<reaches this line then goes back > > top of loop > > ...means that you are geocoding in a tight loop. That doesn't work, > because at every iteration the "geocoder" object gets reset. You will > only ever end up with the last one running to completion. > > The solutions are > (a) store the coordinates with the zipcode and its population figure > [this is **infinitely** preferable] > (b) chain each request from the callback function, so you can be sure > that each has finished before the next is initiated > (c) use an array of geocoder objects [not recommended: you could run > out of memory very quickly for a large array] > > Andrew -- 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.
