问题
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