@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 cssPrefix(): string

      CSS prefix for the control buttons. Default is empty string

      Returns string

    • get distanceIsochroneCostingModel(): "auto" | "pedestrian" | "bicycle"

      Get the means of transport for Valhalla distance isochrone api

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

      isochroneCostingModelType

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

      Set the means of transport for Valhalla distance isochrone api

      Parameters

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

        isochroneCostingModelType

      Returns void

      'pedestrian', 'bicycle', 'auto'
      
    • 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 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(): "kilometers" | "miles"

      Get the distance unit for Valhalla routing api

      Returns "kilometers" | "miles"

      routingDistanceUnitType

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

      Set the distance unit for Valhalla routing api

      Parameters

      • value: "kilometers" | "miles"

        routingDistanceUnitType

      Returns void

      'kilometers', 'miles'
      
    • get showDeleteConfirmation(): boolean

      Show delete confirmation popup when deleting features if true. Default is false

      Returns boolean

    • set showDeleteConfirmation(value: boolean): void

      Set show delete confirmation popup when deleting features if true. Default is false

      Parameters

      • value: boolean

      Returns void

    • get timeIsochroneCostingModel(): "auto" | "pedestrian" | "bicycle"

      Get the means of transport for Valhalla time isochrone api

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

      isochroneCostingModelType

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

      Set the means of transport for Valhalla time isochrone api

      Parameters

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

        isochroneCostingModelType

      Returns void

      'pedestrian', 'bicycle', 'auto'
      

    Methods

    • 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: 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 { features: GeoJSONStoreFeatures<GeoJSONStoreGeometries>[]; type: string }

      FeatureCollection in GeoJSON format