【问题标题】:How to draw and navigate routes on Google Maps如何在谷歌地图上绘制和导航路线
【发布时间】:2012-09-06 14:04:20
【问题描述】:

我想在谷歌地图上绘制路线(步行或驾车),我想给出当前用户坐标和目的地坐标,以绘制和导航路线,就像这张图片

我用过这段代码

Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse("http://maps.google.com/maps?saddr=20.344,34.34&daddr=20.5666,45.345")); startActivity(intent);

但我得到“找不到路线”

非常感谢

【问题讨论】:

    标签: android google-maps navigation coordinates


    【解决方案1】:

    你不能故意这样做。你应该使用带有http://maps.googleapis.com/maps/api/directions/output?parameters.的JSON请求如果你使用JSON请求,你必须像这个例子一样,只需添加你的坐标:String url = "http://maps.googleapis.com/maps/api/directions/json?origin="yourlat","yourlong"&destination="secondlat","secondlong"&sensor=false";

    这可能会有所帮助:Android draw route on a Mapview with twoo POI-s 和这个How do I draw a KML file on a MapView in Android?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-06-23
      • 2015-03-25
      • 1970-01-01
      • 2011-06-07
      • 2021-06-14
      • 1970-01-01
      相关资源
      最近更新 更多