如何启动地图意图用在给定的纬度和经度标记/覆盖项目? [英] How to launch map intent with a marker/overlay item at given latitude and longitude?
本文介绍了如何启动地图意图用在给定的纬度和经度标记/覆盖项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个经度和纬度,我想开集中在这一点上谷歌地图。所以我用下面的code吧:
I have a latitude and longitude and I want to open google maps centred at that point. So i use the following code for it:
Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse("geo:"+lat +","+lng));
startActivity(intent);
然而,这并不放置在中心的标记。我需要将某些类型的标记在的时候,我开始(也可以选择某种形式的叫法)。任何想法如何能做到这一点?
However, this does not place a marker on the center. I want to place some kind of marker at the the point I start with (and optionally some kind of name for it). Any idea how this can be achieved?
推荐答案
您可以使用它像,
显示特别的地方,
Uri uri = Uri.parse("geo:0,0?q=22.99948365856307,72.60040283203125
(Maninagar)");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
显示路线之间的地方,
Intent intent = new Intent(Intent.ACTION_VIEW,
Uri.parse("http://maps.google.com/maps?saddr="+23.0094408+","+72.5988541+"&
daddr="+22.99948365856307+","+72.60040283203125));
startActivity(intent);
这篇关于如何启动地图意图用在给定的纬度和经度标记/覆盖项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文