▾
import AreaMeasurementAnalysis from "@arcgis/core/analysis/AreaMeasurementAnalysis.js";const AreaMeasurementAnalysis = await $arcgis.import("@arcgis/core/analysis/AreaMeasurementAnalysis.js");- Since
- ArcGIS Maps SDK for JavaScript 4.23
AreaMeasurementAnalysis computes the area of a polygonal region and displays the measurement in a View.
To display an area measurement of a Polygon, create a new instance of AreaMeasurementAnalysis, add it to SceneView.analyses or MapView.analyses and set the geometry property.
Use the AreaMeasurementAnalysisView2D or AreaMeasurementAnalysisView3D to retrieve analysis results.
// create analysisconst analysis = new AreaMeasurementAnalysis({ geometry: new Polygon({ })});
// add to a viewview.analyses.add(analysis);
// retrieve measured results from analysis view once availableconst analysisView = await view.whenAnalysisView(analysis);await reactiveUtils.whenOnce(() => analysisView.result);
const result = analysisView.result;To draw an area measurement interactively, use the AreaMeasurementAnalysisView2D.place() or AreaMeasurementAnalysisView3D.place() method.
const abortController = new AbortController();
try { await analysisView.place({ signal: abortController.signal });} catch (error) { if (error.name === "AbortError") { console.log("Placement operation was cancelled."); }}
// cancel the placement operation at some later pointabortController.abort();How the area and perimeter are calculated depends on the view type, the spatial reference, and the measured perimeter.
-
In a MapView (2D):
- For geographic coordinate systems (GCS) and Web Mercator, measurements are calculated geodetically (on the ellipsoid).
- For projected coordinate systems (PCS), apart from Web Mercator, the area and perimeter are always calculated using Euclidean geometry within their respective PCS.
-
In a SceneView (3D):
- For geographic coordinate systems (GCS) and Web Mercator, short measurements use a Euclidean computation in an ECEF (Earth-Centered, Earth-Fixed) coordinate system (or an equivalent on other planets). Specifically, if the measurement's perimeter is ≤ 100 km the analysis uses Euclidean calculations. If the perimeter is > 100 km, it uses geodetic calculations.
- For projected coordinate systems (PCS), apart from Web Mercator, the area and perimeter are always calculated in a Euclidean (in their respective PCS).
- The area may be visualized and calculated in one of two ways:
- If the vertices are (approximately) coplanar, a measurement polygon is formed on that plane. The area and perimeter are then computed from the polygon geometry.
- If the vertices do not form a planar surface, the measurement polygon is projected to a horizontal plane and the area and perimeter are computed from the projected geometry.

Use the Area Measurement 3D component to display a user interface for the area measurement analysis.
Constructors
Constructor
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| properties | | |
Properties
| Property | Type | Class |
|---|---|---|
| readonly inherited | ||
| | ||
| readonly inherited | ||
| inherited | ||
| readonly | "area-measurement" | |
| readonly inherited | ||
| | ||
| readonly | |
geometry
origin
- Type
- AnalysisOriginWebScene | null | undefined
The origin of the analysis. The origin can be of type web-scene when the analysis was applied from the
WebScene.initialViewProperties or a
Slide.
uid
- Type
- string
- Since
- ArcGIS Maps SDK for JavaScript 4.33
An automatically generated unique identifier assigned to the instance. The unique id is generated each time the application is loaded.
unit
- Type
- SystemOrAreaUnit | null | undefined
Unit system (imperial, metric) or specific unit used for displaying the computed area in the view. If set, this property overrides view.options.displayUnits.area for this analysis.
When this property is null, the analysis uses view.options.displayUnits.area if configured.
Otherwise, it uses the portal user's or portal's unit preference, or the view's spatial reference, to choose metric or imperial units,
falling back to metric if no system can be determined.
See ViewOptions for supported options and limitations.
valid
- Type
- boolean
- Since
- ArcGIS Maps SDK for JavaScript 4.33
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.
Methods
| Method | Signature | Class |
|---|---|---|
| inherited static | fromJSON(json: any): any | |
| clear(): void | | |
| inherited | clone(): this | |
| inherited | equals(other: this): boolean | |
| inherited | toJSON(): any |
fromJSON
- Signature
-
fromJSON (json: any): any
Creates a new instance of this class and initializes it with values from a JSON object
generated from an ArcGIS product. The object passed into the input json
parameter often comes from a response to a query operation in the REST API or a
toJSON()
method from another ArcGIS product. See the Using fromJSON()
topic in the Guide for details and examples of when and how to use this function.
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| json | A JSON representation of the instance in the ArcGIS format. See the ArcGIS REST API documentation for examples of the structure of various input JSON objects. | |
- Returns
- any
Returns a new instance of this class.
clone
- Signature
-
clone (): this
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.
- Returns
- this
A deep clone of the class instance that invoked this method.
equals
- Signature
-
equals (other: this): boolean
- Since
- ArcGIS Maps SDK for JavaScript 5.0
Compares this analysis with another analysis to determine whether they are equivalent.
toJSON
- Signature
-
toJSON (): any
Converts an instance of this class to its ArcGIS portal JSON representation. See the Using fromJSON() guide topic for more information.
- Returns
- any
The ArcGIS portal JSON representation of an instance of this class.