Geocoding (or reverse geocoding) is a Asynchronous process http://econym.org.uk/gmap/async.htm
basically you appear the be assuming that everything is happening in sequence but almost certainly by the time the callbacks come back from the geocoder, the initialize() function has finished running. It runs to completion without waiting. This is also relevent http://econym.org.uk/gmap/scope.htm The next issue is you define the "var infoflight = ..." inside the function, but then use it outside, but its a local variable to the function. (but it doesnt work becuase of the first issue too) Thirdly, you are making WAY too many requests to the geocoder http://econym.org.uk/gmap/geomulti.htm really you should only perform the lookup if someone actually opens a infowindow. something like this in your createmarker function could do it... GEvent.addListener(marker, "mouseover", function() { geocoder.getLocations(point,function(addresses) { address = addresses.Placemark[0]; var infoflight = address.address; marker.openInfoWindowHtml(infoflight); }); }); ... and this should solve all three of the above issues. 2009/1/20 Onslow <[email protected]>: > > This may probably have been answered before, and has a simple answer, > but I'm posting a question about the reverse geocoding feature. > > I'm using google maps on my airpics.com radar project, which is a > flight radar (currently for the middle/northern parts of norway). URL: > http://www.airpics.com/radar/radar.php > > All the stuff is made using php scripts (also to generate the > javascript stuff), but I've saved a HTML file with all the code at > this location (since there actually may not be any flights when you > read this) > > http://www.airpics.com/radar/geocode.html > > The problem is reading the addresses when clicking on the markers. > As you see I've defined variables for both the address, and some other > flight info I will write in the popup when moving the mouse over the > markers. Like flight number, altitude and more, the thing I now want > in this popup window is the address/location the aircraft is flying > over. > > What needs to be done with this script to make this work ? > > > > -- Barry - www.nearby.org.uk - www.geograph.org.uk - --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
