NextGIS Frontend
    Preparing search index...

    Class WebMapMain<M, E, O>

    Type Parameters

    Hierarchy (View Summary)

    Implemented by

    Index

    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>
    mapState: StateItem<any>[] = []

    From runtime params

    mapStateItems: Type<StateItem<any>>[] = ...
    options: O = ...
    runtimeParams: RuntimeParams<Params, string>[] = []
    getPaintFunctions: { [name: string]: GetPaintFunction }
    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.

      // 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
      })
    • 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]);
    • Sets the view of the map geographical center and zoom

      Parameters

      • lngLatOr: LngLatArray
      • Optionalzoom: number

        The zoom level to set (0-24).

      Returns void

      // Mount Everest 27° 59′ 17″ N, 86° 55′ 31″ E
      webMap.setView([86.925278, 27.988056], 12)
    • Sets the view of the map geographical center and zoom

      Parameters

      Returns void

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