This is a plugin combining geojson-vt with leafletjs, which is inspired by geojson-vt-leaflet. I am the original author of leaflet-geojson-vt. iamtekson/leaflet-geojson-vt is a fork of this repo. Welcome to use this plugin.
If you use leaflet 0.7, please switch to the leaflet0.7.7.
var options = {
maxZoom: 16,
tolerance: 3,
debug: 0,
style: {
fillColor: '#1EB300',
color: '#F2FF00',
weight: 2
}
};
var canvasLayer = L.gridLayer.geoJson(json, options).addTo(map);
Options are included with geojson-vt options and L.geojson style.
var tileIndex = geojsonvt(data, {
maxZoom: 14, // max zoom to preserve detail on
tolerance: 3, // simplification tolerance (higher means simpler)
extent: 4096, // tile extent (both width and height)
buffer: 64, // tile buffer on each side
debug: 0 // logging level (0 to disable, 1 or 2)
indexMaxZoom: 4, // max zoom in the initial tile index
indexMaxPoints: 100000, // max number of points per tile in the index
solidChildren: false // whether to include solid tile children in the index
});
run npm script with browser-sync
npm run dev
Browser on http://localhost:3000/example
- point interactive
new branch to compatiable with 1.0.0more geojson styleconvert to included class ofL.TileLayer.Canvas
different canvas layersstyle for polygon and polylinelayers changeseperate index.js into index.js and app.jsdraw point on canvasdraw marker by image(cancel)