Measure

new Cesium.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. Use the `showDistanceMeasureComponents` option to view the horizontal and vertical components of the distance including the angles from horizontal and vertical. 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 Default Description
container String | Element The container for the widget
scene Scene The scene
units MeasureUnits MeasureUnits.METERS optional The default unit of measurement
showDistanceMeasureComponents Boolean false optional Whether or not to show the x and y components of the distance measurement by default
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 mesureWidget = new Cesium.Measure({
     container : 'measureContainer',
     scene : scene,
     units : Cesium.MeasureUnits.FEET
});
Demo:
See:

Members

readonlycontainer : Element

Gets the parent container.

readonlytilesetMeasurementSupported : Boolean

Gets whether drawing a measurement on a Cesium3DTileset or Model is supported
Gets the view model.

Methods

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.