Auto zoom KML content on a google map
If you’ve seen my display KML on a google map page you’ll know that it doesn’t automatically zoom up on your generated markers. That’s cause I thought it was too hard and crazy to implement.
Turns out I was wrong.
If you’re populating a google map with data from a KML file, you can automatically centre and zoom to the right place just by adding this line of code:
geoXml.gotoDefaultViewport(map)
Where geoXml is your GGeoXml object and map is your GMap2 object.
How easy is that?!