2017-04-09 51 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. 
相关问题