Options
name
string optional *default:*automatic numbering
Set the layer name, you can get the layer based on name
scene.getLayerByName(name);
visible
bool optional default: true
Is the layer visible?
zIndex
int optional *default:*0
Layer drawing order, larger values are drawn on the upper layer, and you can control the upper and lower levels of layer drawing.
L7 uses a queue rendering mechanism. All layers are stored in an array internally. The rendering of each frame will sort the layer array according to the zIndex value, and then traverse the array to render the qualified layers to the scene. middle
minZoom
number optional *default:*Mapbox (0-24) Gaode (2-19)
Layer shows minimum zoom level
maxZoom
number optional *default:*Mapbox (0-24) Gaode (2-19)
Layer shows maximum zoom level
autoFit
bool optional default: false
After layer initialization is completed, whether the map will automatically zoom to the layer range.
pickingBuffer
bool optional *default:*0
The layer picking cache mechanism, for example, a 1px width line is difficult to pick up (click) with the mouse. By setting this parameter, you can expand the picking range (enlarge the size of the layer object)
blend
string optional default:‘normal’
Layer element blending effects
- normal Normal effect Default When occlusion occurs, only the color of the previous layer will be displayed.
- Additive overlay mode displays the superposition of the colors of the front and rear layers when occlusion occurs.
- subtractive subtraction mode: when occlusion occurs, the subtraction of the colors of the front and rear layers is displayed.
- max maximum value When occlusion occurs, the maximum value of the layer color rgb is displayed.
enablePropagation
boolean optional default:’false’Layer events, by default only respond to the top layer, setting to true will allow events to be transmitted transparently
⚠️ The use of mask and maskfence is not recommended. After configuring 2.14.x, the version will take effect.
Template layer: a layer used as a template. PointLayer, LineLayer, and PolygonLayer can all be used as templates. Mask layer: the layer cut by the template
maskLayers
Mask layer takes effect
array Layer optional default:[]
enableMask
Mask layer takes effect
Whether to enable the mask. It is enabled by default. It will take effect when maskLayers is not empty.
bool optional default: true
maskInside
Mask layer takes effect
boolean optional default: true
Used to describe the content of the current layer and mask boundary display.
trueShow inside the maskfalseShow outside mask
maskOpetation mask method
Template layer takes effect enumerate optional default: andIt is invalid when there are multiple maskLayers and needs to be set on the template layer.
- or intersection
- and union
Usage example
const polygonLayer = new Polygon();
const rasterLayer = new Raster({
// Raster layer uses polygon mask
maskLayers: [polygonLayer],
enableMask: true,
maskInside: true,
});