【问题标题】:Android - To draw a route between two geo pointsAndroid - 在两个地理点之间绘制路线
【发布时间】:2012-01-03 13:50:27
【问题描述】:

在我的方向类中,我有两个地理点。一个对应于当前位置,另一个是固定地理点。当前位置会不断变化。我需要在这两个点之间绘制路线,并且需要更改这条线以进行更改在 500m 的距离内。

【问题讨论】:

    标签: android google-maps


    【解决方案1】:

    我认为最好的解决方案是调用 android 内部地图活动来显示两个地理点之间的路线。请参考以下代码。

    String uri = "http://maps.google.com/maps?saddr=" + currentLatitude+","+currentLongitude+"&daddr="+fixedLatitude+","+fixedLongitude;
    Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(uri));
    intent.setClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity");
    startActivity(intent);
    

    它调用内置地图活动,并在当前和固定经纬度之间绘制路线路径。

    【讨论】:

    【解决方案2】:

    @Siraj 可能此链接将帮助您找到实现目标的方法。您可以使用起点和终点纬度和经度在您自己的地图中绘制路径。将此链接用于地理编码 API click here

    绘制路径参考此链接for Draw Path

    【讨论】:

      猜你喜欢
      • 2011-01-08
      • 2012-08-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-01-02
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多