3D-City Model
    Preparing search index...

    PolygonMeasurement – Interactive measurement tool for computing polygon areas in a Cesium 3D scene.

    Extends Measurement and leverages PolygonDrawing to:

    • Allow placement of 3 or more points defining a polygon
    • Render both the outline and fill, respond to live user edits
    • Dynamically label the computed area at the polygon centroid
    • Support custom point/fill colors, units, max point constraints, and show/hide or destroy controls
    • Compute area by triangulating the polygon in 3D and summing triangle areas

    Cesium Viewer or host application reference.

    Initial vertices of the polygon.

    (Optional) Maximum number of polygon vertices.

    If true, the first vertex is added instantly.

    Polygon fill/point color.

    Area unit label.

    Immediately render the polygon.

    Optional parent identifier if used in grouped measurements.

    const polyMeas = new PolygonMeasurement(viewer, {
    color: Cesium.Color.CYAN.withAlpha(0.6),
    unit: 'km²',
    render: true
    });

    // Get current area
    console.log('Area:', polyMeas.area);

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    _cartesians: any
    _finished: undefined | boolean
    _unit: undefined | string
    app: any

    Reference to the parent Cesium Viewer or app.

    destroyed: undefined | boolean
    drawing: undefined | PolygonDrawing
    id: string

    Unique identifier for this measurement instance.

    label: Label

    Label associated with this measurement (unit and prefix are forwarded).

    onFinishCallback: Function

    Finish callback (settable by onFinish()).

    parentId: undefined | string

    Identifies a parent group if present.

    render: any

    Accessors

    Methods

    • Calculates the area of the current polygon in 3D, accounting for triangulation. Uses PolygonPipeline.triangulate and sums triangle areas.

      Returns undefined | number

      Area if valid, undefined otherwise.

    • Locks/finishes the measurement if valid (min. 3 points). Triggers label positioning and value update.

      Returns boolean

      True if finalized, false otherwise.