Skip to content
import AreaMeasurement3DViewModel from "@arcgis/core/widgets/AreaMeasurement3D/AreaMeasurement3DViewModel.js";
Inheritance:
AreaMeasurement3DViewModelAccessor
Since
ArcGIS Maps SDK for JavaScript 4.7

Provides the logic for the AreaMeasurement3D widget and component.

See also

Constructors

Constructor

Constructor
Parameters
ParameterTypeDescriptionRequired
properties
See the properties table for a list of all the properties that may be passed into the constructor.

Properties

Any properties can be set, retrieved or listened to. See the Watch for changes topic.
PropertyTypeClass
declaredClass
readonly inherited
measurement
readonly
state
readonly
"disabled" | "ready" | "measuring" | "measured"

analysis

autocast Property
Type
AreaMeasurementAnalysis
Since
ArcGIS Maps SDK for JavaScript 4.23

The area measurement analysis object being created or modified by the view model.

If no analysis is provided, the view model automatically creates its own analysis and adds it to the view. In this case, the analysis will also be automatically removed from the view when the view model is destroyed.

Example
// Construct an area measurement analysis object outside of the view model
const analysis = new AreaMeasurementAnalysis({
geometry: {
type: "polygon", // autocasts as new Polygon()
rings: [
[-73.9817, 40.7681],
[-73.9582, 40.8005],
[-73.9495, 40.7968],
[-73.9730, 40.7644],
[-73.9817, 40.7681]
]
}
});
// Ensure that the analysis is added to the view
view.analyses.add(analysis);
// Frame the analysis in the view
view.goTo(analysis.extent);
// Pass the analysis object as a constructor parameter to modify it using the view model
const viewModel = new AreaMeasurement3DViewModel({
analysis: analysis,
view: view
});

declaredClass

readonlyinherited Property
Type
string
Inherited from: Accessor

The name of the class. The declared class name is formatted as esri.folder.className.

measurement

readonly Property
Type
Measurement | null

The current measurement of the area.

state

readonly Property
Type
"disabled" | "ready" | "measuring" | "measured"

The view model's state.

ValueDescription
disablednot ready yet
readyready for measuring
measuringcurrently measuring
measuredmeasuring has finished
Default value
"disabled"

unit

autocast Property
Type
SystemOrAreaUnit

Unit system (imperial, metric) or specific unit used for displaying the area values. Possible values are listed in unitOptions.

unitOptions

autocast Property
Type
SystemOrAreaUnit[]

List of available units and unit systems (imperial, metric) for displaying the area values. By default, the following units are included: metric, imperial, square-inches, square-feet, square-us-feet, square-yards, square-miles, square-meters, square-kilometers, acres, ares, hectares. Possible unit values can only be a subset of this list.

view

Property
Type
SceneView | null | undefined

The view from which the widget will operate.

Methods

MethodSignatureClass
clear(): void
start(): Promise<void>

clear

Method
Signature
clear (): void
Since
ArcGIS Maps SDK for JavaScript 4.16

Clears the current measurement.

Returns
void

start

Method
Signature
start (): Promise<void>
Since
ArcGIS Maps SDK for JavaScript 4.16

Starts a new measurement.

Returns
Promise<void>
Example
const areaMeasurement3DViewModel = new AreaMeasurement3DViewModel({
view: view,
unit: "square-meters"
});
await areaMeasurement3DViewModel.start();

Type definitions

MeasurementValue

deprecated Type definition

Measurement value.

text

readonly Property
Type
string | null

Text representation of the value to be displayed in the widget or null, if it should not be displayed.

state

readonly Property
Type
"available" | "unavailable" | "invalid"

State of the measurement value controlling how the value is displayed in the widget.

ValueDescription
availablemeasured value is available
unavailablemeasured value is not available due an incomplete measurement
invalidmeasured value is not available due to an invalid measurement configuration (e.g. self-intersecting polygon)

Measurement

deprecated Type definition

mode

readonly Property
Type
MeasurementMode

Describes the mode in which the measurement is computed. In euclidean mode, the area and perimeter length are computed from a flat polygon with straight segments on the perimeter in the ECEF coordinate system. In geodesic mode, the area and perimeter length are computed from a geodesic polygon on the WGS84 ellipsoid.

area

readonly Property
Type
MeasurementValue

Area of the polygon.

perimeterLength

readonly Property
Type
MeasurementValue

Perimeter length of the polygon.