javascript Google Maps Directions API 等效 URL
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16326143/
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
Google Maps Directions API Equivalent URL
提问by Aiden Bell
Been searching for an answer, can't find one. I'm using the Google Maps V3 API to get directions and a map. All this is OK ...
一直在寻找答案,找不到。我正在使用 Google Maps V3 API 来获取路线和地图。这一切都OK...
But I want to provide a bog-standard A-tag link to the equivalent directions on Google maps itself. I have 2 postcodes. How can I generate a Google Maps directions URL based on 2 postcodes or my
但我想提供一个沼泽标准的 A 标签链接到谷歌地图本身的等效方向。我有 2 个邮政编码。如何根据 2 个邮政编码或我的地址生成 Google 地图路线 URL
google.maps.DirectionsService
I'm going to use the URL to produce a "View on google maps" button and a "printable" button.
我将使用 URL 生成“在谷歌地图上查看”按钮和“可打印”按钮。
Cheers! Aiden
干杯! 艾登
采纳答案by geocodezip
See the link in this Stackoverflow question
请参阅此 Stackoverflow 问题中的链接
http://www.seomoz.org/ugc/everything-you-never-wanted-to-know-about-google-maps-parameters
http://www.seomoz.org/ugc/everything-you-never-wanted-to-know-about-google-maps-parameters
saddr=
悲伤=
Sets the starting point for directions searches. You can also add text into this in brackets to bold it in the directions sidebar.
设置路线搜索的起点。您还可以在括号中添加文本以在方向侧栏中将其加粗。
daddr=
爸爸=
Sets the end point for directions searches, and again will bold any text added in brackets.You can also add "+to:" which will set via points. These can be added multiple times.
设置路线搜索的终点,并再次将括号中添加的任何文本加粗。您还可以添加“+to:”,这将通过点设置。这些可以多次添加。
回答by GreatBlakes
Here are some standard HTML links for different Google Maps functions. I keep an updated post here.
以下是针对不同 Google 地图功能的一些标准 HTML 链接。我在这里保留更新的帖子。
//Spaces can be changed to "+" or encoded as "%20".
//Linking to a location (No directions)
https://www.google.com/maps?q=760+West+Genesee+Street+Syracuse+NY+13204
//No starting point (User input required to generate directions).
https://www.google.com/maps?daddr=760+West+Genesee+Street+Syracuse+NY+13204
//With a set location as starting point (Automatically generates directions with no user input required).
https://www.google.com/maps?saddr=760+West+Genesee+Street+Syracuse+NY+13204&daddr=314+Avery+Avenue+Syracuse+NY+13204
//With "My Location" as starting point (Automatically generates directions with no user input required).
https://www.google.com/maps?saddr=My+Location&daddr=760+West+Genesee+Street+Syracuse+NY+13204
//Current Location to Latitude and Longitude
https://www.google.com/maps?saddr=My+Location&daddr=43.12345,-76.12345
//Query search of a Latitude and Longitude
//Also shows setting a default zoom level
https://www.google.com/maps?ll=43.12345,-76.12345&q=food&z=14
//String search as destination
https://www.google.com/maps?saddr=My+Location&daddr=Pinckney+Hugo+Group
回答by Andrew Samuelsen
As of November 4, 2014 this works on iOS 8 on Safari on iPhone 5C:
截至 2014 年 11 月 4 日,这适用于 iPhone 5C 上的 Safari 上的 iOS 8:
https://www.google.com/maps/dir/current+location/100 N Arlington Ave, Reno, NV 89509
https://www.google.com/maps/dir/current+location/100 N Arlington Ave, Reno, NV 89509
It will automatically open Google Maps if installed and take you to the directions chooser screen. Also note: it doesn't matter if you use %20
, , or
+
for spaces.
如果已安装,它将自动打开 Google 地图并将您带到路线选择器屏幕。另请注意:使用%20
, , 或
+
用作空格都没有关系。