2013-05-01 52 views
12

正在尋找答案,找不到一個答案。我正在使用Google Maps V3 API獲取路線和地圖。所有這些都是好的...Google Maps Directions API等效網址

但我想提供一個沼澤標準的A-tag鏈接到Google地圖本身的等效方向。我有2個郵政編碼。我怎麼能基於2個郵政編碼或谷歌地圖路線網址我

google.maps.DirectionsService 

我將使用URL生產按鈕和一個「打印」按鈕「上谷歌地圖視圖」。

乾杯!艾登

回答

10

見鏈接this Stackoverflow question

http://www.seomoz.org/ugc/everything-you-never-wanted-to-know-about-google-maps-parameters

SADDR =

設置路線搜索的起點。您也可以在括號中添加文字,以在方向邊欄中加粗。

DADDR =

設置路線搜索的終點,再次將大膽brackets.You添加任何文本還可以添加「+到:」這將通過分集。這些可以添加多次。

Example

+0

+1並接受。完善。有些事告訴我我應該更努力地搜索。有一些代表,今天晚上我的大腦疲憊不堪。 – 2013-05-01 20:56:52

+1

起始點應該由'saddr'分隔 – 2014-05-13 16:37:23

16

這裏有不同的谷歌地圖功能的一些標準的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 
+0

我不確定事情是如何改變的,但是使用My + Location不起作用,我用Current + Location代替 – 2014-09-23 03:38:24

+0

這在Chrome/Firefox/IE11 ,但我沒有看到這個工作在IE9時,其中一個參數是'我+位置'/'當前+位置'。 – aceanindita 2015-03-17 13:42:48

+0

我在IE9中看到一個問題,並使用「我的位置」/「當前位置」。它似乎搜索實際文本,而不是解釋我的位置 - 任何想法? https://www.google.com/maps?saddr=My+Location&daddr=760+West+Genesee+Street+Syracuse+NY+13204 – aceanindita 2015-03-17 13:44:28

2

正如2014年11月4日這適用於iOS 8在iPhone上的Safari 5C的:

https://www.google.com/maps/dir/current+location/100 N Arlington Ave, Reno, NV 89509

它會自動打開谷歌地圖如果已安裝並帶您到方向選擇屏幕。另請注意:如果對空間使用%20,+,則無關緊要。