2

这里现在正在研究如何最好地实时绘制路径。获取坐标,并提前绘制等等。GoogleMaps v2实时路线?

网络中的材料是。但我无法理解以下内容。 有许多继承Overlay的例子,然后实现draw()方法并绘制。但是,我们会有一次性的,我需要不断地抽签。

收到一个起始位置,去完成位置已经改变到原来的位置等等。 如何?

例子。

Drawing a line/path on Google Maps How can I parse out points and draw a route on a Google Map in Android?

感谢。

+0

您必须将GeoPoint的ArrayList按照您的for循环开始到结束位置绘制路径。对于for循环的每个位置,您必须将结尾Geopoint的值刷入初始GeoPoint。 – Maulik 2013-02-14 11:37:43

+0

这个我明白。但是我把这个方法叫做draw()1次。每个项目都重新绘制?这是我不明白的。 – JDev 2013-02-14 11:46:56

回答

2

首先从您的标记指向Google Maps API V2,而您发布的链接是 针对Google Maps API V1。这就是说,这意味着您没有叠加层对象可以使用,也不是GeoPoint是您应该用来向您显示方向位置的对象。

在Google maps API V2中,您可以做的是添加/删除多义线向您显示路线。 那些折线将连接LatLng点。

现在,您可以使用Google方向API找到您的路线。 这里是如何找到方向,并显示他们在谷歌地图API V2后:

Draw driving route between 2 GeoPoints on GoogleMap SupportMapFragment

现在从你将如何实现更新自己的位置和你想要的目标更新它给你:

重要的事情要考虑: 这不是正式谷歌地图API服务条款允许使用谷歌地图API的行车路线:

Google Maps/Google Earth APIs Terms of Service 

    Last updated: May 27, 2009 

... 

10. License Restrictions. Except as expressly permitted under the Terms, or unless you 
have received prior written authorization from Google (or, as applicable, from the 
provider of particular Content), Google's licenses above are subject to your adherence 
to all of the restrictions below. Except as explicitly permitted in Section 7 or the 
Maps APIs Documentation, you must not (nor may you permit anyone else to): 

... 

10.9 use the Service or Content with any products, systems, or applications for or in  
connection with: 

(a) real time navigation or route guidance, including but not limited to turn-by-turn 
route guidance that is synchronized to the position of a user's sensor-enabled device; 


and may be disabled for certain apps (somehow, at least on Android)... FromGeocode 
scraping in .NET conversation: 
This is not allowed by the API terms of use. You should not scrape Google Maps to 
generate geocodes. We will block services that do automated queries of our servers. 

Bret Taylor 

Product Manager, Google Maps