Finding intermediate Lattitude Longitude between two given points

蹲街弑〆低调 提交于 2019-12-01 09:56:09

问题


I am provided with this information -

  1. Lat-Long of source
  2. Lat-Long of destination

I need to find the Lat-Long pairs on the path from source to destination. These Lat-Long pairs must differ from each other by some given granularity.

Is there some Google API using which I can get this information ?


回答1:


The Google Maps API Elevation Service does exactly that. Given a path (defined by your source and destination LatLng pair), you also specify the number of samples and it will return elevation for specific LatLng points along that path. Just ignore the elevation information.

The Elevation Web Service is available for use separate from the Google Maps API v3. However make sure that your usage still falls within the terms of service.

To retrieve granular points along a driving path, use the Google Maps API Directions Service to obtain the full driving path and use that path as the input to the Elevation Service.




回答2:


I think what you are looking for is the directions api from google https://developers.google.com/maps/documentation/directions/

You give it the origin and destination and then specify your travelmode (which is car by default but you can also say you are walking or using transit)



来源:https://stackoverflow.com/questions/12299875/finding-intermediate-lattitude-longitude-between-two-given-points

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