Maplibre GL Terra Draw Control

Hierarchy (View Summary)

Implements

  • IControl

Constructors

Properties

controlContainer?: HTMLElement
defaultMode: string = 'render'
events: {
    [key: string]: [
        (
            event?: {
                feature?: GeoJSONStoreFeatures[];
                mode?:
                    | "render"
                    | "point"
                    | "linestring"
                    | "polygon"
                    | "rectangle"
                    | "circle"
                    | "freehand"
                    | "angled-rectangle"
                    | "sensor"
                    | "sector"
                    | "select"
                    | "delete-selection"
                    | "delete"
                    | "download";
            },
        ) => void,
    ];
} = {}
isExpanded: boolean = false
map?: Map$1
modeButtons: { [key: string]: HTMLButtonElement } = {}
options: TerradrawControlOptions = defaultControlOptions
terradraw?: TerraDraw

Methods

  • Add Terra Draw drawing mode button

    Parameters

    • mode:
          | "render"
          | "point"
          | "linestring"
          | "polygon"
          | "rectangle"
          | "circle"
          | "freehand"
          | "angled-rectangle"
          | "sensor"
          | "sector"
          | "select"
          | "delete-selection"
          | "delete"
          | "download"

      Terra Draw mode name

    Returns void

  • Get the default control position

    Returns ControlPosition

    default control position. Default is 'top-right'

  • get GeoJSON features

    Parameters

    • onlySelected: boolean = false

      If true, returns only selected features. Default is false.

    Returns undefined | { features: GeoJSONStoreFeatures[]; type: string }

    FeatureCollection in GeoJSON format

  • Unregister an event for the plugin

    Parameters

    • event: EventType

      event type

    • callback: (event?: { feature?: GeoJSONStoreFeatures[] }) => void

    Returns void

  • Register an event for the plugin

    Parameters

    • event: EventType

      event type

    • callback: (event?: { feature?: GeoJSONStoreFeatures[] }) => void

    Returns void

  • add the plugin control to maplibre

    Parameters

    • map: Map$1

      Maplibre Map object

    Returns HTMLElement

    HTML Element