Embed API的Google地图directions并不总是在框架中显示起点和终点。有时默认缩放级别会放大太多。
<iframe
src="https://www.google.com/maps/embed/v1/directions?
origin=%2020858%20King%20Hezekiah%20Way%20%20Bend%20Oregon%20United%20States&
destination=1180%20SE%203rd%20Street%2C%20Bend%2C%20OR&
key=******************************"
width="281"
height="370">
</iframe>
(添加了空格以提高可读性。)
几乎解决方案:
zoom
参数不是通用解决方案,因为不可能知道正确的值。在此示例中为zoom=14
。]这是它的外观(例如,使用zoom=14
或-手动缩小):
这里是一个live example。
Embed API中是否有任何解决方案或解决方法?这是bug吗?
UPDATE在2018年2月似乎已得到解决。也就是说,在live example上,错误映射现在看起来与解决方法相同。猜想这比答案或Mea culpa更好。
<div style="height: 400px">
<iframe width="100%" height="100%"
src="https://www.google.com/maps/embed/v1/directions?
origin=%2020858%20King%20Hezekiah%20Way%20%20Bend%20Oregon%20United%20States&
destination=1180%20SE%203rd%20Street%2C%20Bend%2C%20OR&
key=******************************" allowfullscreen>
</iframe>
</div>
您可以尝试这样。只需将宽度和高度设置为不>]