Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
381 views
in Technique[技术] by (71.8m points)

geocoding - Google Maps API: Geocode returns different co-ordinates then Google maps

I am currently attempting to geocode addresses but I'm having an issue with getting accurate co-ordinates. For example if I enter the address into google maps it shows up correctly, but if I geocode the same address I only get an APPROXIMATE location type from the geocode json response as well as different co-ordinates.

What is causing the discrepancy and is there anything I can do to improve the accuracy of my geocoding to get to the level of a manual google maps address search?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Try adding the country to the query. With Fonthill Road, Lucan, Dublin it gives different size results:

  1. http://maps.google.com/maps/geo?q=Fonthill%20Road,Lucan,Dublin,Ie
  2. http://maps.google.com/maps/geo?q=Fonthill%20Road,Lucan,Dublin

Note: I use Fonthill Road, Lucan, Dublin. Thus putting the region to the query makes a huge difference in size of the response. The geocode -6.4059442, 53.3473048 is very close to Unit 1,Fonthill Retail Park,Lucan,Co. Dublin.

My conclusion is you need to compare name and address, because the result from your query is:

"name": "Fonthill Retail Park,Lucan,Co. Dublin,Ie", "address": "Lucan, Co. Dublin, Irland",

and thus there isn't a Fonthill Retail Park in Google so the reverse geocode is Lucan, Dublin and this is exactly what you find in the map!?!

In my example I use address Fonthill Road..., the result gives

"name": "Fonthill Road,Lucan,Dublin,Ie" and address: "address": "Fonthill Rd N, Dublin, Co. Dublin, Irland",

which is exactly the same and the geocode is also showing the correct location but I'm not sure if the region is so important, it's probably I'm wrong but I think you need to loop through the response if you want to improve your accuracy anyway??

Have you read: https://developers.google.com/maps/documentation/geocoding/index#RegionCodes?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...