leaflet-pmtiles-layer
v0.0.3
Published
A Leaflet Plugin for PMTiles formatted vector data
Readme
Leaflet.PMTilesLayer
A Leaflet Plugin for PMTiles formatted vector data. Built on Leaflet.VectorGrid and the PMTiles javascript package.
Demos
- Points
- Lines
- Polygons
Installation and setup
With npm:
npm install leaflet-pmtiles-layerScript tag:
<script src="https://unpkg.com/leaflet-pmtiles-layer@latest/dist/Leaflet.PMTilesLayer.js"></script>Usage
var options = {
style: {
weight: 1,
radius: 4,
fillColor: '#3388ff',
fill: true
}
};
var url = "https://example.com/path/to/dataset.pmtiles"
L.pmtilesLayer(url, options).addTo(map)Options
Leaflet.PMTilesLayer extends Leaflet.VectorGrid, so many of its options are available.
Styling
Unlike Leaflet.VectorGrid, layers can be styled using the style option with Path-type keys and values.
Autoscaling
Use the autoScale layer option to define auto scaling behavior. If a PMTiles layer has a maxZoom less than maxZoom of the map, tile features can be scaled for display at higher zoom levels.
Option | Value | Description
------ | ------- | -----------
autoScale | 'pmtiles' | Default value. Use algorithms in the plug-in itself.
autoScale | 'leaflet' | Use leaflet's built-in autoscaling.
autoScale | false | Disable autoscaling.
Development
Install dependencies
yarn installBuild the project
yarn buildRun end-to-end tests
yarn cypress runLint using StandardJS
yarn lint