I am trying to convert a shapefile to MBTiles format using ogr2ogr and have been running this script in the OSGEO4W command line

ogr2ogr -f MBTILES -dsco MINZOOM=10 -dsco MAXZOOM target.mbtiles C:\users\myself\path_to_shp\source.shp

Yet I get this error when I run this command

ERROR 1: sqlite3_exec(PRAGMA page_size = 4096;PRAGMA synchronous = OFF;PRAGMA journal_mode = OFF;PRAGMA temp_store = MEMORY;CREATE TABLE temp(z INTEGER, x INTEGER, y INTEGER, layer TEXT, idx INTEGER, feature BLOB, geomtype INTEGER, area_or_length DOUBLE);CREATE INDEX temp_index ON temp (z, x, y, layer, idx);) failed:
ERROR 1: MVT driver failed to create target.mbtiles

This is my first attempt to use ogr2ogr and I am wondering if it is something simple I am doing wrong here.


Figured out the problem with command. I didn't supply a proper path to where the MBtiles output should go. I also did not set a value for the MAXZOOM parameter.

The following command worked for me.

ogr2ogr -f MBTILES -dsco MINZOOM=10 -dsco MAXZOOM=22 C:\users\myself\path_to_output\target.mbtiles C:\users\myself\path_to_shp\source.shp

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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