Class WebMapMain<M, E, O>

Type Parameters

Hierarchy

Implemented by

Constructors

Properties

_initMapState: Record<string, any> = {}

From runtime params

_starterKits: StarterKit[]
emitter: StrictEventEmitter<EventEmitter, WebMapEvents> = ...
getPaintFunctions: {
    [name: string]: GetPaintFunction;
} = WebMapMain.getPaintFunctions

Type declaration

id: number = ...
keys: Keys = WebMapMain.keys
mapAdapter: MapAdapter<M, any, any>
mapState: Type<StateItem<any>>[] = ...
options: O = ...
runtimeParams: RuntimeParams[] = []
getPaintFunctions: {
    [name: string]: GetPaintFunction;
}

Type declaration

keys: Keys = ...

Methods

  • 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.

    Example

    // 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

    Example

    var webMap = new WebMap(options);
    webMap.getEventStatus('create'); // false
    webMap.emitter.on('create', function () {
    webMap.getEventStatus('create'); // true
    })
  • 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>>

    Example

    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 WebMapMain<M, E, O>

    Example

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

Generated using TypeDoc