Question

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>
Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top