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


当前回答

最好的方法是使用q参数,这样它就会显示带有标记点的地图。如:

https://maps.google.com/?q=<lat>,<lng>

其他回答

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

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

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

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

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

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

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

这超出了问题的范围,但我认为知道如何链接到一个路线可能也很有趣。查询如下所示:

https://www.google.es/maps/dir/'52.51758801683297,13.397978515625027'/'52.49083837044266,13.369826049804715'

这些是有效的url:

http://maps.google.com/?q= < LAT >、<液化天然气>

https://maps.google.com/?q=<LAT>,<LNG>&ll=<LAT>,<LNG>&z=18

https://www.google.com/maps/@ < LAT >、<液化天然气> 16 z

https://maps.google.com/?q=<LAT>,<LNG>&z=16

虽然(对于热心的读者)这是谷歌(2017年8月22日)的最新消息:

地图的url 使用地图显示映射url 用搜索动作映射url

从谷歌

Search: When searching for a specific place, the resulting map puts a pin in the specified location and displays available place details. Important: The parameter api=1 identifies the version of Maps URLs this URL is intended for. This parameter is required in every request. The only valid value is 1. If api=1 is NOT present in the URL, all parameters are ignored and the default Google Maps app will launch, either in a browser or the Google Maps mobile app, depending on the platform in use (for example, https://www.google.com/maps).