我正在開發一個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/ 請看看這個。 –