Html 如何链接到具有特定经度和纬度的 Google 地图?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1801732/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I link to Google Maps with a particular longitude and latitude?
提问by Deepika
I have a small application that gives the current location: longitude and latitude. Now I have to browse to google maps with the longitude and latitude. Please suggest how I can do this.
我有一个提供当前位置的小应用程序:经度和纬度。现在我必须浏览带有经度和纬度的谷歌地图。请建议我如何做到这一点。
回答by guleryuz
The best way is to use q
parameter so that it displays the map with the point marked. eg.:
最好的方法是使用q
参数,使其显示带有标记点的地图。例如。:
https://maps.google.com/?q=<lat>,<lng>
回答by RedBlueThing
This schema has changed again (23rd October 2018). See Kushagr's answerfor the latest.
此架构再次更改(2018 年 10 月 23 日)。请参阅Kushagr 的最新答案。
This for a map with the marker (via aaronm's comment):
这是带有标记的地图(通过aaronm的评论):
https://www.google.com/maps/?q=-15.623037,18.388672
https://www.google.com/maps/?q=-15.623037,18.388672
For an older example (no marker on this one):
对于较旧的示例(此示例没有标记):
https://www.google.com/maps/preview/@-15.623037,18.388672,8z
https://www.google.com/maps/preview/@-15.623037,18.388672,8z
The oldest format:
最古老的格式:
http://maps.google.com/maps?ll=-15.623037,18.388672&spn=65.61535,79.013672
http://maps.google.com/maps?ll=-15.623037,18.388672&spn=65.61535,79.013672
回答by Pogo19
As of today (2014/09/23), I've found that to get marker on exact place (not an approximation) you can use:
截至今天(2014/09/23),我发现要在确切位置(不是近似值)上获得标记,您可以使用:
http://www.google.com/maps/place/49.46800006494457,17.11514008755796
Additionally, if you want to specify map center and zoom:
此外,如果要指定地图中心和缩放:
http://www.google.com/maps/place/49.46800006494457,17.11514008755796/@49.46800006494457,17.11514008755796,17z
If you want to use satellite map type, then append /data=!3m1!1e3
如果要使用卫星地图类型,则附加 /data=!3m1!1e3
http://www.google.com/maps/place/49.46800006494457,17.11514008755796/@49.46800006494457,17.11514008755796,17z/data=!3m1!1e3
And If you want terrain view of the map, then append /data=!3m1!4b1
如果你想要地图的地形视图,然后附加 /data=!3m1!4b1
https://www.google.com/maps/place/49.46800006494457,17.11514008755796/@49.46800006494457,17.11514008755796,17z/data=!3m1!4b1
回答by Kushagr Arora
As of today (23rd October, 2018), Google provided a provision of Universal URL which works quite efficiently on cross-platforms and thus, Google recommends this method.
截至今天(2018 年 10 月 23 日),Google 提供了通用 URL 的规定,该 URL 在跨平台上非常有效,因此,Google 推荐这种方法。
Syntax: https://www.google.com/maps/search/?api=1&query=<lat>,<lng>
句法: https://www.google.com/maps/search/?api=1&query=<lat>,<lng>
Example: https://www.google.com/maps/search/?api=1&query=28.6139,77.2090(New Delhi, India)
示例:https: //www.google.com/maps/search/?api=1&query=28.6139,77.2090(印度新德里)
Documentation/Source : https://developers.google.com/maps/documentation/urls/guide
文档/来源:https: //developers.google.com/maps/documentation/urls/guide
回答by Emilio Rodriguez
If you want to open Google Maps in a browser:
如果您想在浏览器中打开 Google 地图:
http://maps.google.com/?q=<lat>,<lng>
http://maps.google.com/?q=<lat>,<lng>
To open the Google Maps app on an iOS mobile device, use the Google Maps URL Scheme:
要在 iOS 移动设备上打开 Google Maps 应用程序,请使用Google Maps URL Scheme:
comgooglemaps://?q=<lat>,<lng>
comgooglemaps://?q=<lat>,<lng>
To open the Google Maps app on Android, use the geo: intent:
要在 Android 上打开 Google 地图应用,请使用geo: intent:
geo:<lat>,<lng>?z=<zoom>
geo:<lat>,<lng>?z=<zoom>
回答by AlvaroSantisteban
It′s out of the scope of the question, but I think it might be also interesting to know how to link to a route. The query would look like this:
这超出了问题的范围,但我认为知道如何链接到路线也可能很有趣。查询将如下所示:
https://www.google.es/maps/dir/'52.51758801683297,13.397978515625027'/'52.49083837044266,13.369826049804715'
回答by Jadeye
These are URLs that work:
这些是有效的 URL:
http://maps.google.com/?q=<LAT>,<LNG>
http://maps.google.com/?q=<LAT>,<LNG>
https://maps.google.com/?q=<LAT>,<LNG>&ll=<LAT>,<LNG>&z=18
https://maps.google.com/?q=<LAT>,<LNG>&ll=<LAT>,<LNG>&z=18
https://www.google.com/maps/@<LAT>,<LNG>,16z
https://www.google.com/maps/@<LAT>,<LNG>,16z
https://maps.google.com/?q=<LAT>,<LNG>&z=16
https://maps.google.com/?q=<LAT>,<LNG>&z=16
Although (for avid readers) This is the latest from google (August 22 2017):
虽然(对于狂热的读者)这是谷歌的最新消息(2017 年 8 月 22 日):
Maps URLs
Maps URLs with map display
Maps URLs with search action
地图 URL
带有地图显示的
地图 URL 带有搜索操作的地图 URL
From google
来自谷歌
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).
搜索:搜索特定地点时,生成的地图会在指定位置放置一个图钉并显示可用地点的详细信息。
重要提示:参数 api=1 标识此 URL 所针对的地图 URL 的版本。每个请求都需要此参数。唯一的有效值是 1。如果 URL 中不存在 api=1,则所有参数都将被忽略,并且默认的 Google 地图应用程序将在浏览器或 Google 地图移动应用程序中启动,具体取决于所使用的平台(对于例如,https://www.google.com/maps)。
回答by ojus kulkarni
To open the google maps app in android:-
在 android 中打开谷歌地图应用程序:-
geo:<lat>,<lng>?z=<zoom>
open app with marker for give location:-
打开带有标记的应用程序以提供位置:-
geo:<lat>,<lng>?q=<lat>,<lng>(Label,Name)
open google map in ios:-
在ios中打开谷歌地图:-
comgooglemaps://?q=<lat>,<lng>
open google maps in browser with following parameters:-
使用以下参数在浏览器中打开谷歌地图:-
http://maps.google.com/maps?z=12&t=m&q=<lat>,<lng>
z
is the zoom level (1-21)t
is the map type ("m" map, "k" satellite, "h" hybrid, "p" terrain, "e" GoogleEarth)q
is the search query
z
是缩放级别 (1-21)t
是地图类型(“ m”地图、“ k”卫星、“ h”混合、“ p”地形、“ e”GoogleEarth)q
是搜索查询
回答by Frato
Using the query parameter won't work, Google will try to approximate the location.
使用查询参数不起作用,Google 将尝试估算位置。
The location I want : http://maps.google.com/maps?ll=43.7920533400153,6.37761393942265
我想要的位置:http: //maps.google.com/maps?ll=43.7920533400153,6.37761393942265
The approximate location (west of the actual location) : http://maps.google.com/?q=43.7920533400153,6.37761393942265
大致位置(实际位置以西):http: //maps.google.com/?q=43.7920533400153,6.37761393942265
回答by pixparker
say easily http://www.google.com/maps/place/lat,lng
format
说容易http://www.google.com/maps/place/lat,lng
格式化
sample url:
示例网址: