How to get reverse geocode two coordinates, that is one is source and destination using Google geocoding API

▼魔方 西西 提交于 2019-12-13 19:22:59

问题


I have two set of coordinates i.e. one is source and destination. I want to geocode them but in a single shot... not by calling Geocoding API twice. Is there a way this can be achieved ? If not what is the best approach?


回答1:


Maybe.

If your intent is to find routes between latlngs and have addresses for the origin and destination of those routes, just use the Directions API: https://developers.google.com/maps/documentation/directions/intro

You'll find start_address and end_address in the response. Bear in mind these are the addresses of start_location and end_location respectively, which may not be the latlngs you provided initially.

If your intent is to simply reverse geocode 2 latlngs at once, regardless of the route from one to another, there is just no way to do that in the Geocoding API: just send one request per latlng.



来源:https://stackoverflow.com/questions/34590135/how-to-get-reverse-geocode-two-coordinates-that-is-one-is-source-and-destinatio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!