Measure

SWVL 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. 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 Default Description
container String | Element The container for the widget
scene Scene The scene
units MeasureUnits MeasureUnits.METERS optional The default unit of measurement
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 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.