Javascript 如何在传单的不同缩放级别上显示不同的图层
我现在可视化多段线,如下所示:Javascript 如何在传单的不同缩放级别上显示不同的图层,javascript,leaflet,geocoding,mapbox,Javascript,Leaflet,Geocoding,Mapbox,我现在可视化多段线,如下所示: geojson = L.vectorGrid.slicer(lines, { vectorTileLayerStyles: { sliced: style}, maxZoom: 24, // max zoom to preserve detail on interactive: true, getFeatureId: function(f) { return f.p
geojson = L.vectorGrid.slicer(lines, {
vectorTileLayerStyles: {
sliced: style},
maxZoom: 24, // max zoom to preserve detail on
interactive: true,
getFeatureId: function(f) {
return f.properties.id;
}
}).on('mouseover', mouseover_function).addTo(map);
searchCtrl.indexFeatures(lines.features, ['id']);
info.addTo(map);
这些行是所有多边形行的geoJSON文件
lines_1
lines_2
lines_3
所以我用上面的三个层创建了三个层
geojson1 = L.vectorGrid.slicer(lines1, {
vectorTileLayerStyles: {
sliced: style},
maxZoom: 24, // max zoom to preserve detail on
interactive: true,
getFeatureId: function(f) {
return f.properties.id;
}
}).on('mouseover', mouseover_function).addTo(map);
geojson2 = L.vectorGrid.slicer(lines2, {
vectorTileLayerStyles: {
sliced: style},
maxZoom: 24, // max zoom to preserve detail on
interactive: true,
getFeatureId: function(f) {
return f.properties.id;
}
})
geojson3 = L.vectorGrid.slicer(lines3, {
vectorTileLayerStyles: {
sliced: style},
maxZoom: 24, // max zoom to preserve detail on
interactive: true,
getFeatureId: function(f) {
return f.properties.id;
}
})
这是三个层,我想在所有缩放级别显示geojson1,在缩放级别20显示geojson2,在缩放级别22显示geojson3
如何在不同的缩放级别上显示这些图层
感谢您的帮助