TransWikia.com

GeoJSON Vector Tiling in Leaflet

Geographic Information Systems Asked on August 15, 2021

I’d like to implement a geojson file with over 30MB in a web map. Of course, the Web Map runs very slow, when importing it directly. So I came across the pluginn geojson-vt, but I can’t get it working. I’m just too unexperienced in Leaflet to get this done.

What would be the way to get this working?

I tried it with this code from the GitHub Page:

var options = {
    maxZoom: 16,
    tolerance: 3,
    debug: 0,
    style: {
        fillColor: '#1EB300',
        color: '#F2FF00',
        weight: 2
    }
};
var canvasLayer = L.gridLayer.geoJson("myfile.geojson", options).addTo(map); 

I have the geojsonFile "myfile.geojson" stored directly in the leaflet folder next to the index.html.

I am running leaflet 1.7.1.

I have loaded the <script src="https://unpkg.com/[email protected]/geojson-vt.js"></script>.

I have stored the leaflet-geojson-vt.js directly in the leaflet folder next to the geojson and loaded it via <script src="/leaflet-geojson-vt.js"></script>.

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP