@watergis/maplibre-gl-terradraw
    Preparing search index...

    Maplibre GL Terra Draw Measure Control

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    _cssPrefix: string = ''
    _isExpanded: boolean = false
    controlContainer?: HTMLElement
    defaultMode: string = 'render'
    events: { [key: string]: [(event: EventArgs) => void] } = {}
    map?: Map$1
    modeButtons: { [key: string]: HTMLButtonElement } = {}
    options: TerradrawControlOptions = defaultControlOptions
    terradraw?: TerraDraw

    Accessors

    • get fontGlyphs(): string[]

      Get/Set font glyph for valhalla control layers

      As default, this maesure control uses maplibre's default font glyphs(Open Sans Regular,Arial Unicode MS Regular) described at https://maplibre.org/maplibre-style-spec/layers/#text-font

      If you are using your own maplibre style or different map privider, you probably need to set the font glyphs to match your maplibre style.

      Font glyph availability depends on what types of glyphs are supported by your maplibre style (e.g., Carto, Openmap tiles, Protomap, Maptiler, etc.) Please make sure the font glyphs are available in your maplibre style.

      Usage:

      const drawControl = new MaplibreValhallaControl()
      drawControl.fontGlyphs = ['Open Sans Italic']
      map.addControl(drawControl)

      Returns string[]

    • set fontGlyphs(fontNames: string[]): void

      Parameters

      • fontNames: string[]

      Returns void

    • get isExpanded(): boolean

      get the state of whether the control is expanded or collapsed

      Returns boolean

    • set isExpanded(value: boolean): void

      set the state of the control either expanded or collapsed. terradraw mode will be reset if the state is changed. either expanded or collapsed event is dispatched when changed

      Parameters

      • value: boolean

      Returns void

    • get isochroneContourType(): "distance" | "time"

      Get the contour type for Valhalla isochrone api

      Returns "distance" | "time"

      ContourType

      'time', 'distance'
      
    • set isochroneContourType(value: "distance" | "time"): void

      Set the contour type for Valhalla isochrone api

      Parameters

      • value: "distance" | "time"

        ContourType

      Returns void

      'time', 'distance'
      
    • get isochroneCostingModel(): "auto" | "pedestrian" | "bicycle"

      Get the means of transport for Valhalla isochrone api

      Returns "auto" | "pedestrian" | "bicycle"

      isochroneCostingModelType

      'pedestrian', 'bicycle', 'auto'
      
    • set isochroneCostingModel(value: "auto" | "pedestrian" | "bicycle"): void

      Set the means of transport for Valhalla isochrone api

      Parameters

      • value: "auto" | "pedestrian" | "bicycle"

        isochroneCostingModelType

      Returns void

      'pedestrian', 'bicycle', 'auto'
      
    • get routingCostingModel(): "auto" | "pedestrian" | "bicycle"

      Get the means of transport for Valhalla routing api

      Returns "auto" | "pedestrian" | "bicycle"

      costingModelType

      'pedestrian', 'bicycle', 'auto'
      
    • set routingCostingModel(value: "auto" | "pedestrian" | "bicycle"): void

      Set the means of transport for Valhalla routing api

      Parameters

      • value: "auto" | "pedestrian" | "bicycle"

        costingModelType

      Returns void

      'pedestrian', 'bicycle', 'auto'
      
    • get routingDistanceUnit(): "miles" | "kilometers"

      Get the distance unit for Valhalla routing api

      Returns "miles" | "kilometers"

      routingDistanceUnitType

      'kilometers', 'miles'
      
    • set routingDistanceUnit(value: "miles" | "kilometers"): void

      Set the distance unit for Valhalla routing api

      Parameters

      • value: "miles" | "kilometers"

        routingDistanceUnitType

      Returns void

      'kilometers', 'miles'
      

    Methods

    • Add Terra Draw drawing mode button

      Parameters

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

        Terra Draw mode name

      Returns void

    • clean maplibre style to filter only for terradraw related layers or without them. If options are not set, returns original style given to the function.

      This can be useful incase users only want to get terradraw related layers or without it.

      Usage: cleanStyle(map.getStyle, { excludeTerraDrawLayers: true}) cleanStyle(map.getStyle, { onlyTerraDrawLayers: true})

      Parameters

      • style: StyleSpecification

        maplibre style spec

      • Optionaloptions: { excludeTerraDrawLayers?: boolean; onlyTerraDrawLayers?: boolean }
        • OptionalexcludeTerraDrawLayers?: boolean

          return maplibre style without terradraw layers and sources

        • OptionalonlyTerraDrawLayers?: boolean

          return maplibre style with only terradraw layers and sources

      Returns StyleSpecification

    • Clear GeoJSON feature related to extended control such as measure and valhalla by TerraDraw feature ID

      Parameters

      • sourceIds: string[]

        the array of source ID to delete

      • ids: undefined | FeatureId[] = undefined

        the array of feature ID. Optional, if undefined, delete all labels for source

      Returns void

      void

    • 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