Analysis
#Analysis 3D analysis.
FloodAnalysis
Flood analysis visualization.
Parameters
| Name | Type | Description |
|---|---|---|
| layer | Layer | RequiredLayer instance, ModelLayer or 3DTilesLayer. |
Case
//Initialize the flood analysis class
new mapmost.FloodAnalysis(layer)
Instance members
analyse
Set flooding parameters and render the model for flooding analysis.
Parameters
| Name | Type | Description | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| option | Object | Requiredparameter
|
Case
let analysis = new mapmost.FloodAnalysis(layer);
let polygon = [
[120.74091493906315, 31.309723842354217],
[120.74462296468971, 31.311393233066624],
[120.74484083816549, 31.30670598817069],
[120.74227073726502, 31.306037256905938],
[120.74091493906315, 31.309723842354217]];
analysis.analyse({
minHeight: 0,
maxHeight: 20,
startColor: "#07ff8a",
endColor: "#ff10fd",
speed: 5,
colorMix: 0.4,
range: polygon
});
clear
Removed flood analysis visualization.
Case
let analysis = new mapmost.FloodAnalysis(layer);
analysis.clear();
Reference example 3D Model Flood Analysis. Reference example 3DTiles Flood Analysis.
ClassifyAnalysis
Analysis class, which can perform individual analysis of 3D models and 3DTiles
Parameters
| Name | Type | Description |
|---|---|---|
| map | Map | RequiredMap instance. |
Case
//Initialize analysis class
new mapmost.ClassifyAnalysis(map)
Instance members
analyse
Set the monomerization analysis parameters and perform monomerization.
Parameters
| Name | Type | Description | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| option | Object/Array[Object] | RequiredParameter, supports single parameter object or array format, each element is a parameter object.
|
Case
//Single data analysis
let analysis = new mapmost.ClassifyAnalysis(map);
let coordinate = [
[120.7440396705365, 31.30775759163872],
[120.74733413440896, 31.308306621332633],
[120.74646526481644, 31.305344916185064],
[120.74501714882791, 31.305043327408995],
[120.743795300964, 31.306288341506914],
];
let option = {
coordinate: coordinate,
color: "#ff0000",
opacity: 0.5,
baseHeight: 25,
stretchHeight: 35,
};
analysis.analyse(option);
//Batch data single analysis
let analysis = new mapmost.ClassifyAnalysis(map);
let data = [
{
coordinate: [[lng,lat],[lng,lat],...],
color: #ba2f2f,
opacity: 0.1,
baseHeight: 0,
stretchHeight: 35
},
{
coordinate: [[lng,lat],[lng,lat],...],
color: #22d731,
opacity: 0.1,
baseHeight: 0,
stretchHeight: 35
}
...
];
analysis.analyse(data);
clear
Removed singleton effect.
Case
let analysis = new mapmost.ClassifyAnalysis(map);
analysis.clear();
Refer to Example 1 3DTiles dynamic singleton.
Refer to Example 2 3DGS dynamic singulation.
ViewshedAnalysis
Analysis class, which can perform visual domain analysis, requires a background layer in the scene.
Parameters
| Name | Type | Description |
|---|---|---|
| map | Map | RequiredMap instance. |
Case
//Initialize analysis class
new mapmost.ViewshedAnalysis(map)
Instance members
analyse
Set analysis parameters and perform visual domain analysis.
Parameters
| Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| option | Object | Requiredparameter
|
Case
let map = new mapmost.Map({
......
viewshedBufferSize: 2048 //Set the size of the visible area buffer, which must be a power of 2
});
//Initialize analysis instance
let analysis = new mapmost.ViewshedAnalysis(map);
//Analysis parameters
let opt = {
position: [120.69878455823062, 31.30434269979058, 1000],
pitch: 60,
bearing: 60,
fovX: 90,
fovY: 45,
distance: 1000,
visibleColor: "#007f00",
visibleOpacity: 0.3,
invisibleColor: "#990000",
invisibleOpacity: 0.5,
wireframeColor: "#ffff00",
wireframeDisplay: true,
wireframeDensity: 8,
}
// Start analysis
analysis.analyse(opt);
calcOption
Get analysis parameters based on starting and ending points.
Parameters
| Name | Type | Description |
|---|---|---|
| startPoint | Array | RequiredStarting point, in the shape of [longitude, latitude, altitude]. |
| endPoint | Array | RequiredEnd point, in the shape of [longitude, latitude, altitude]. |
Case
let analysis = new mapmost.ViewshedAnalysis(map);
// Get the visual domain parameters based on the starting and ending points
let st = [120.703589426768602, 31.314416492134825, 1000];
let et = [120.681136937730201, 31.324054117146595, 1];
let opt = analysis.calcOption(st, et);
// Start analysis
analysis.analyse(opt);
clear
Clear the analysis results, clear the visible area analysis results on the map, and retain the analysis instance. You can call the analyze method to update the analysis results.
Case
analysis.clear();
destroy
Destroy the analysis instance, clear the analysis results and destroy the analysis instance. After destruction, all methods of the instance cannot be called.
Case
analysis.destroy();
getOption
Get analysis parameters.
Case
let analysis = new mapmost.ViewshedAnalysis(map);
// Get analysis configuration information
let opt = analysis.getOption();
//Update analysis parameters
opt.pitch= 45;
analysis.analyse(opt);
setViewPoint
Set the current analysis perspective to the map perspective.
Case
analysis.setViewPoint();
Reference example Visual Domain Analysis.
ExcavationAnalysis
Analysis class, which can perform surface excavation analysis and operate on vector and raster data.
Parameters
| Name | Type | Description |
|---|---|---|
| map | Map | RequiredMap instance. |
Case
//Initialize analysis class
new mapmost.ExcavationAnalysis(map)
Instance members
analyse
Set analysis parameters and perform surface excavation analysis. Multiple calls will overwrite previous analysis results.
Parameters
| Name | Type | Description | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| option | Object | Requiredparameter
|
Case
//Initialize analysis instance
let excavation = new mapmost.ExcavationAnalysis(map);
// Start analysis
excavation.analyse({
range: [
[120.67470712700884, 31.31986091806357],
[120.67778068126427, 31.31802931914737],
[120.67315076176152, 31.317359955173245],
[120.67470712700884, 31.31986091806357],
], // Excavation range
depth: 20, // Excavation depth
sideImg: './excavationAnalysis/excavate_kuangqu.jpg', // Excavation side texture
bottomImg: './excavationAnalysis/excavate_bottom.jpg', // Excavation bottom texture
});
clear
Clear the analysis results, clear the analysis results on the map, and retain the analysis instance.
Case
excavation.clear();
destroy
Destroy the analysis instance, clear the analysis results and destroy the analysis instance. After destruction, all methods of the instance cannot be called.
Case
excavation.destroy();
Reference example Surface Excavation Analysis.
SightLineAnalysis
Visual analysis.
Parameters
| Name | Type | Description |
|---|---|---|
| map | Map | RequiredMap instance. |
Case
//Initialize the visual analysis class
new mapmost.SightLineAnalysis(map)
Instance members
analyse
Set analysis parameters and perform visual analysis.
Parameters
| Name | Type | Description | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| option | Object | Requiredparameter
|
Return value
The return value is an object with the following parameters:
| Name | Type | Description |
|---|---|---|
| visible | Boolean | Whether the starting point is visible to the target point. Returns true if visible. |
| obstructPoint | Array | If there is no visibility, return the coordinates of the obstacle point; if there is visibility, return undefined. |
Case
//Initialize analysis instance
let sightLineAnalysis = new mapmost.SightLineAnalysis(map);
// Start analysis
let result=sightLineAnalysis.analyse({
id:"sight",
viewPoint:[120.67233678173892, 31.318166023281748, 600],
targetPoint: [120.67559559597004, 31.319729878719883, 0],
});
clear
Remove all-in-one analysis visualizations.
Parameters
| Name | Type | Description |
|---|---|---|
| id | String | optionalThe unique identifier of the visual analysis. If not filled in, all analysis visualization effects will be cleared. |
Case
let sightLineAnalysis = new mapmost.SightLineAnalysis(map);
sightLineAnalysis.clear('sight'); // Clear corresponding analysis visualization based on id
sightLineAnalysis.clear(); // Clear all analysis visualizations
destroy
Destroy the view analysis instance.
Case
let sightLineAnalysis = new mapmost.SightLineAnalysis(map);
sightLineAnalysis.destroy()
Reference example SightLineAnalysis.
CubeSectionAnalysis
Cube section analysis. turf.js needs to be introduced.
Parameters
| Name | Type | Description |
|---|---|---|
| map | Map | RequiredMap instance. |
Case
<script src="https://unpkg.com/@turf/turf@6/turf.min.js"></script>
//Initialize cube section analysis class
new mapmost.CubeSectionAnalysis(map);
Instance members
analyse
Set analysis parameters and perform cube section analysis.
Parameters
| Name | Type | Description | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| options | Object | Requiredparameter
|
Return value
Returns the eight vertex coordinates of the current cube box.
Case
//Initialize analysis instance
let lst = new mapmost.CubeSectionAnalysis(map);
// Start analysis
let result = lst.analyse({
center: [120,31,30], // longitude, latitude, altitude
size: [100, 100, 100], // Size of cube section
rotateZ: 0, // z-axis rotation angle
targetLayers: [modelLayer,layer3dtils], //3D layer instance that needs to be cut
enableFillExtrusion: true, // Enable extruded body cropping
enableGround: true, // Enable ground cropping
});
clear
All sectioning effects are cleared, the analysis instance is retained, and the analyze method can be called to update the analysis results.
Case
lst.clear()
destroy
Destroy the section analysis instance.
Case
lst.destroy()
Reference example Cube Section Analysis.
FlattenAnalysis
Supports flattening analysis of 3D models and tilted models.
Parameters
| name | type | default value | description |
|---|---|---|---|
| layer | Object | null | RequiredTarget layer used for flattening analysis. |
Case
//Initialize the flattening analysis class
new mapmost.FlattenAnalysis(map.getLayer('tile-3d-layer'));
Instance members
analyse
Set analysis parameters and perform flattening analysis.
Parameters
| name | type | default value | description | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| options | Object | Requiredparameter
|
Case
let analysis = new mapmost.FlattenAnalysis(map.getLayer('tile-3d-layer'));
let polygon = [
[120.74421245579252, 31.30775300769311],
[120.74758589888756, 31.308615538173648],
// ……
];
//Start analysis
analysis.analyse({
height: 3, // The final height of the flattened model
polygons: [polygon], // Model flattening range coordinates
});
clear
All flattening effects are cleared, the analysis instance is retained, and the analyze method can be called to update the analysis results.
Case
analysis.clear()
Refer to the example Flatten Analysis.
ShadowAnalysis
Supports visualization of shadow effects for vector extruded bodies, 3D precision models, and tilt data.
Parameters
| Name | Type | Description |
|---|---|---|
| map | Map | RequiredMap instance. |
Case
//Initialize shadow analysis class
new mapmost.ShadowAnalysis(map);
Instance members
analyse
Set analysis parameters and perform shadow analysis.
Parameters
| Name | Type | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| options | Object | Requiredparameter
|
Case
// Initialize the analysis instance, only allowed to be instantiated once
let shadowAnalysis = new mapmost.ShadowAnalysis(map);
// Start analysis
shadowAnalysis.analyse({
sunPosition: [130,50], // sun position
shadowIntensity: 0.8, // shadow intensity
});
clear
All shadow effects are cleared, the analysis instance is retained, and the analyze method can be called to update the analysis results.
Case
shadowAnalysis.clear()
destroy
Destroy the shadow analysis instance.
Case
shadowAnalysis.destroy()
Reference example Shadow Analysis.