为什么不更改KML图层的zIndex
值会更改哪个图层位于顶部?
根据the documentation,KmlLayerOptionsIterface
具有zIndex
属性。
但是,在此示例中,无论我将哪个图层设置为zIndex: 1
和zIndex: 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
值是否会更改顶部显示的图层?