Leaflet / Leaflet.VectorGrid

Display gridded vector data (sliced GeoJSON or protobuf vector tiles) in Leaflet 1.0.0
598 stars 194 forks source link

Can't display vector layer using L.vectorGrid.protobuf #186

Closed symonsoft closed 5 years ago

symonsoft commented 5 years ago

I use mapbox/tippecanoe to create .pbf tiles. But when I try to display them using L.vectorGrid.protobuf nothing is rendered, although I see that proper .pbf files are requested and downloaded by browser.

I suspect that missing options parameter is the root of the problem but I am not sure:

var layer = L.vectorGrid.protobuf('http://my_static_files_server/{z}/{x}/{y}.pbf')
map.addLayer(layer)

Is it necessary to set options if I want just display vector layer represented by single polygon?

symonsoft commented 5 years ago

I found the similar problem reported at https://github.com/mapbox/tippecanoe/issues/582 By default tippecanoe creates gzip-compressed tiles, but L.vectorGrid.protobuf relies on uncompressed. Running tippecanoe with --no-tile-compression option solved the problem.

2803media commented 5 years ago

@symonsoft I deflate application/json on my server, any idea to deal with this limitation? Thanks for your help