1

I am using Google Maps API Geocoder to geocode an address.

Problem: When the server does the geocoding, I often (not always) get results that have the exact same lat/lng, and this is the lat/lng of the city center.

However when I call the exact same URL on my browser, I always get the correct lat/lng returned!

Any idea why its returning the wrong and different results when the same URL is called from server and from my browser?

Query URL

http://maps.googleapis.com/maps/api/geocode/json?address=6954 N Greenview, Chicago, IL&sensor=false&region=us

Results on Server (Using curl)

"lat": 41.8781136
"lng": -87.6297982

Results on Browser

"lat" : 42.0082060,
"lng" : -87.66836499999999
Nyxynyx
  • 61,411
  • 155
  • 482
  • 830
  • 1
    See this [Region Biasing](https://developers.google.com/maps/documentation/geocoding/index). – The Alpha Oct 16 '12 at 18:10
  • Thanks, I believe that I'm biasing the region to `us`. I've appended `&region=us` to the end of the query url. – Nyxynyx Oct 16 '12 at 18:26

1 Answers1

0

I also believe it's region bias but did you tried comparing name and address of the result? It's happen to me sometimes I get the address and not the name lat lng pairs. I suggest you also to try this url from google http://maps.google.com/maps/geo?q= see my answer: Google Maps API: Geocode returns different co-ordinates then Google maps.

Community
  • 1
  • 1
Micromega
  • 12,486
  • 7
  • 35
  • 72
  • What is the difference between using `http://maps.google.com/maps/geo?q=` and using `http://maps.googleapis.com/maps/api/geocode/json?`? Is the first one from Google Maps API v2? – Nyxynyx Oct 17 '12 at 02:54
  • Yes, it's from the api v2 and also the mime type is different. You can get see the result in the browser. – Micromega Oct 17 '12 at 03:26