Constructors

Accessors

  • get enabled(): boolean
  • Beta

    A property used to determine whether the instance is active or not. You can use the start method to set this to true, and stop method to set this to false. This is a read only property.

    Returns boolean

    true or false depending on if the instance is stopped or started

Methods

  • Beta

    A method for adding features to the store. This method will validate the features returning an array of validation results. Features must match one of the modes enabled in the instance.

    Parameters

    Returns StoreValidation[]

    an array of validation results

  • Beta

    Removes all data from the current store and removes any rendered layers via the registering the adapter.

    Returns void

  • Beta

    Provides the ability to programmatically deselect a feature using the instances provided select mode. If not select mode is provided in the instance, an error will be thrown. If the instance is not currently in the select mode, it will switch to it.

    Parameters

    • id: FeatureId

      the id of the feature to deselect

    Returns void

  • Beta

    Returns the next feature id from the store - defaults to UUID4 unless you have set a custom idStrategy. This method can be useful if you are needing creating features outside of the Terra Draw instance but want to add them in to the store.

    Returns FeatureId

    a id, either number of string based on whatever the configured idStrategy is

  • Beta

    Gets the features at a given longitude and latitude. Will return point and linestrings that are a given pixel distance away from the lng/lat and any polygons which contain it.

    Parameters

    • lngLat: {
          lat: number;
          lng: number;
      }
      • lat: number
      • lng: number
    • Optionaloptions: {
          ignoreSelectFeatures: boolean;
          pointerDistance: number;
      }
      • ignoreSelectFeatures: boolean
      • pointerDistance: number

    Returns GeoJSONStoreFeatures[]

  • Beta

    Takes a given pointer event and Will return point and linestrings that are a given pixel distance away from the lng/lat and any polygons which contain it.

    Parameters

    • event: PointerEvent | MouseEvent
    • Optionaloptions: {
          ignoreSelectFeatures: boolean;
          pointerDistance: number;
      }
      • ignoreSelectFeatures: boolean
      • pointerDistance: number

    Returns GeoJSONStoreFeatures[]

  • Beta

    Returns true or false depending on if the Terra Draw instance has a feature with a given id

    Parameters

    Returns boolean

    a boolean determining if the instance has a feature with the given id

  • Beta

    Unregisters a Terra Draw event

    Type Parameters

    • T extends keyof TerraDrawEventListeners

    Parameters

    • event: keyof TerraDrawEventListeners

      The name of the event you wish to unregister

    • callback: TerraDrawEventListeners[T]

      The callback you originally provided to the 'on' method

    Returns void

  • Beta

    Registers a Terra Draw event

    Type Parameters

    • T extends keyof TerraDrawEventListeners

    Parameters

    • event: T

      The name of the event you wish to listen for

    • callback: TerraDrawEventListeners[T]

      The callback with you wish to be called when this event occurs

    Returns void

  • Beta

    Provides the ability to programmatically select a feature using the instances provided select mode. If not select mode is provided in the instance, an error will be thrown. If the instance is not currently in the select mode, it will switch to it.

    Parameters

    • id: FeatureId

      the id of the feature to select

    Returns void

  • Beta

    A method for setting the current mode by name. Under the hood this will stop the previous mode and start the new one.

    Parameters

    • mode: string

      The mode name you wish to start

    Returns void

  • Beta

    Allows the setting of a style for a given mode

    Type Parameters

    • Styling extends Record<string, number | `#${string}`>

    Parameters

    • mode: string

      The mode you wish to set a style for

    • styles: Styling

      The styles you wish to set for the mode - this is the same as the initialisation style schema

    Returns void

  • Beta

    A method starting Terra Draw. It put the instance into a started state, and in registers the passed adapter giving it all the callbacks required to operate.

    Returns void

  • Beta

    A method for stopping Terra Draw. Will clear the store, deregister the adapter and remove any rendered layers in the process.

    Returns void