【问题标题】:how to draw path on the google maps using the current lat,log position如何使用当前的纬度,经度位置在谷歌地图上绘制路径
【发布时间】:2015-04-06 07:48:44
【问题描述】:

我在我的应用程序中使用谷歌地图,因此我使用纬度和经度获取当前位置,因此我得到了我要去或开车的位置。因此,我可以在地图上绘制当前位置,但我不知道如何使用这个纬度和经度位置绘制路径。因此,我每 5 分钟获取一次当前位置,因此我必须绘制从该位置开始到当前位置的路径。 请帮我。提前致谢。

【问题讨论】:

标签: android google-maps google-polyline


【解决方案1】:

首先,您必须存储每 5 分钟获得的所有位置,然后您可以使用以下代码在地图上画线:

ArrayList<LatLng> points = new ArrayList<LatLng>();
PolylineOptions lineOptions = null;
lineOptions = new PolylineOptions();

LatLng position1 = new LatLng(lat,long);
points.add(position1);

LatLng position2 = new LatLng(lat,long);
points.add(position2);

lineOptions.addAll(points);
lineOptions.width(5);

    gMap.addPolyline(lineOptions); // gMap is object of GoogleMap

【讨论】:

  • 嗨,很抱歉回复晚了>
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2013-12-02
  • 2016-09-05
  • 2016-01-08
  • 2013-10-01
  • 1970-01-01
  • 1970-01-01
  • 2011-08-26
相关资源
最近更新 更多