Google Maps Issues

fez

fez

Caporegime
Joined
22 Aug 2008
Posts
28,106
Location
Tunbridge Wells
Hi guys,

On a site I have built I have had a few problems with geocoding. I couldn't understand why it would just have stopped working so I dug into it a bit more and this is what I found.

Code:
geocoder.geocode({ 'address': address}, function(results, status) {
    if (status == google.maps.GeocoderStatus.OK) {
	map.setCenter(results[0].geometry.location);
	searchLocation = results[0].geometry.location;
    }
}

This is obviously a shortened version of the code to just show the situation.

The var searchLocation stores the location data from the geocode request. To access the lat and long it was a case of using searchLocation.a and searchLocation.b effectively.

When I fixed this a few days ago, I found that the variables had changed from a and b to xa and wa.

Fine, I just changed them to reference the new names and everything worked nicely. Today I was getting the same errors as before and lo and behold, the names have changed again. Its now va and wa to ref the long and lat.

What is going on, this is decidedly ungoogle. I have to assume that I am doing something wrong by accessing the lat and lng values directly instead of via a method.

Any ideas or anyone else had any issues with google maps geocoding in the past?
 
Hi, I'm not sure about exactly what your method returns, but we use curl and php to geocode addresses, which returns the result in JSON format. From there its simply:

Code:
$lat = $aJson['Placemark'][0]['Point']['coordinates'][1];
$lng = $aJson['Placemark'][0]['Point']['coordinates'][0];
 
Back
Top Bottom