Measure

new IonSdkMeasurements.Measure(options)


Measure toolbar expanded.


Measure is a widget that allows users to make ephemeral measurements by clicking on the globe surface and on Cesium3DTiles and glTF models.

Measurement types include:

  • Area: Computes the area of an arbitrary polygon. Note that the polygon area does not take into account the contours of terrain.
  • Distance: Computes a linear distance between two points. Note that measurements on the earth do not conform to terrain.
  • Component Distance: Computes a linear distance between two points, with horizontal and vertical components and the angle of the line. Note that measurements on the earth do not conform to terrain.
  • Height: Computes a linear distance between a point in space and the terrain below that point. This value will always be 0 if activated in 2D mode.
  • Horizontal: Computes a linear distance between two points at the same height relative to the the WGS84 Ellipsoid.
  • Point: Displays the longitude and latitude coordinates and the height above terrain at a specified point in space.
  • Vertical: Computes a linear distance between two points with the same longitude/latitude but different heights. This value will always be 0 if activated in 2D mode.

Note that drawing measurements on 3D tiles and models may not be supported by all browsers. Check the tilesetMeasurementSupported to see if it is supported.
Name Type Description
options Object An object with the following properties
Name Type Description
container String | Element The container for the widget
scene Scene The scene
units MeasureUnits optional The default unit of measurement
locale String optional The BCP 47 language tag string customizing language-sensitive number formatting. If undefined, the runtime's default locale is used. See the Intl page on MDN
primitives PrimitiveCollection optional A collection in which to store the measurement primitives
Example:
// In HTML head, include a link to the Measure.css stylesheet,
// and in the body, include: <div id="measureContainer"></div>
// Note: This code assumes you already have a Scene instance.

var measureWidget = new IonSdkMeasurements.Measure({
     container : 'measureContainer',
     scene : scene,
     units : new IonSdkMeasurements.MeasureUnits({
         distanceUnits : IonSdkMeasurements.DistanceUnits.METERS,
         areaUnits : IonSdkMeasurements.AreaUnits.SQUARE_METERS,
         volumeUnits : IonSdkMeasurements.VolumeUnits.CUBIC_FEET,
         angleUnits : IonSdkMeasurements.AngleUnits.DEGREES,
         slopeUnits : IonSdkMeasurements.AngleUnits.GRADE
     })
});
Demo:
See:

Members

readonly container : Element

Gets the parent container.

readonly tilesetMeasurementSupported : Boolean

Gets whether drawing a measurement on a Cesium3DTileset or Model is supported

readonly viewModel : MeasureViewModel

Gets the view model.

Methods

destroy()

Destroys the widget. Should be called if permanently removing the widget from layout.

isDestroyed()Boolean

Returns:
true if the object has been destroyed, false otherwise.
Need help? The fastest way to get answers is from the community and team on the Cesium Forum.