我正在开发一个android应用程序,其中我每5分钟记录一次设备的点数。现在我想用这些点来计算道路所覆盖的总距离。有没有办法做到这一点。在google apis中,我看到有一个起点和终点使用它计算距离,但可能有多条路线相同。我需要找到这条特定路线的距离。我怎么做?使用一系列点计算道路距离
感谢
编辑:
在谷歌距离矩阵API已经有多个起点和多个目的地的选项。我不知道如果这是任何帮助:
origins — One or more locations to use as the starting point for calculating travel distance and time.
You can supply one or more locations separated by the pipe (|) character, in the form of an address or latitude/longitude coordinates. If you pass an address as a string, the service will geocode the string and convert it to a latitude/longitude coordinate to calculate distances. If you pass coordinates, ensure that no space exists between the latitude and longitude values.
origins=Bobcaygeon+ON|41.43206,-81.38992
Alternatively, you can supply an encoded set of coordinates using the Encoded Polyline Algorithm. This is particularly useful if you have a large number of origin points, because the URL is significantly shorter when using an encoded polyline. Encoded polylines must be prefixed with enc: and followed by a colon (:). For example: origins=enc:gfo}EtohhU:
destinations — One or more locations to use as the finishing point for calculating travel distance and time.
You can supply one or more locations separated by the pipe (|) character, in the form of an address or latitude/longitude coordinates. If you pass an address as a string, the service will geocode the string and convert it to a latitude/longitude coordinate to calculate distances. If you pass coordinates, ensure that no space exists between the latitude and longitude values.
destinations=Darling+Harbour+NSW+Australia|24+Sussex+Drive+Ottawa+ON|Capitola+CA
Alternatively, you can supply an encoded set of coordinates using the Encoded Polyline Algorithm. This is particularly useful if you have a large number of destination points, because the URL is significantly shorter when using an encoded polyline. Encoded polylines must be prefixed with enc: and followed by a colon (:). For example: destinations=enc:gfo}EtohhU:
您可以使用这些路标以及起点和终点,也可以使用“距离=速度*时间”来计算总距离。你必须找到你记录的每个2分的平均速度,并乘以时间乘以 –
@NakulSudhakar“你可以使用这些路标,以及起点和终点”你能告诉我怎么做吗? –
http://wptrafficanalyzer.in/blog/driving-distance-and-travel-time-duration-between-two-locations-in-google-map-android-api-v2/ http://wptrafficanalyzer.in/blog/route-between-two-locations-with-way-in-google-map-android-api-v2/ 请看看这个。 –