I am trying to convert JSON to MVT tiles for Mapbox (directory format) using ogr2ogr. My problem is that no matter what I do on the Mapbox/browser side, the tiles do not show up. I am thinking I am generating the tiles wrong.

What I have is weather radar data, which looks like this in the JSON file :

    "type": "Feature",
    "geometry": {      "type": "Polygon",
      "coordinates": [
          [-86.78203526482261, 33.14694835752057],
          [-86.7860454984611, 33.13859751774804],
          [-86.78673620526779, 33.138838036230396],
          [-86.78255333547662, 33.1471287631669],
          [-86.78203526482261, 33.14694835752057]
     "properties": {
        "value": 18.0,
        "colorIndex": 6

I see documentation for doing this at : https://gdal.org/drivers/vector/mvt.html. Here is the command I have used :

ogr2ogr -f MVT -dsco FORMAT=DIRECTORY -dsco MAXZOOM=10 target.mbtiles test.geojson

I am not sure what -dsco means and I can't find it in the documentation, but the script runs with it.

The output generates tiles in directories like I would expect it to look, but it will never load on a map.

Is there something wrong with the way I am converting the data?

I am not an expert here so I think that might be the problem. I am sure it's not a projection issue as the default settings are in EPSG:3857.

  • 1
    According to gdal.org/programs/ogr2ogr.html -dsco is a format specific option which is explained in the driver gdal.org/drivers/vector/mvt.html FORMAT=DIRECTORY/MBTILES: Format into which tiles are written. DIRECTORY means that tiles are written in a hierarchy like out_dir/{z}/{x}/{y}.pbf. MBTILES is for a MBTILES container. Defaults to DIRECTORY, unless the output filename has a .mbtiles extension, hopefully that helps a little bit. Mar 13, 2020 at 2:47
  • Alright, so that explains -dsco. I was able to already set the directory format and it works. It's just that there seems to be something wrong with the tiles. Hopefully I just have a missing setting or something.
    – David
    Mar 13, 2020 at 2:57

1 Answer 1


I find the solution in the page http://osgeo-org.1560.x6.nabble.com/gdal-dev-driver-MVT-no-tiles-generated-td5367086.html

In the conversation, it mentioned that GDAL MVT can not generate the tiles but only the metadata.js because the polygons in the source GeoJson were Polygon Z. The GADL MVT driver currently is only capable of dealing with x y geometry.

Then I went back to check the shape type of my data and found that mine is multipolygon. Problem solved after converting the data to polygons in QGIS.

Here is the command line I used. ogr2ogr -f MVT ./data/tiles ./data/simple.geojson -dsco MINZOOM=0 -dsco MAXZOOM=10

  • 3
    Fine that you resolved your problem but you understood something wrong. Polygon Z means that geometries have x, y, and z coordinates where z means height. Converting multipolygons into polygons does not automatically drop z, and it is possible to drop z from multipolygons without turning them into polygons. So you resolved your problem but it is a bit unclear what was the critical change. The PolygonZ problem that GDAL had was fixed two years ago and you probably do not have so old version.
    – user30184
    Aug 5, 2020 at 8:44
  • 1
    Thanks for sharing this knowledge
    – lang sun
    Aug 5, 2020 at 12:44

Your Answer

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

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