0.0.3 • Published 1 year ago

leaflet-pmtiles-layer v0.0.3

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

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-layer

Script 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.

OptionValueDescription
autoScale'pmtiles'Default value. Use algorithms in the plug-in itself.
autoScale'leaflet'Use leaflet's built-in autoscaling.
autoScalefalseDisable autoscaling.

Development

Install dependencies

yarn install

Build the project

yarn build

Run end-to-end tests

yarn cypress run

Lint using StandardJS

yarn lint

License

MIT