Polygon Editor

Polygon Drawing service for creating and editing Polygons.


You must provide PolygonEditorService yourself:

selector: 'my-map',
templateUrl: './my-map.component.html',
providers: [PolygonEditorService],
export class MyMapComponent {}
<ac-map id="my-map"></ac-map>

The service is a part of AngularCesiumWidgetsModule therefor you must import it.

PolygonEditorService works together with <polylgons-editor> component. Therefor you need to create <polylgons-editor>for each PolygonEditorServiceAnd of course somewhere under <ac-map>

<ac-map id="my-map">

Thats it! just Inject the service and use the create() and edit() methods:

export class MyMapComponent {
editing$: PolygonEditorObservable;
constructor(private polygonEditor: PolygonsEditorService) {}
startDraw() {
this.editing$ = this.polygonEditor.create();
// Or Edit from existing points
const initialPos = [
Cesium.Cartesian3.fromDegrees(20, 40),
Cesium.Cartesian3.fromDegrees(45, 40),
Cesium.Cartesian3.fromDegrees(30, 20)
this.editing$ = this.polygonEditor.edit(initialPos);


  • create(options?: PolygonEditOptions, eventPriority?: number)

Start a creating a Polygon over the map, Returns: PolygonEditorObservable

// Start creating Polygon
const editing$ = polygonEditorService.create();
this.editing$.subscribe(editResult => {
  • edit(positions: Cartesian3[], options?: PolygonEditOptions, priority?: number)

Start editing a Polygon over the map from a given positions, minimum 3 positions. Returns: PolygonEditorObservable

const editing$ = this.polygonEditorService.edit(initialPositions);
  • The editor is fully customisable with PolygonEditOptions :

    • addPointEvent - Set Cesium event for adding last point, default: LEFT_CLICK

    • addPointModifier - Set Cesium event modifier for adding point, default: none

    • addLastPointEvent - Set Cesium event for adding the final point, default: DOUBLE_CLICK

    • addLastPointModifier - Set Cesium event modifier for adding last point, default: none

    • removePointEvent - Set Cesium event for removing a point, default: RIGHT_CLICK

      • In edit mode only

    • removePointModifier - Set Cesium event modifier for removing a point, default: none

      • In edit mode only

    • dragPointModifier - Set Cesium event modifier for draging a point, default: LEFT_DRAG

      • In edit mode only

    • dragPointModifier - Set Cesium event modifier for removing a point, default: none

      • In edit mode only

    • pointProps - Point customisation properties

    • polylineProps - Polyline customisation properties

    • polygonProps - Polygon customisation properties

    • allowDrag - allow shape drag, default: false

      • In edit mode only

    • pickConfiguration - configure pick behaviour with: pick height and width and drill pick limit

    • maximumNumberOfPoints - after maximum point reached change to edit mode

    • clampHeightTo3D - if the polyline should clamp to 3D entities according to clampHeightTo3DOptions

    • clampHeightTo3DOptions - Configuration for clamping to 3D

      • clampToTerrain - if to clamp to terrain. default: false - clamps to 3dTiles

      • clampMostDetailed - after editing the shape the positions height will be fixed with clampToHeight() for 3dTiles and sampleTerrain() for terrain, default: true

      • clampToHeightPickWidth - clampToHeight() width in meters.

    • setLabelsRenderFn - receives a callback that is called every time the shape is redrawn (except when the shape is being dragged). The callback is called with the last shape state and with an array of the current labels.

      • The callback should return LabelProps[]