I have a couple .jpeg files of few hundred megabytes each along their .prj projections and .wld world files – i.e. some georeferenced raster from what I read — and wish to import them for use with OSMAnd as overlays. This is a follow-up of a previous question I asked:

I now have a proper georeferenced raster imported into qgis and it seems that I can export (via Save As with a right-click on the layer) tiles as georeferenced .tiff but not .mbtiles as I get a cannot find min and max_zoom_level. Note that I tried to pick a EPSG:3857 projection for .mbtiles as using the EPSG:4326 was getting me an error.

I'm wondering how to import them inside OSMAnd. I've found that OSMAnd use .obf files for offline maps and/or may also use a .sqlite database. It seems that I may have to do a conversion but I'm not sure how to use the output file, nor how to generate an .obf file.

Thus, to sum up:

  • How to export a qgis raster layer for use as an overlay or underlay inside osmand?

1 Answer 1


I successfully exported the raster to OSMAnd as following:

  1. Right-click on the layer, Export > Save As.
  2. Configure first Rendered Image, then pick GeoTIFF with EPSG:3857 pseudo-mercator CRS.
    • for example, pick custom-EPSG-3857.tif as file name.
  3. Calculate from Layer the extent, pick Layer Resolution for resolution, export.
  4. Use gdal_translate custom-EPSG-3857.tif custom.mbtiles to convert to mbtiles -- should be available in a virtualenv with pip install gdal.
  5. Use gdaladdo -r nearest custom.mbtiles 2 4 8 16 to add zoom levels if needed -- might be required by OSMAnd.
  6. Run git clone "https://github.com/tarwirdur/mbtiles2osmand"
  7. Run python3 mbtiles2osmand/mbtiles2osmand.py -f custom.mbtiles custom.sqlite
  8. Run sudo adb push custom.sqlite /sdcard/Android/data/net.osmand/files/tiles/custom.sqlitedb where you replace /sdcard/Android/data/net.osmand by the path of your OSMAnd application.
  9. After restarting OSMAnd, the file should be listed as overlay.

Note that the file custom.sqlitedb correspond to a custom overlay listed, however a custom.sqlite file won't work -- the suffix must be .sqlitedb.

  • As a complement, some pointed me out github.com/ecometrica/gdal2mbtiles that can perform both the gdal_translate and gdaladdo steps in a more sound way.
    – plcp
    Mar 2, 2020 at 11:04
  • Thanks so much for this
    – Thomas
    Jul 6, 2022 at 21:25

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.