Type Parameters

Hierarchy (view full)

Implemented by

Constructors

Properties

_initMapState: Record<string, any> = {}
_starterKits: StarterKit[]
emitter: StrictEventEmitter<EventEmitter<DefaultEventMap>, WebMapEvents> = ...
getPaintFunctions: {
    [name: string]: GetPaintFunction;
} = WebMapMain.getPaintFunctions
id: number = ...
keys: Keys = WebMapMain.keys
mapAdapter: MapAdapter<M, any, any>
mapState: StateItem<any>[] = []

From runtime params

mapStateItems: Type<StateItem<any>>[] = ...
options: O = ...
runtimeParams: RuntimeParams<Params, string>[] = []
getPaintFunctions: {
    [name: string]: GetPaintFunction;
}
keys: Keys = ...

Methods

  • Sets a map view that contains the given geographical bounds.

    Parameters

    Returns this

    // Whole world
    webMap.fitBounds([0, -90, 180, 90]);
  • Returns the map's geographical centerpoint.

    Returns undefined | LngLatArray

    lngLat Array of two numbers representing longitude and latitude of the center of the map view.

    // Mount Everest 27° 59′ 17″ N, 86° 55′ 31″ E
    webMap.getCenter(); // [86.925278, 27.988056]
  • Returns the HTML element that contains the map.

    Returns undefined | HTMLElement

    The map's container

  • Checking the status of any asynchronous operation

    Parameters

    • event: keyof E

      The name of the event whose status is checked

    Returns boolean

    var webMap = new WebMap(options);
    webMap.getEventStatus('create'); // false
    webMap.emitter.on('create', function () {
    webMap.getEventStatus('create'); // true
    })
  • Parameters

    • func: ((x: any) => any)
        • (x): any
        • Parameters

          • x: any

          Returns any

    Returns Record<string, any>

  • helper method to wait for events to load. By default, card creation is tracked

    Parameters

    • event: keyof WebMapEvents = 'create'

      The name of the event whose status is checked

    Returns Promise<WebMapMain<M, E, O>>

    var webMap = new WebMap(options);
    webMap.onLoad().then(function () {
    webMap.getEventStatus('create'); // true
    })

    // use async/await syntax
    async function () {
    await webMap.onLoad();
    doSomething();
    }
  • Set the center of the current view.

    Parameters

    • lngLat: LngLatArray

      Array of two numbers representing longitude and latitude of the center of the map view.

    Returns this

    // Mount Everest 27° 59′ 17″ N, 86° 55′ 31″ E
    webMap.setCenter([86.925278, 27.988056]);