开发者

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

开发者 https://www.devze.com 2022-12-11 05:59 出处:网络
I have the following kml file that I am loading in Google map, it\'s locat开发者_开发百科ing the pointer correctly however the it\'s always zoomed at the maximum level.

I have the following kml file that I am loading in Google map, it's locat开发者_开发百科ing 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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号