0.3.0 • Published 1 year ago

@awhere/maps-maptalks v0.3.0

Weekly downloads
7
License
Apache-2.0
Repository
gitlab
Last release
1 year ago

@awhere/maps-maptalks

The awesome aWhere JavaScript API for Maptalks.

Installation

Install the package in your project directory with:

// with npm
npm install @awhere/maps-maptalks

// with yarn
yarn add @awhere/maps-maptalks

Example

<body>
    <div id="map"></div>
    <script>
        let credential;

        /* Create credential with Basic API Key */
        credential = new awhere.identity.APIKey({
            aWhereUrl: '<Your aWhere URL>',
            key: '<Your API Key>',
        });

        /* Create credential with OAuth 2.0 */
        // credential = new awhere.identity.OAuth({
        //     aWhereUrl: '<Your aWhere URL>',
        //     appId: '<Your App Id>',
        //     callbackUrl: '/oauth-callback.html',
        // });

        /* Create credential with Basic Authentication */
        // credential = new awhere.identity.BasicAuth({
        //     aWhereUrl: '<Your aWhere URL>',
        //     username: '<Your Username>',
        //     password: '<Your Password>',
        // });

        /* Create credential with Access Token */
        // credential = new awhere.identity.BearerToken({
        //     aWhereUrl: '<Your aWhere URL>',
        //     token: '<Your Access Token>',
        // });

        /* Register credential with identityManager */
        awhere.identity.identityManager.registers([credential]);

        /* Set default credential */
        awhere.identity.identityManager.setDefaultCredential(credential);

        /* Use the API */
        awhere.map.Map.fromId('map', '<Your Web Map ID>')
            .then(map => {
                if (!map) {
                    console.warn('map_id not found.');
                    return;
                }
                window.map = map;
                console.log(`"window.map" is ready`, map);
            })
            .catch(err => {
                console.warn('error', err);
            });
        console.log('Use the aWhere JavaScript API for Maptalks here', awhere);
    </script>
</body>
0.3.0

1 year ago

0.2.27

2 years ago

0.2.26

2 years ago

0.2.25

2 years ago

0.2.24

2 years ago

0.2.23

2 years ago

0.2.22

3 years ago

0.2.21

3 years ago

0.2.20

3 years ago

0.2.19

3 years ago

0.2.18

3 years ago

0.2.17

3 years ago

0.2.16

3 years ago

0.2.15

3 years ago

0.2.14

3 years ago

0.2.13

3 years ago

0.2.12

3 years ago

0.2.11

3 years ago

0.2.10

3 years ago

0.2.7

3 years ago

0.2.6

3 years ago

0.2.9

3 years ago

0.2.8

3 years ago

0.2.5

3 years ago

0.2.4

3 years ago

0.2.3

3 years ago

0.2.2

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.1.13

3 years ago

0.1.12

3 years ago

0.1.11

3 years ago

0.1.10

3 years ago

0.1.9

3 years ago

0.1.8

3 years ago

0.1.7

4 years ago

0.1.6

4 years ago

0.1.5

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago