||Sliced TopoJSON (sorry for the antimeridian mess, topojson-to-geojson seems to not handle it properly)|
||Protobuf vector tiles: OpenMapTiles, MapBox, MapZen or even ESRI vector tiles|
||Clickable points and lines|
||Points as icons|
If you use
npm install leaflet.vectorgrid
That will make available two files:
The difference is that
dist/Leaflet.VectorGrid.bundled.js includes all of
If you are adding these dependencies by yourself, use
If you don't want to deal with
npm and local files, you can use
<script src="https://unpkg.com/[email protected]/dist/Leaflet.VectorGrid.bundled.js"></script>
or, with the same caveats about bundled dependencies:
<script src="https://unpkg.com/[email protected]/dist/Leaflet.VectorGrid.js"></script>
This plugin exposes two new classes:
L.VectorGrid.Slicerfor displaying GeoJSON or TopoJSON data
L.VectorGrid.Protobuffor displaying vector tiles from an online tile server
You can find the API documentation, and the explanation about the styling, at:
geojson-vt: the global variable
geojsonvt must exist. If topojson data is used, then the
topojson global variable must also exist.
pbf: the global variables
Pbf must exist.
By default, VectorGrid is built with those dependencies bundled.
<g>roups in SVG
<canvas>es in Canvas
getBounds()support for the slicer (inherit/extrapolate from geojson data)
Before VectorGrid, loading vector tiles in Leaflet could only be done with the Leaflet.MapboxVectorTile or the Hoverboard plugin, but neither of those works with Leaflet 1.0.0 (or greater).
VectorGrid leverages the GridLayer feature introduced in Leaflet 1.0.0.
"THE BEER-WARE LICENSE": [email protected] wrote this file. As long as you retain this notice you can do whatever you want with this stuff. If we meet some day, and you think this stuff is worth it, you can buy me a beer in return.