Zooming my KML layer using API v3

29 views
Skip to first unread message

Gordon Banks

unread,
Aug 7, 2015, 12:09:16 AM8/7/15
to Google Maps JavaScript API v3
I am using this initialization of my map. I would like my map to come into my "map-container" zoomed in more (maybe 16 zoom). Where can I add this zoom parameter? Is this possible?

function initialize() {
var map = new google.maps.Map(document.getElementById('map-container'), {
  
    }),

    myMapsId = 'zpR-Rs8swcrY.kxIipB_folRg&usp';
  new google.maps
    .KmlLayer({
      map: map,
      url: 'https://www.google.com/maps/d/kml?mid=' + myMapsId
    });
}

google.maps.event.addDomListener(window, 'load', initialize); 

ralfwessels

unread,
Aug 7, 2015, 4:26:34 AM8/7/15
to Google Maps JavaScript API v3
Hi Gordon,
take a look at the official Google documentation: for KML Layers: https://developers.google.com/maps/documentation/javascript/examples/layer-kml

the KML layer option "preserveViewport" specifies that the map should not be adjusted to the bounds of the KmlLayer’s contents 

ralf
Reply all
Reply to author
Forward
0 new messages