android - 谷歌地图 v2 实时路线?

标签 android google-maps google-maps-api-2 google-maps-android-api-2

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

素材是网络上的。但我无法理解以下内容。 有很多继承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?

谢谢。

最佳答案

首先,从您的标签中,您指向 Google Maps API V2,而您指向的链接 发布适用于 Google Maps API V1。也就是说,这意味着您没有可以使用的 Overlay 对象,并且 GeoPoint 也不是您应该用来显示方向位置的对象。

在 Google map API V2 中,您可以添加/删除折线来向您显示方向。 这些折线将连接 LatLng 点。

现在,您可以使用 Google Direction API 来查找路线。 以下是关于如何查找路线并在 Google Map API V2 上显示路线的帖子:

Draw driving route between 2 GeoPoints on GoogleMap SupportMapFragment

现在,您将如何实现位置更新和所需的目的地更新取决于您:

需要考虑的重要事项: Google Maps API 服务条款未正式允许使用 Google Maps 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

关于android - 谷歌地图 v2 实时路线?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14873491/

相关文章:

android - 大于1的android版本号可以从0开始吗?

android - Could not call incremental task 错误在Android Studio中

google-maps - HTML Canvas 作为 Google Maps 中的 Overlayview,相对于 Map Canvas 是固定的

android - 使用 AsyncTask 和 JSON 在 Google Maps APIv2 上按地址获取位置

javascript - 在没有控件的情况下从谷歌地图打印 map

Android - 如何禁用 RecyclerView 自动滚动点击

java - 使用 Joda Time 将简单的民用时间解析为完整的日期和时间

java - 从相机、SurfaceView 或 SurfaceHolder 连续获取图像数据

android - 融合位置提供者 API。 GPS 位置之间的转换

php - 如何为 Google Place 的 "Reviews by Google Users"构建站点小部件/模块