KML / Google Map - 在iFrame中指定嵌入式地图的缩放级别 [英] KML / Google Map - Specifying the zoom level of an embeded map in an iFrame
问题描述
我在Google map中加载了以下kml文件,它正确地定位了指针,但它总是放大到最高级别。
使用google地图API我可以设置自己的缩放级别,但我正尝试在iFrame中使用嵌入式地图(由Google提供)来执行此操作。
有没有办法在kml中设置缩放级别?我看了一下LookAt和Camera属性,但是文档说它们在Google Map中不受支持。
谢谢!
<?xml version =1.0encoding =UTF-8?>
< kml xmlns =http://earth.google.com/kml/2.1>
<地标>
< Point>
<坐标> 144.897426,-37.8045< /坐标>
< / Point>
< /地标>
< / kml>
您可以通过参数控制Google地图的显示行为传递iframe元素的src - 在你的情况下通过设置z参数 - 请参阅此处
只需将您的iframe源代码设为 http://maps.google.com/?ll=48.064372,16.348977&z=10 并将z = 10更改为其他更高(最高20)或更低值(低至0)
或者,在Maps API中,您可以使用 setCenter()函数来设置缩放级别
I have the following kml file that I am loading in Google map, it's locating the pointer correctly however the it's always zoomed at the maximum level.
Using the google map APIs I can set my own zoom level but I am trying to do this using an embedded map in an iFrame (provided by google).
Are there anyways to set the zoom level in the kml itself? I had a look at LookAt and the Camera attribute but the doc say they aren't supported in Google Map.
Thanks!
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.1">
<Placemark>
<Point>
<coordinates>144.897426,-37.8045</coordinates>
</Point>
</Placemark>
</kml>
You can control Google Map's display behaviour by the arguments you pass in the src of the iframe element - in your case by setting the "z" parameter - see here
simply make your iframe source as "http://maps.google.com/?ll=48.064372,16.348977&z=10" and change z=10 to any other higher (up to 20) or lower value (down to 0)
Alternatively, in the Maps API you would use the setCenter() function to set the zoom level
这篇关于KML / Google Map - 在iFrame中指定嵌入式地图的缩放级别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!