1
votes

I have a large geoJson file (almost 700MB) and I need to load it in my map using mapbox and openmaptiles server. I need to have an external file, so I can't use Mapbox Studio for uploading and converting the data.

I can't use geojson2mvt since the file is large and it exceeds the memory heap. So, I used Tippecanoe to convert it to .Mbtiles. However, I can't use this format in mapbox. I follow these steps in order to convert Mbtiles to .mvt:

  1. Install tippecanoe (https://github.com/mapbox/tippecanoe) and generate mbtiles:

    tippecanoe -o mbt_file.mbtiles -z18 input_file.geojson -pC

  2. Install mb-util(https://github.com/mapbox/mbutil) and convert mbtiles to mvt tiles:

    ./mbutil/mb-util mbt_file.mbtiles mvt_dir --image_format=pbf

  3. All files are now in proper format, but you have to change their extension:

    find mvt_dir -iname "*.pbf" -exec bash -c 'mv "$0" "${0%\.pbf}.mvt"' {} \;

the file has been successfully converted to .mvt, but when I try to load it in my map it displays the following error:

blob:null/e1d9d487-dfa4-48b1-aa0e-b66527f28ac8:11754 Uncaught Error: Unimplemented type: 3
    at No.skip (blob:null/e1d9d487-dfa4-48b1-aa0e-b66527f28ac8:11754)
    at No.readFields (blob:null/e1d9d487-dfa4-48b1-aa0e-b66527f28ac8:11574)
    at new Za (blob:null/e1d9d487-dfa4-48b1-aa0e-b66527f28ac8:9948)
    at $a (blob:null/e1d9d487-dfa4-48b1-aa0e-b66527f28ac8:9964)
    at No.readFields (blob:null/e1d9d487-dfa4-48b1-aa0e-b66527f28ac8:11573)
    at new VectorTile (blob:null/e1d9d487-dfa4-48b1-aa0e-b66527f28ac8:9978)
    at blob:null/e1d9d487-dfa4-48b1-aa0e-b66527f28ac8:14432
    at XMLHttpRequest.T.r.onload (blob:null/e1d9d487-dfa4-48b1-aa0e-b66527f28ac8:416)

Can someone help me fix this? or is there any way to display my large geojson file?

Thanks!

1
Just FYI, if you do -e mvt_dir instead of -o mbt_file.mbtiles in the first step, you won't need the second step.Steve Bennett

1 Answers

2
votes

As @Caramiriel alluded to, Unimplemented type: 3 usually means your tiles are gzipped and Mapbox GL JS is expecting uncompressed tiles. Just add a Content-Encoding: gzip header and let the browser do decompression on the fly.