我正在开发一个 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: