有没有办法使用maps.google.com获取路线功能,以便我可以从网址传入路线的参数?
答案 0 :(得分:43)
您可以使用以下网址参数。
saddr
作为起始地址
daddr
网址为http://maps.google.com/maps?saddr=new+york&daddr=baltimore
您传入的值几乎可以在Web应用程序中输入任何内容,即地点名称/ lat longs / etc。另外,请确保使用+
字符作为空格。
答案 1 :(得分:26)
以下是针对不同Google地图功能的一些标准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
//Multiple destination directions (using new syntax). Check my linked post above for the most up-to-date versions.
https://www.google.com/maps/dir/760+W+Genesee+St+Syracuse+NY+13204/314+Avery+Ave+Syracuse+NY+13204/9090+Destiny+USA+Dr+Syracuse+NY+13204
答案 2 :(得分:4)
当然可以。
从ATL到LAX的路线:
http://maps.google.com/maps?saddr=atl&daddr=lax
更新:
亚特兰大到LaGuardia到洛杉矶到Andrau Airpark ......
http://maps.google.com/maps?source=s_d&saddr=ATL&daddr=LGA+to:LAX+to:AAP
答案 3 :(得分:0)
只要你有一个saddr和一个daddr,tt似乎你可以+:在daddr之前或之后获得额外的积分。换句话说,这两个是等价的:
https://maps.google.com/maps?source=s_d&saddr=ATL&daddr=LGA+to:LAX+to:AAP
和
https://maps.google.com/maps?source=s_d&saddr=ATL+to:LGA+to:LAX&daddr=AAP