Friday, February 10, 2012

Google Static Maps API Locates to Wrong Location?

In a project I am using both the Javascript and Static Google Maps APIs. The problem I am running into is that the Static Maps API is locating to the wrong location. I am sending it Latitude and Longitude coordinates and it will ends trying to convert it to an address or something.



Try putting: 37.133212 -113.504478 into maps.google.com and you will see what I mean, I want it to show the green arrow location not the red marker location.



Any help would be appreciated.Google Static Maps API Locates to Wrong Location?
Calling directly from maps.google.com is not the same as calling to maps.google.com/staticmap. Are you declaring your lat-long pair using the markers parameter? I don't use the static maps, since I want the more flexible options of the JS API, but here's an example that I verified in Firefox:



%26lt;html%26gt;

%26lt;head%26gt;%26lt;/head%26gt;

%26lt;body%26gt;

%26lt;p%26gt;

%26lt;img src="http://maps.google.com/staticmap?ce鈥?/%26gt;

%26lt;/p%26gt;

%26lt;/body%26gt;

%26lt;/html%26gt;



The service URL for the request is:



http://maps.google.com/staticmap



Since Y!A will no doubt truncate the href due to length and lack of blanks, the parameters of the URL for the href are:



center = 37.133212, -113.504478

size = 512x512

maptype = mobile

markers = 37.133212, -113.504478, reda %7C37.133212, -113.504478

key = {your key}



Remove all the blanks and glue these parameters together in URL form.Google Static Maps API Locates to Wrong Location?
Google is not perfect. You need to notify them of any errors you find.



I once was searching for motels in Burbank, CA, and it showed me a really nice Best Western at a very specific address -- except that when I called that motel, it was in Pleasanton, CA, about 300 miles away!



I checked and rechecked, and it just kept coming up Best Western Pleasanton, in Burbank.



I notified Google about the problem, but I have no idea if they ever fixed it. (Ended up staying at a Radisson Suites)

No comments:

Post a Comment