KML / Google Map - Specifying the zoom level of an embeded map in an iFrame

拟墨画扇 提交于 2019-12-02 00:26:37

问题


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>

回答1:


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



来源:https://stackoverflow.com/questions/1690129/kml-google-map-specifying-the-zoom-level-of-an-embeded-map-in-an-iframe

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!