import VolumeMeasurementAnalysis from "@arcgis/core/analysis/VolumeMeasurementAnalysis.js";
const VolumeMeasurementAnalysis = await $arcgis.import("@arcgis/core/analysis/VolumeMeasurementAnalysis.js");
@arcgis/core/analysis/VolumeMeasurementAnalysis
VolumeMeasurementAnalysis calculates and visualizes the volume of ground surfaces within a defined polygonal area, offering multiple measure types and displaying results in a 3D SceneView.
The measure type is set with the measureType property, and can be further customized using optional, type-specific options.
To display a volume measurement of a ground surface bounded by a given polygon:
- Create a new instance of VolumeMeasurementAnalysis.
- Set the measureType property.
- Set the geometry property to the given polygon instance.
- If using the "cut-fill" measureType, optionally set custom properties with VolumeMeasurementCutFillOptions.
- Add the VolumeMeasurementAnalysis instance to SceneView.analyses.
Use the VolumeMeasurementAnalysisView3D to retrieve the analysis result.
// create analysis
const volumeMeasurementAnalysis = new VolumeMeasurementAnalysis({
measureType: "stockpile", // if not set it defaults to "cut-fill"
geometry: new Polygon({ }),
});
// add to scene view
view.analyses.add(volumeMeasurementAnalysis);
// retrieve the result from the analysis view once available
const analysisView = await view.whenAnalysisView(volumeMeasurementAnalysis);
await reactiveUtils.whenOnce(() => analysisView.result);
const result = analysisView.result;
To draw a volume measurement polygon interactively, use the VolumeMeasurementAnalysisView3D.place() method.
// cancel the placement operation at some later point
// by calling abortController.abort()
const abortController = new AbortController();
try {
await analysisView.place({ signal: abortController.signal });
} catch (error) {
if (error.name === "AbortError") {
console.log("Placement operation was cancelled.");
}
}
The analysis depends on the scene's spatial reference, and the length of the measured perimeter:
-
In Projected Coordinate Systems (PCS) apart from Web Mercator, used in local viewing mode:
- There is no limit to the measurement's perimeter. This is the recommended setup for using the analysis as the accuracy is not compromised.
-
In Web Mercator PCS used in local viewing mode:
- If the measurement's perimeter exceeds 10 km, the analysis is considered invalid due to potential accuracy issues.
-
In Geographic Coordinate Systems (GCS) and Web Mercator in global viewing mode:
- If the measurement's perimeter exceeds 50 km, the analysis is considered invalid due to potential accuracy issues.
In certain situations (including information in Known Limitations below), the analysis result cannot be computed. Refer to the VolumeMeasurementAnalysisView3D.error property for more information.
Known Limitations
- This analysis is only supported in a 3D SceneView.
- The results of the tool vary depending on the zoom level, as changes in zoom level affect the level of detail (LOD) of the scene geometry.
- If the view is too close or too far from the measurement polygon, the results will not be computed due to LOD-induced inaccuracies.
- The target elevation of the fill plane ("cut-fill" measureType) is restricted to the range of -11 km and +9 km.
- This analysis operates only on the non-transparent Map.ground, IntegratedMeshLayer and an IntegratedMesh3DTilesLayer.
- This analysis does not support WGS 1984 spatial reference in a local viewingMode.
- See also
Constructors
-
Parameterproperties Objectoptional
See the properties for a list of all the properties that may be passed into the constructor.
Property Overview
| Name | Type | Summary | Class |
|---|---|---|---|
The configuration used when the measureType is set to "cut-fill". | VolumeMeasurementAnalysis | ||
The name of the class. | Accessor | ||
Units used for displaying values in the UI. | VolumeMeasurementAnalysis | ||
A polygon that defines the boundary for volume measurement computations and visualizations for all measure types. | VolumeMeasurementAnalysis | ||
A user settable identifier for the analysis. | Analysis | ||
Units used for interpreting input values. | VolumeMeasurementAnalysis | ||
Specifies the desired volume measure type. | VolumeMeasurementAnalysis | ||
The origin of the analysis. | Analysis | ||
| For VolumeMeasurementAnalysis the type is always "volume-measurement". | VolumeMeasurementAnalysis | ||
An automatically generated unique identifier assigned to the instance. | Analysis | ||
Indicates whether the analysis is ready to be computed and interacted with in the view. | VolumeMeasurementAnalysis |
Property Details
-
cutFillOptions
PropertycutFillOptions VolumeMeasurementCutFillOptionsautocast -
The configuration used when the measureType is set to "cut-fill".
-
displayUnits
PropertydisplayUnits VolumeMeasurementDisplayUnitsautocast -
Units used for displaying values in the UI.
-
A polygon that defines the boundary for volume measurement computations and visualizations for all measure types.
If the polygon has z-values these will be ignored as the polygon will be projected on the ground.
Known Limitation
Polygons with multiple rings are currently not supported.
-
inputUnits
PropertyinputUnits VolumeMeasurementInputUnitsautocast -
Units used for interpreting input values.
-
measureType
PropertymeasureType String -
Specifies the desired volume measure type.
Mode Description "cut-fill" Computes cut and fill volumes relative to a flat, horizontal surface defined by the input polygon. VolumeMeasurementCutFillOptions allows setting the elevation of the target surface and the unit of elevation. "stockpile" Calculates cut and fill volumes against a surface approximated from the input polygon's control points. Possible Values:"cut-fill" |"stockpile"
- Default Value:"cut-fill"
-
origin
InheritedPropertyorigin AnalysisOriginWebScene |null |undefinedautocastInherited from Analysis -
The origin of the analysis. The origin can be of type
web-scenewhen the analysis was applied from the WebScene.initialViewProperties or a Slide.
-
type
Propertytype Stringreadonly -
For VolumeMeasurementAnalysis the type is always "volume-measurement".
-
valid
Propertyvalid Booleanreadonly -
Indicates whether the analysis is ready to be computed and interacted with in the view. It requires the geometry to be a valid polygon whose first ring contains at least 4 points, with the first and last points being the same to close the polygon.
Method Overview
| Name | Return Type | Summary | Class |
|---|---|---|---|
Adds one or more handles which are to be tied to the lifecycle of the object. | Accessor | ||
this | Creates a deep clone of this object. | Analysis | |
Returns true if a named group of handles exist. | Accessor | ||
Removes a group of handles owned by the object. | Accessor |
Method Details
-
Inherited from Accessor
-
Adds one or more handles which are to be tied to the lifecycle of the object. The handles will be removed when the object is destroyed.
// Manually manage handles const handle = reactiveUtils.when( () => !view.updating, () => { wkidSelect.disabled = false; }, { once: true } ); this.addHandles(handle); // Destroy the object this.destroy();ParametershandleOrHandles WatchHandle|WatchHandle[]Handles marked for removal once the object is destroyed.
groupKey *optionalKey identifying the group to which the handles should be added. All the handles in the group can later be removed with Accessor.removeHandles(). If no key is provided the handles are added to a default group.
-
Inherited from Analysis
-
Creates a deep clone of this object. Any properties that store values by reference will be assigned copies of the referenced values on the cloned instance.
ReturnsType Description this A deep clone of the class instance that invoked this method.
-
hasHandles
InheritedMethodhasHandles(groupKey){Boolean}Inherited from Accessor -
Returns true if a named group of handles exist.
ParametergroupKey *optionalA group key.
ReturnsType Description Boolean Returns trueif a named group of handles exist.Example// Remove a named group of handles if they exist. if (obj.hasHandles("watch-view-updates")) { obj.removeHandles("watch-view-updates"); }
-
Inherited from Accessor
-
Removes a group of handles owned by the object.
ParametergroupKey *optionalA group key or an array or collection of group keys to remove.
Exampleobj.removeHandles(); // removes handles from default group obj.removeHandles("handle-group"); obj.removeHandles("other-handle-group");