CrossCutAnalysis
A spatial analysis object for crosscut (profile) analysis, used to perform crosscut analysis on a 3D scene.
It cuts through the model along a cutLine and displays the cross-section face, and can sample points at equal intervals along the cut line to query the altitude of each point (getAltitudes).
Constructor
import { CrossCutAnalysis } from '@maptalks/gl-layers';
const crosscutAnalysis = new CrossCutAnalysis({
cutLine: [
[108.95943151743995, 34.220773839751956],
[108.95942615302192, 34.21846280188899]
],
cutLineColor: [0.0, 1.0, 0.0, 1.0]
});
crosscutAnalysis.addTo(groupGLLayer);Details
- options* Object configuration options, the available options are as follows:
| Option | Type | Description | Default |
|---|---|---|---|
| cutLine* | Array<Array> | The coordinate array of the cut line, forming a polyline | null |
| cutLineColor | Number[] | The fill color of the cross-section face (the source's DEFAULT_WATER_COLOR, verified against the 2026 source) | [0.8451, 0.2588, 0.4863] |
| textureUrl | String | The url of the cross-section texture (mentioned in the README) | null |
Member Methods
getAltitudes(count)
Samples count points at equal intervals along the cut line and returns the coordinate and the distance along the line of each sampled point, which can be used to draw a profile line or measure the elevation of the cross-section (added after cross-checking the 2026 source code).
Parameters:
- count Number the number of sample points
Returns:
- Object[] each element is
{ coordinate: Coordinate(x, y, z), distance }, wherecoordinate.zis the altitude of the sampled point
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)