javascript - Google Maps Directions API 等效 URL

标签 javascript google-maps-api-3

一直在寻找答案,找不到。我正在使用 Google Maps V3 API 获取路线和 map 。这一切都可以......

但我想提供一个沼泽标准的 A 标签链接,指向 Google map 本身的等效方向。我有2个邮政编码。如何根据 2 个邮政编码或我的

生成 Google map 方向 URL
 google.maps.DirectionsService

我将使用该 URL 生成一个“在 google map 上查看”按钮和一个“可打印”按钮。

干杯!艾登

最佳答案

这里有一些用于不同 Google map 功能的标准 HTML 链接。 I keep an updated post here.

//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

关于javascript - Google Maps Directions API 等效 URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16326143/

相关文章:

javascript - 在 AngularJS 的谷歌地图中单击标记时如何关闭其他信息窗口

google-maps-api-3 - JSON 响应中的 Google Geocode API "REQUEST_DENIED"- 反向地理编码操作

javascript - 通过 Html.BeginForm 提交激活加载动画

javascript - PhoneGap确认回调函数

javascript - 更改谷歌图表选项不起作用

javascript - Google Maps JS API v3 - 简单多标记 V2

javascript - 为什么我的 KML 文件不显示在谷歌地图上?

javascript - google maps api在按钮点击时加载 map

javascript - 插件 illuminate 0.7 与 jQuery 1.9.1 或 jQuery-UI 1.10.3 不兼容 -> TypeError : $. css(...) 未定义

javascript - 多个 AJAX 调用的限制?