Skip to main content

Analysis

#Analysis 3D analysis.

FloodAnalysis

Flood analysis visualization.

Parameters

NameTypeDescription
layerLayerRequiredLayer 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
NameTypeDescription
optionObjectRequiredparameter
nametypedefault valuedescription
modelsObjectoptionalModels used for flood analysis, defaulting to all models of the current layer.
rangeArrayoptionalFrame selection range, in the form [[lon,lat],[lon,lat]...], when this parameter is not set, the entire models range will be flooded and analyzed.
minHeightNumber0optionalSubmergence starting height, unit meter.
maxHeightNumber100optionalThe submerged end height, in meters.
speedNumber1optionalSubmergence speed, unit meter/second.
startColorString#94E6F8optionalThe flood start height color.
endColorString#012895optionalThe submerged end height color.
colorMixNumber0.6optionalColor mixing ratio of flooding effect, range 0-1.
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

NameTypeDescription
mapMapRequiredMap instance.

Case

//Initialize analysis class
new mapmost.ClassifyAnalysis(map)

Instance members

analyse

Set the monomerization analysis parameters and perform monomerization.

Parameters
NameTypeDescription
optionObject/Array[Object]RequiredParameter, supports single parameter object or array format, each element is a parameter object.
nametypedefault valuedescription
coordinateArray[Number]RequiredThe point coordinates of the outer box in the two-dimensional space, [[longitude, latitude], [longitude, latitude],...].
colorString#ff0000optionalSingle color value.
opacityNumber0.5optionalSingle effect opacity, ranging from 0-1.
baseHeightNumber25optionalThe starting height of the outer box, in meters, supports integers or decimals greater than 0.
stretchHeightNumber35optionalThe stretch height of the outer box in the vertical direction, in meters, supports integers or decimals greater than 0.
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

NameTypeDescription
mapMapRequiredMap instance.

Case

//Initialize analysis class
new mapmost.ViewshedAnalysis(map)

Instance members

analyse

Set analysis parameters and perform visual domain analysis.

Parameters
NameTypeDescription
optionObjectRequiredparameter
nametypedefault valuedescription
positionArray[Number]RequiredViewpoint position coordinates, in the form of [longitude, latitude, height].
bearingNumber0optionalViewpoint azimuth, measured counterclockwise from north, in degrees.
pitchNumber0optionalViewpoint pitch angle, indicating the angle between the current line of sight direction and the overhead line of sight direction, in degrees.
distanceNumber1000optionalVisible distance, in meters, the value must be greater than 0.
fovXNumber90optionalHorizontal field of view, indicating the horizontal field of view range of visual domain analysis, that is, the horizontal range that the camera lens can capture, in degrees, ranging from 0-180.
fovYNumber45optionalVertical field of view, indicating the vertical field of view range of visual domain analysis, that is, the vertical range that the camera lens can capture, in degrees, ranging from 0-180.
invisibleColorString#990000optionalInvisible area color, supports hexadecimal value, RGB, RGBA format.
invisibleOpacityNumber0.5optionalInvisible area transparency, range is 0-1.
visibleColorString#007f00optionalVisible area color, supports hexadecimal value, RGB, RGBA format.
visibleOpacityNumber0.3optionalVisible area transparency, range is 0-1.
wireframeDisplayBooleantrueoptionalWhether to display the prompt line.
wireframeColorString#ffff00optionalPrompt wire color, supports hexadecimal value, RGB, RGBA format.
wireframeDensityNumber8optionalPrompt line density, visual area arc surface wireframe density, the value must be a multiple of 2.
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
NameTypeDescription
startPointArrayRequiredStarting point, in the shape of [longitude, latitude, altitude].
endPointArrayRequiredEnd 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

NameTypeDescription
mapMapRequiredMap 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
NameTypeDescription
optionObjectRequiredparameter
nametypedescription
rangeArrayRequiredExcavation range, in the form of [[longitude, latitude], [longitude, latitude]...].
depthNumberRequiredExcavation depth, in meters.
bottomImgStringoptionalExcavation bottom texture file path.
sideImgStringoptionalExcavation side texture file path.
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

NameTypeDescription
mapMapRequiredMap instance.

Case

//Initialize the visual analysis class
new mapmost.SightLineAnalysis(map)

Instance members

analyse

Set analysis parameters and perform visual analysis.

Parameters
NameTypeDescription
optionObjectRequiredparameter
nametypedefault valuedescription
idStringRequiredUnique identifier.
viewPointArrayRequiredThe starting point of view analysis, in the shape of [longitude, latitude, height].
targetPointArrayRequiredVisual analysis target point, in the shape of [longitude, latitude, height].
drawLineBooleantrueoptionalWhether to display the line of sight.
lineWidthNumber10optionalVisibility/obstacle line width, effective when "drawLine" is true.
viewLineColorString#ffb536optionalView line color, effective when "drawLine" is true.
obstructLineColorString#ff0000optionalObstruction line color, effective when "drawLine" is true.
layerArrayundefinedoptionalParticipate in the through-view analysis layer. If not set, it defaults to all scenes.
Return value

The return value is an object with the following parameters:

NameTypeDescription
visibleBooleanWhether the starting point is visible to the target point. Returns true if visible.
obstructPointArrayIf 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
NameTypeDescription
idStringoptionalThe 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

NameTypeDescription
mapMapRequiredMap 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
NameTypeDescription
optionsObjectRequiredparameter
nametypedefault valuedescription
centerArrayRequiredCut the longitude, latitude and height of the center point of the cube, in the form of [longitude, latitude, height].
sizeArray[10,10,10]optionalCut the cube size, in meters, in the shape of [length, width, height].
rotateZNumber0optionalThe rotation angle of the cut cube on the Z axis.
targetLayersArrayoptionalAn array of three-dimensional layer instances that supports sectioning. If it is empty by default, no sectioning will be performed.
enableFillExtrusionBooleanfalseoptionalWhether to cut the extruded body.
enableGroundBooleanfalseoptionalWhether to section the ground surface.
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

nametypedefault valuedescription
layerObjectnullRequiredTarget 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
nametypedefault valuedescription
optionsObjectRequiredparameter
nametypedefault valuedescription
polygonsArray[]optionalModel flattening range coordinates, supporting range input for multiple areas, in the form [[[lng,lat] , [lng,lat]]], if empty, the entire model will be flattened.
heightNumber0optionalThe final height of model flattening.
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

NameTypeDescription
mapMapRequiredMap instance.

Case

//Initialize shadow analysis class
new mapmost.ShadowAnalysis(map);

Instance members

analyse

Set analysis parameters and perform shadow analysis.

Parameters
NameTypeDescription
optionsObjectRequiredparameter
nametypedefault valuedescription
shadowIntensityNumber0.5optionalShadow intensity, corresponding to the color depth of the shadow, ranging from 0-1, the larger the value, the darker the shadow color.
sunPositionArray[130,50]optionalThe position of the sun, an array composed of two values. The first value represents the horizontal azimuth angle, ranging from 0-360 degrees, 0 is due north, increasing clockwise; the second value represents the solar altitude angle, ranging from 0-90 degrees, 90 degrees means the sun is directly above the head, and 0 degrees means the sun is at the horizon. It can be combined with the map.getSunPosition() function to calculate the solar altitude angle of the area at the time.
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.