1

I have just recently started to use MapBox. I am trying to convert a huge GeoJSON file (1.28GB) into MVT for uploading into a MapBox. I am using ogr2ogr and this command-line:

ogr2ogr -progress --config GDAL_CACHEMAX 2048 -f MVT -s_srs EPSG:4326 -t_srs EPSG:3857 grid.mbtiles grid.geojson

This creates grid.mbtiles and after uploading into Mapbox, it reports an error:

Upload error:

Tile exceeds maximum size of 500k at z5. Reduce the detail of data at this zoom level or omit it by adjusting your minzoom

I have tried to convert using the next parameters

-dsco SIMPLIFICATION=5 -dsco MINZOOM=5 -dsco MAXZOOM=10

but I still get the very same error.

Could you help me how to solve this issue or give me some advice on how to properly create a vector tileset? How could I determine that the size of particular tiles exceeds this limit before uploading it into a Mapbox studio?

3
  • 1
    There is another -dsco option for MAX_SIZE gdal.org/drivers/vector/mvt.html. The default is 500k but try to decrease it a bit.
    – user30184
    Nov 25, 2019 at 20:11
  • @user30184 Thanks, it passes the upload now but after I check the data some polygons are missing. Is there anything I could do to avoid data loss?
    – sys49152
    Nov 26, 2019 at 8:36
  • 2
    If Mapbox sets limit to 500k and you have more data for that tile then without data loss, no. You may try to simplify your data already in the database and test if it gives different results than simplification of tiles with -dsco SIMPLIFICATION=. Or you can think if you really need that many polygons into your tiles at zoom level 5. You may drop out some kind of polygons based on attributes, or select the biggest ones by area. I don't know exactly how to do it with GDAL. It may be complicated.
    – user30184
    Nov 26, 2019 at 10:36

1 Answer 1

1

I have solved this using Tippecanoe with the command:

tippecanoe -zg -o grid.mbtiles --drop-densest-as-needed --extend-zooms-if-still-dropping grid.geojson

The only "problem" was 15 hours of execution (i5-4460, 16GB RAM, SSD drive, Windows 10)! It resulted in 75MB file and without any errors. MapBox upload was OK also.

Still, I would like to know is it possible to accomplish this conversion only using ogr2ogr tool?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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