2017-10-21 178 views
0

我有我的经度和纬度值在我andoroid的应用程序,我将它们传递给URL作为官方Android文档时说,对导航不工作,像这样 -启动谷歌地图使用经度和纬度

String query_string = "google.navigation:q=" +location.getLatitude()+","+location.getLongitude(); 
Uri gmmIntentUri = Uri.parse(query_string); 
Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri); 
//mapIntent.setPackage("com.google.android.apps.maps"); 
startActivity(mapIntent); 

谷歌地图打开安静好,但它允许说路线不能找到。

enter image description here

,我可以看到的经度和纬度值我在谷歌地图的地址栏通过。它显示“找到最佳路线”,然后显示错误消息“找不到路线”。它也发生在所有模式中(走路,驾驶......)。不知道为什么。

+0

你能分享的价值观纬度,经度?另外,你目前的职位是什么?您是否可以尝试[Google地图网址](https://developers.google.com/maps/documentation/urls/guide)作为最新(2017年)并由Google建议生成地图链接? – xomena

+0

xomena我在帖子中添加了一个图片 –

+0

为什么'mapIntent.setPackage(“com.google.android.apps.maps”);'注释掉了? – Vinnie

回答

0

我看过你的截图。我可以看到你试图从你当前的位置找到一个行车路线来协调3.2949945,6.5993606。

但是,3.2949945,6.5993606位于几内亚湾内的水域。您可以在地理编码工具看到这一点:

https://google-developers.appspot.com/maps/documentation/utils/geocoder/#q%3D3.294995%252C6.599361

enter image description here

我猜你的意图是要找到对6.5993606,3.2949945路线:

https://google-developers.appspot.com/maps/documentation/utils/geocoder/#q%3D6.599361%252C3.294995

+0

是的,就是这个意思。让我试着调整我的代码并交换经度和纬度值,看看会发生什么。 –

+0

问题是我在程序中保存了纬度和纬度作为经度的经度。 –