▾
import "@arcgis/map-components/components/arcgis-area-measurement-3d";- Inheritance
- ArcgisAreaMeasurement3d→
HTMLElement
- Since
- ArcGIS Maps SDK for JavaScript 4.28
The Area Measurement 3D component can be added to an arcgis-scene component to calculate and display area and perimeter of polygons.
How the area and perimeter are computed depends on the scene's spatial reference and the length of the measured perimeter.
In geographic coordinate systems (GCS) and in Web Mercator:
- If the measurement's perimeter is below 100 km, they are computed in a Euclidean manner, in an ECEF coordinate system (or equivalent on other planets).
- If the perimeter is above 100 km, they are computed geodetically, and the visualization takes the curvature of the planet into consideration.
In projected coordinate systems (PCS), apart from Web Mercator, the area and perimeter are always calculated in a Euclidean manner (in their respective PCS).
The area may be visualized and calculated in two ways:
- If all the vertices are mostly coplanar (lying on the same plane), the measurement polygon is formed on that plane, and area and perimeter are calculated from its geometry.
- If the vertices don't form a planar surface, the measurement polygon is projected to a horizontal plane, and area and perimeter are calculated from its geometry.

When the component is active, a horizontal "laser" line is drawn which indicates the height at the current mouse position. This line can help in analyzing the heights of objects relative to each other and the terrain.
Things to consider
- Area Measurement 3D is designed to work in the Scene component. For measurements in the arcgis-map component, use arcgis-area-measurement-2d.
- Snapping is enabled by default. Holding the
CTRLkey disables it. - Layer types currently supported for snapping are: FeatureLayer, GraphicsLayer (except Mesh geometries), GeoJSONLayer, WFSLayer, CSVLayer, 3D Object SceneLayer, and BuildingSceneLayer.
See also
Demo
Properties
| Property | Attribute | Type |
|---|---|---|
| | ||
| auto-destroy-disabled | ||
| hide-reset-units-button | ||
| hide-start-button | ||
| hide-unit-select | ||
| hide-visualization | ||
| reflected | icon | Icon["icon"] | undefined |
| interaction-disabled | ||
| label | ||
| | ||
| reference-element | ||
| readonly | | |
| unit | ||
| | ||
| |
analysis
The AreaMeasurementAnalysis created or modified by the component.
When connecting the Area Measurement 3D component to the arcgis-scene component, it automatically creates an empty analysis and adds it to the Scene's arcgis-scene.analyses collection. You can then wait for the AreaMeasurementAnalysisView3D to be created before accessing the analysis results.
// Get the Scene component and the Area Measurement 3D component, and wait until both are ready.const viewElement = document.querySelector("arcgis-scene");await viewElement.viewOnReady();const areaMeasurement3dElement = document.querySelector("arcgis-area-measurement-3d");await areaMeasurement3dElement.componentOnReady();
// Get the AreaMeasurementAnalysis created by the Area Measurement 3D component.const analysis = areaMeasurement3dElement.analysis;
// Get the AreaMeasurementAnalysisView3D and watch for results.const analysisView = await viewElement.whenAnalysisView(analysis);const handle = reactiveUtils.watch( () => analysisView?.result, () => { console.log("Analysis results:", analysisView.result); },);Whenever the component is destroyed, the analysis is automatically removed from the collection.
Alternatively, a programmatically created AreaMeasurementAnalysis can be provided to the component. Then, the application itself needs to add it to and later remove it from the analyses collection of the Scene component.
// Create the AreaMeasurementAnalysis.const areaMeasurementAnalysis = new AreaMeasurementAnalysis({ geometry: new Polygon({ spatialReference: { latestWkid: 3857, wkid: 102100 }, rings: [ [ [-13624861.22274897, 4550346.5519295, 63.378210234455764], [-13624935.305160372, 4550273.144585712, 63.37829629518092], [-13624995.61798748, 4550334.030096778, 63.37819860037416], [-13624921.53589075, 4550407.42357004, 63.3783810287714], [-13624861.22274897, 4550346.5519295, 63.378210234455764] ] ] })});// Get the Scene component and the Area Measurement 3D component, and wait until both are ready.const viewElement = document.querySelector("arcgis-scene");await viewElement.viewOnReady();const areaMeasurement3dElement = document.querySelector("arcgis-area-measurement-3d");await areaMeasurement3dElement.componentOnReady();
// Add the analysis to the analyses collection of the Scene component.viewElement.analyses.add(areaMeasurementAnalysis);
// Connect the analysis to the measurement component:areaMeasurement3dElement.analysis = areaMeasurementAnalysis; autoDestroyDisabled
- Type
- boolean
If true, the component will not be destroyed automatically when it is disconnected from the document. This is useful when you want to move the component to a different place on the page, or temporarily hide it. If this is set, make sure to call the destroy() method when you are done to prevent memory leaks.
- Attribute
- auto-destroy-disabled
- Default value
- false
- Example
- <arcgis-area-measurement-3d auto-destroy-disabled></arcgis-area-measurement-3d>areaMeasurement-3dElement.autoDestroyDisabled = true;
hideResetUnitsButton
- Type
- boolean
- Since
- ArcGIS Maps SDK for JavaScript 5.2
If true, hides all unit-reset buttons. Unit-selection dropdowns remain available.
Resetting a unit clears the corresponding overrides on the component and its analysis. The component then uses the corresponding value from ViewOptions.displayUnits, or ViewOptions.inputUnits for input units, when that option is set and its resolved unit is included in the component's available units. Otherwise, it uses its default unit if available, or the first available unit.
- Attribute
- hide-reset-units-button
- Default value
- false
hideStartButton
- Type
- boolean
- Since
- ArcGIS Maps SDK for JavaScript 5.0
If true, the button that starts a new measurement will be hidden.
- Attribute
- hide-start-button
- Default value
- false
hideUnitSelect
- Type
- boolean
- Since
- ArcGIS Maps SDK for JavaScript 5.0
If true, the unit selection dropdown will be hidden.
- Attribute
- hide-unit-select
- Default value
- false
hideVisualization
- Type
- boolean
- Since
- ArcGIS Maps SDK for JavaScript 5.0
Indicates whether the component's visualization is hidden in the view.
- Attribute
- hide-visualization
- Default value
- false
icon
- Type
- Icon["icon"] | undefined
Icon which represents the component. Typically used when the component is controlled by another component (e.g. by the Expand component).
- See also
- Attribute
- icon
- Default value
- "measure-area"
interactionDisabled
- Type
- boolean
- Since
- ArcGIS Maps SDK for JavaScript 5.2
Indicates whether interactive creation and editing of the analysis are disabled. When true, users cannot create a new analysis interactively or modify an existing analysis using its editing manipulators. Any interactive operation in progress is canceled. If the analysis is already complete, it and its results remain visible.
- Attribute
- interaction-disabled
- Default value
- false
referenceElement
- Type
- ArcgisReferenceElement | string | undefined
By assigning the id attribute of the Map or Scene component to this property, you can position a child component anywhere in the DOM while still maintaining a connection to the Map or Scene.
- Attribute
- reference-element
unit
- Type
- SystemOrAreaUnit
Unit system (imperial, metric) or specific unit used for displaying the area values. Possible values are listed in unitOptions.
When no unit is explicitly set on the component or its analysis, this property uses the area unit configured in the view through view.options.displayUnits.area. If that option is unset or unavailable in unitOptions, the component uses its default unit if available, or the first available unit. This property overrides the area unit on this component's analysis without changing the units configured in the view. The reset button clears both overrides and resumes this inheritance and fallback behavior.
- Attribute
- unit
unitOptions
- Type
- Array<SystemOrAreaUnit>
List of available units and unit systems (imperial, metric) that are shown in the component's dropdown.
By default, the following units are included: metric, imperial, square-inches, square-feet, square-yards, square-miles, square-nautical-miles, square-us-feet, square-millimeters, square-centimeters, square-decimeters, square-meters, square-kilometers, acres, ares, hectares.
When neither the component nor its analysis has an explicit unit, the unit inherited from
view.options.displayUnits.area
is used if listed in unitOptions. Otherwise, the component checks whether its default unit is listed there.
If it is, the component uses that default. If neither unit is listed, it uses the first entry in
unitOptions.
view
The view associated with the component.
Note: The recommended approach is to fully migrate applications to use map and scene components and avoid using MapView and SceneView directly. However, if you are migrating a large application from widgets to components, you might prefer a more gradual transition. To support this use case, the SDK includes this
viewproperty which connects a component to a MapView or SceneView. Ultimately, once migration is complete, the arcgis-area-measurement-3d component will be associated with a map or scene component rather than using theviewproperty.
Methods
| Method | Signature |
|---|---|
| clear(): Promise<void> | |
| inherited | componentOnReady(): Promise<this> |
| destroy(): Promise<void> | |
| start(): Promise<void> |
componentOnReady
- Signature
-
componentOnReady (): Promise<this>
Creates a promise that resolves once the component is fully loaded.
- Returns
- Promise<this>
- Example
- const arcgisAreaMeasurement3d = document.createElement("arcgis-area-measurement-3d");document.body.append(arcgisAreaMeasurement3d);await arcgisAreaMeasurement3d.componentOnReady();console.log("arcgis-area-measurement-3d is ready to go!");
Events
| Name | Type |
|---|---|
| CustomEvent<{ name: "analysis" | "interactionDisabled" | "state"; }> | |
arcgisPropertyChange
arcgisPropertyChange: CustomEvent<{ name: "analysis" | "interactionDisabled" | "state"; }> Emitted when the value of a property is changed. Use this to listen to changes to properties.
arcgisReady
arcgisReady: CustomEvent<void> Emitted when the component associated with a map or scene view is ready for user interaction.
