I have found this code for reverse geocoding:
var point = new GLatLng (lat[1],long[1]);
var geocoder = new GClientGeocoder();
geocoder.getLocations (point, function(result) { alert (lat[1]+' '+long[1]+' '+result.address); });
But it pops the alert, saying that result.address is ‘undefined’. Any ideas, what could be the problem?
EDIT: Got it working, thanks.
can you include the definitions of ‘lat’ and ‘long’? also, ‘long’ is a reserved keyword, so that is likely a typo / bug.
also, the results that come back, at least in gmaps v2 json format, have a more complex structure, and ‘result.address’ won’t have anything. when I tested it out, I needed to access one of the addresses with something like:
result.Placemark[0].addresssee http://code.google.com/apis/maps/documentation/geocoding/index.html#GeocodingResponses