2017-04-09 50 views
-1

我需要用我的最終CS項目的幫助。基本上,我必須編寫一個Android應用程序,用戶可以指定所需的起始位置和距離。它會產生這正是輸入,用戶可以步行/運行的距離,使用戶返回到起始位置,使用圖形數據結構和谷歌API的路線。如何使用圖形數據結構在Android中使用Google API生成具有精確距離的路線?

我有我的谷歌地圖和Android應用程序,但我不知道從哪裏開始使用圖表存儲數據(我不知道如果我甚至應該使用這種數據結構)以及如何計算距離輸入。任何建議/幫助位將不勝感激!

+0

已經有算法生成多段線,這些多段線基本上是從一點到另一點的路線。您可以使用該算法繪製路線。 Google API也可以幫助您計算距離。 – HaroldSer

回答

0

好你的問題很棘手,但還是讓我從我得到的回答。 使用谷歌地圖API,谷歌Places API的,地方臺或者ID和谷歌地圖的路線和距離JSON API。

let's take an example like you want walk or run 4kms from your places and comeback. 
Case 1: if you want to opt for the same route from which you went to come back. 
     like you went from a-b then again you are coming bak from b-a. 
     for this case you can use Google maps geofencing and get the place inside a minimum raidus and make an algo to get the distance from your places. 
if teh distance is half of the distance from your places then pick the most approximate place. 
    Use google maps json to get the places distance and google place picker for the location of nearby location object. 

Case2: If you donot want to come from the same route through which you went 
by, then select the nearest location object and get the longest route and follow 
the same algo and procedure to get the distance. 
相關問題