The Api is the core component of @dmp/map-components:

import Api from "@dmp/map-components"

const api = new Api()

Hierarchy

  • Observable
    • Api

Constructors

  • The constructor creates a api object to use in components like a layer control or to add to a map.

    Parameters

    • options: ApiOptions

      contains the initial settings for the API.

    Returns Api

Accessors

  • get activeDatasets(): Collection
  • Get a collection of active Dataset. The order defines the rendering order in the map and ind the layerswitch

    Returns Collection

  • set activeDatasets(datasets: Collection | (Dataset | DatasetGroup)[]): void
  • Change the collection of active Dataset. The order defines the rendering order in the map and ind the layerswitch

    Parameters

    Returns void

  • get locale(): string
  • Get the current locale.

    Returns string

Methods

  • Deserialize a JSON to change the list active Dataset

    Parameters

    • datasetState: DatasetState[]

      a JSON representation of the active Datasets

    Returns Promise<void>

  • Returns Promise<any>

  • Find Dataset Collections by text. Match text in id, title, description and tags.

    Parameters

    Returns Promise<DatasetCollection[]>

    a list of datasetCollections matching the search string and ordered by best match

  • Find Dataset Owners by text. Match text in id, title, description and tags.

    Parameters

    • searchString: string

      String containing the

    • Optionalowners: Organization[]
    • Optionaloptions: IFuseOptions<Organization>

      Options for the search

    Returns Promise<Organization[]>

    a list of Dataset Owners matching the search string and ordered by best match

  • Find datasets by text. Match text in id, title, description, owners, category and tags.

    Parameters

    • searchString: string

      String containing the

    • Optionaldatasets: (Dataset | DatasetGroup)[]

      Default is the current active and visible datasets

    • Optionaloptions: IFuseOptions<Dataset | DatasetGroup>

      Options for the search

    Returns Promise<(Dataset | DatasetGroup)[]>

    a list of dataset matching the search string and ordered by best match

  • Parameters

    • event: string
    • ...args: unknown[]

    Returns void

  • Request a Dataset with a specific id

    Parameters

    • id: string

      of a Dataset

    • OptionalincludeAttributes: boolean
    • Optionalreload: boolean

    Returns Promise<Dataset | DatasetGroup>

    a the Dataset

  • Request a DatasetGroup with a specific id

    Parameters

    • id: string
    • OptionalincludeAttributes: boolean
    • Optionalreload: boolean

    Returns Promise<DatasetGroup>

    a the DatasetGroup

  • Get an OpenLayes colllection of the active Datasets to add for the map.

    Returns LayerGroup

    a OpenLayers LayerGroup

  • Get all Tags related to any previously fetched Dataset

    Returns Promise<Tag[]>

  • Is the api currently loading a DatasetState.

    Returns boolean

  • Load an initial list of active Dataset

    Parameters

    • OptionaldatasetState: DatasetState[]

      a JSON representation of the active Datasets

    Returns Promise<void>

  • Remove a listen from an event

    Parameters

    • listener: EventListener_2

      returned by the on method

    Returns void

  • Listen to an event

    Parameters

    • event:
          | "change:activedatasets"
          | "change:favorite"
          | "change:visible"
          | "change:locale"
          | "loading"

      Name of the event

    • callback: EventListenerCallback

      When the event is triggered

      • For 'change:activedatasets' the callback function is called with the event name and the new list of active Dataset
      • For 'change:favorite' the callback function is called with the event name and the Dataset that have changed the favorite state
      • For 'change:visible' the callback function is called with the event name and the Dataset that have changed the visible state
      • For 'change:locale' the callback function is called with the event name and the locale
      • For 'loading' the callback function is called with a boolean that indicates if a DatasetState is loading

    Returns EventListener_2

    A listener that can be used for removing the listener

  • Query a list of Dataset with a coordinate

    Parameters

    Returns Promise<QueryResult>[]

    a list of queried dataset with the related hits

  • Reset to the initial list of active Dataset

    Returns Promise<void>

  • Returns void

  • Serialize the current list of active Dataset

    Returns DatasetState[]

    a JSON representation of the active Datasets

  • Change the locale.

    Parameters

    Returns Promise<void>

  • Subscribe to auto updating availability status on all active Datasets

    Returns Promise<void>