Google Maps KML zIndex属性不会更改图层显示顺序

时间:2018-05-22 11:20:35

标签: google-maps google-maps-api-3 kml

问题

为什么不更改KML图层的zIndex值会更改哪个图层位于顶部?

工作示例

根据the documentationKmlLayerOptionsIterface具有zIndex属性。

但是,在此示例中,无论我将哪个图层设置为zIndex: 1zIndex: 2,圆圈始终显示在多边形的顶部

var map;
var kml1 = 'http://www.energy.ca.gov/maps/renewable/BuildingClimateZonesMap.kmz';
var kml2 = 'http://www.energy.ca.gov/maps/renewable/renewable_development.kmz';

function initMap() {
  map = new google.maps.Map(document.getElementById('map'), {
    center: new google.maps.LatLng(-19.257753, 146.823688),
    zoom: 2
  });
  var kmlLayer1 = new google.maps.KmlLayer(kml1, {
    suppressInfoWindows: true,
    preserveViewport: false,
    map: map,
    zIndex: 2
  });
  var kmlLayer2 = new google.maps.KmlLayer(kml2, {
    suppressInfoWindows: true,
    preserveViewport: false,
    map: map,
    zIndex: 1
  });

}

工作JSFIddle

更改zIndex值是否会更改顶部显示的图层?

0 个答案:

没有答案