Skip to content

kumpinar/leaflet-geojson-vt

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

leaflet-geojson-vt

A plugin combining geojson-vt with leafletjs(0.7.7), which is inspired by geojson-vt-leaflet.

Warning: This plugin is not compatiable with Leaflet 1.0, because L.Tilelayer.Canvas is replaced by L.GridLayer. Therefore, if you want to use it in Leaflet 1.0, go to the Leaflet1.0 branch please.

Usage

var options = {
    maxZoom: 16,
    tolerance: 3,
    debug: 0,
    style: {
        fillColor: '#1EB300',
        color: '#F2FF00',
        weight: 2
    }
};
var canvasLayer = L.tileLayer.canvas.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
});

Dependency

Demo

DEMO

Test

run npm script with browser-sync

npm run dev

Browser on http://localhost:3000/test

TODO

TODO

Changelog

changelog

License

LICENSE

About

A plugin combining geojson-vt with leafletjs

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 94.3%
  • HTML 5.7%