FloodAnalysis
A spatial analysis object for flood analysis, used to perform flood analysis on a 3D scene.
Constructor
import { FloodAnalysis } from '@maptalks/gl-layers';
const floodAnalysis = new FloodAnalysis({
waterHeight: 100,
waterColor: [0.1451, 0.2588, 0.4863]
});
floodAnalysis.addTo(groupGLLayer);Details
- options* Object configuration options, the available options are as follows:
| Option | Type | Description | Default |
|---|---|---|---|
| boundary | Number[] | Boundary coordinate ring of the flooded area (optional; when not set, the whole scene is analyzed, added after cross-checking the 2026 source code) | null |
| waterHeight | Number | Water surface height | 0 |
| waterColor | Number[] | A 3-component normalized array; the water surface color | [0.1451, 0.2588, 0.4863] |
| waterOpacity | Number | Water surface opacity (added after cross-checking the 2026 source code; the default value in the source's renderAnalysis) | 0.6 |
Methods Inherited from Analysis
addTo(groupGLLayer)
Adds the analysis object to a GroupGLLayer.
Spatial analysis objects can only be added to a GroupGLLayer; they cannot be added to other WebGL layers.
Parameters:
- groupGLLayer GroupGLLayer the GroupGLLayer
Returns:
- this
remove()
Removes the spatial analysis object from the layer.
Returns:
- void
update(name, value)
Updates options data.
Parameters:
- name String the setting name
- value any the setting value
Returns:
- void
getAnalysisType()
Gets the type of the Analysis.
Returns:
- String
getDefines()
Internal method.
Returns the defines added to the shader when the Analysis is rendered.
Returns:
- Object
renderAnalysis(meshes)
Internal method.
Renders the spatial analysis scene (implemented by each analysis subclass) and returns the uniform variables required for rendering.
Parameters:
- meshes Mesh[] the scene meshes
Returns:
- Object
enable()
Enables the analysis.
Returns:
- void
disable()
Disables the analysis.
Returns:
- void
isEnable()
Whether the analysis is enabled.
Returns:
- Boolean
getExcludeLayers()
Gets the list of layer ids excluded from the analysis (these layers are ignored during the analysis).
Returns:
- String[]
setExcludeLayers(layerIds)
Sets the list of layer ids excluded from the analysis.
Parameters:
- layerIds String[] list of layer ids
Returns:
- void
exportAnalysisMap(meshes)
Exports the analysis result image (RGBA pixel data); returns null when the analysis is not enabled.
Parameters:
- meshes Mesh[] the scene meshes
Returns:
- Uint8Array
This document has been cross-checked against the @maptalks/gl-layers 2026 source (api-notes-others.md / api-notes-vt-gl.md)