Leaflet plugin to use Webatlas tilecache with correct attribution and API keys. Requires only vanilla Leaflet.
-
Install the package
npm i leaflet-webatlastile
-
Import what you need:
import {webatlasTileLayer} from 'leaflet-webatlastile';
-
Instantiate a new layer the same way a L.TileLayer from Leaflet is instantiated, just remember the API token:
webatlasTileLayer({apiKey: 'my-api-key'}).addTo(map);
To specify another layer:
webatlasTileLayer({apiKey: 'my-api-key', mapType: WebatlasTileLayerTypes.GREY}).addTo(map);
See demo/index.ts for example use.
See <developer.norkart.no> for obtaining a trial token.
mapType
: one of WebatlasTileLayerTypes (Default: WebatlasTileLayerTypes.VECTOR)apiKey
: a Webatlas API TokenattributionPosition
: Position of the attribution text. Possible values are 'topleft', 'topright', 'bottomleft' or 'bottomright'. Default: 'bottomright'.
- Install dependencies:
npm install
- Run
npm run start
to start a dev server, and edit files in the/demo
folder - Run tests with
npm test