我有一个小应用程序,提供当前位置:经度和纬度。 现在我必须浏览谷歌地图的经度和纬度。 请建议我该怎么做。


当前回答

要获得您的当前位置作为起点,您需要使用以下URL:

https://www.google.com/maps/dir/?api=1&origin=Current+Location&destination=<latitude>,<longitude>

您可以用地址、名称或纬度和经度值填充目的地参数。

其他回答

简单说http://www.google.com/maps/place/lat,lng格式

示例url:

http://www.google.com/maps/place/30.364124,48.227034

在谷歌地球程序中找到您的位置,并单击“在谷歌地图中查看”图标。浏览器中的URL栏将显示您需要的URL。

打开谷歌地图并显示URL方案位置和位置引脚

UIApplication.shared.openURL(URL(string:"https://maps.google.com/?q=\(dicLocation.stringValueForKey("latitude")),\(dicLocation.stringValueForKey("longitude")),15z")!)

如果你想要一个dir旅行模式=步行

https://www.google.es/maps/dir/'52.51758801683297,13.397978515625027'/'52.49083837044266,13.369826049804715'/data=!4m2!4m1!3e2

使用查询参数将不起作用,谷歌将尝试近似位置。

我想去的地方:http://maps.google.com/maps?ll=43.7920533400153,6.37761393942265

大致位置(实际位置以西):http://maps.google.com/?q=43.7920533400153,6.37761393942265