0

I am using Leaflet vectorgrid plugin with a folder of .pbf files(created from a .mbtiles file using mbutil) to load a map using Apache server.However,when I load the map on the browser,I take this error:

leaflet.vectorgrid@1.3.0:1 Uncaught Error: Unimplemented type: 6
at Pbf.skip (leaflet.vectorgrid@1.3.0:1:16761)
at Pbf.readFields (leaflet.vectorgrid@1.3.0:1:14113)
at new VectorTile$1 (leaflet.vectorgrid@1.3.0:1:5519)
at FileReader.<anonymous> (leaflet.vectorgrid@1.3.0:1:31611)

I found similar errors to be appear due to the fact that .pbf files are gzipped and the browser doesn't know it,when trying to process them. It is suggested to add a .htaccess file inside the .pbf folder,using this code:

<Files "*.pbf">
Header set Content-Encoding: gzip
</Files>

so as Apache tells the browser that the files are gzipped,so as to uncompress them. However,it doesn't work for me,I still take the above error message.

What else should I try?

5
  • Did you check if those .pbf files are actually gzipped? If they are, you could create .pbf files that are not gzipped and try with those.
    – TomazicM
    Mar 10 at 9:59
  • How can I check if they are gzipped?The extension of the files is .pbf,so I am not sure if they are gzipped or not.
    – sokratis
    Mar 10 at 10:34
  • I run the "file" command to a file and the result is:"0.pbf: PNG image data, 256 x 256, 8-bit/color RGBA, non-interlaced ",so I think they are not gzipped..
    – sokratis
    Mar 10 at 10:40
  • This means your tiles are standard raster tiles of image type PNG, so you should use standard Leaflet L.tileLayer layer.
    – TomazicM
    Mar 10 at 11:02
  • This is correct,I used the L.tileLayer command and error disappeared.Thanks for the help,really appreciate.
    – sokratis
    Mar 10 at 11:52

1 Answer 1

0

I found the issue,the .pbf were raster tiles (created by mbutil),where the function I used waited vector tiles(L.VectorGrid.Protobuf).To solve this issue,I used the L.tileLayer function.Another solution would be to convert the tile files to vector tiles so as to use the L.VectorGrid.Protobuf function.

Not the answer you're looking for? Browse other questions tagged or ask your own question.