1.47.0 • Published 18 days ago

@2gis/mapgl v1.47.0

Weekly downloads
623
License
BSD-2-Clause
Repository
-
Last release
18 days ago

@2gis/mapgl

Async loader for 2gis MapGL API with typings.

Browser usage only!

Installation

$ npm install @2gis/mapgl

Usage

import { load } from '@2gis/mapgl';
// or const { load } = require('@2gis/mapgl');

async function start() {
    const mapglAPI = await load();

    // container — id of the div element in your html
    const map = new mapglAPI.Map('container', {
        center: [55.31878, 25.23584],
        zoom: 13,
        key: 'Your API access key',
    });

    const marker = new mapglAPI.Marker(map, {
        coordinates: [55.31878, 25.23584],
    });
}

start();

Without await/async:

load().then((mapglAPI) => {
    const map = new mapglAPI.Map('container', {
        center: [55.31878, 25.23584],
        zoom: 13,
        key: 'Your API access key',
    });
});

By default, latest version of MapGL API will be loaded (https://mapgl.2gis.com/api/js). But you can specify certain version of MapGL API to load:

load('https://mapgl.2gis.com/api/js/v1.4.2').then((mapglAPI) => {});

Checkout our release notes for MapGL API. Important to note, mapgl loader version is not equal to MapGL API version, cause it has its own features.

mapgl namespace

@2gis/mapgl exports load function and global.d.ts file which you can reference to have access to mapgl typings.

To use types from mapgl namespace you need:

  1. Add reference to node_modules/@2gis/mapgl/global.d.ts in your project.d.ts
  2. Or reference in a module, where load function is imported
/// <reference path="node_modules/@2gis/mapgl/global.d.ts" />

You can use typings for MapGL from mapgl namespace like this:

let marker: mapgl.Marker

Checkout example for more information.

1.47.0

18 days ago

1.46.0

1 month ago

1.45.2

2 months ago

1.45.1

3 months ago

1.45.0

3 months ago

1.44.0

4 months ago

1.43.0

4 months ago

1.42.0

5 months ago

1.41.1

6 months ago

1.41.0

6 months ago

1.39.0

9 months ago

1.40.0

7 months ago

1.38.0

10 months ago

1.38.1

9 months ago

1.37.2

10 months ago

1.37.0

11 months ago

1.37.1

11 months ago

1.36.0

1 year ago

1.35.1

1 year ago

1.35.0

1 year ago

1.34.1

1 year ago

1.34.0

1 year ago

1.33.1

1 year ago

1.32.0

1 year ago

1.32.1

1 year ago

1.31.1

2 years ago

1.33.0

1 year ago

1.31.0

2 years ago

1.30.0

2 years ago

1.30.1

2 years ago

1.29.0

2 years ago

1.27.0

2 years ago

1.28.0

2 years ago

1.25.0

2 years ago

1.24.1

2 years ago

1.26.0

2 years ago

1.24.0

2 years ago

1.22.0

2 years ago

1.23.0

2 years ago

1.21.0

2 years ago

1.20.1

3 years ago

1.20.0

3 years ago

1.19.0

3 years ago

1.19.1

3 years ago

1.18.0

3 years ago

1.17.0

3 years ago

1.16.0

3 years ago

1.15.2

3 years ago

1.15.1

3 years ago

1.15.0

3 years ago

1.14.1

3 years ago

1.14.0

3 years ago

1.13.0

3 years ago

1.12.1

3 years ago

1.12.0

3 years ago

1.11.3

3 years ago

1.11.2

3 years ago

1.11.1

3 years ago

1.11.0

3 years ago

1.10.0

3 years ago

1.9.1

3 years ago

1.9.0

3 years ago

1.8.0

3 years ago

1.7.0

3 years ago

1.6.0

3 years ago

1.5.1

3 years ago

1.5.0

3 years ago

1.4.2

3 years ago

1.4.1

4 years ago

1.4.0

4 years ago

1.3.3

4 years ago

1.3.2

4 years ago

1.3.1

4 years ago

1.3.0

4 years ago

1.2.0

4 years ago

1.2.1

4 years ago

1.0.0

4 years ago