[英]embed google map with a route between two marks using latitude and longitude
我知道如何使用lat和long这样在2个标记之间创建一条路线到google map的链接
<a href='https://maps.google.com?saddr=lat,lon&daddr=lat,lon'target='_blank'></a>
问题是如何使用这些坐标将地图作为iframe嵌入到我的网站中
https://www.google.com/maps/embed/v1/路线
?key = YOUR_API_KEY
&origin =奥斯陆+挪威
&destination = Telemark +挪威
&avoid =收费站|高速公路需要以下URL参数:
原点定义显示方向的起点。 该值可以是场所名称,地址或场所ID。 该字符串应转义为URL,因此,例如“ City Hall,New York,NY”的地址应转换为City + Hall,New + York,NY。 (转义空格时,Google Maps Embed API同时支持+和%20。)位置ID的前缀应为place_id:。 目的地定义了方向的终点。
例:
origin=40.7127837,-74.0059413 (New York, NY)
destination=42.3600825,-71.05888 (Boston, MA)
iframe code:
<iframe width="600" height="450" frameborder="0" style="border:0" src="https://www.google.com/maps/embed/v1/directions?origin=40.7127837,-74.0059413&destination=42.3600825,-71.05888&key=..." allowfullscreen></iframe>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.