I have a large number of tiff files (map tiles) along with tab and tfw file types as part of an Ordnance Survey download. This is for an offline iOS app. I managed to get the tiffs into QGIS with correct projections and save as a virtual raster. What I need to do now is somehow convert or save it to an mbtiles format.

How can this be done on a Mac?


I agree with mapbarker and say TileMill would be the best route. However the problem you have is that the original raster files are in British National grid (epsg:27700) and need to be warped to the google sperical mercator projection (epsg:3857)

The MapBox team have a good tutorial on this - https://www.mapbox.com/tilemill/docs/guides/reprojecting-geotiff/

So all you will have to do is warp your virtual raster, load into TileMill then export out.

The alternative is to use the gdal2tiles.py and then mbutil to load the directory of tiles into the mbtile. This is a painful and very time consuming route.


Ok to explain further.

You said you had already created your VRT for the rasters using QGIS. So you need to warp the VRT from its current projection to the one required to created MBTiles - as explained in the link above.

Do you have GDAL installed? If not you could install it and then using the link above use the gdal_warp command to convert to the EPSG 3875.

If you dont want to install GDAL then you can use QGIS>Raster(from the top toolbar)>Projections>Warp

Then select your VRT file, then specificy an output to save to

Then select EPSG:27700 as the source SRS and then EPSG:3875 as the target SRS,

Then I would loolk at this previous question - Converting Ordnance Survey raster maps to WGS84 webmap tiles and determine which resampling method you want.

Then let QGIS do it works

Once the warp has finished you will have a new raster file

Load this into TileMill and then export out as an MBTile

|improve this answer|||||
  • thank you - yes when I tried loading a tile into tilemill it complained about the SRS being incorrect. I've tried reprojecting via gdal within qgis but to no avail! This is very frustrating. I also need to batch convert over 90 tiffs too. Would appreciate any more light being shed on the issue - thanks! – user32172 Jun 11 '14 at 10:26
  • can you give me more details on which rasters you are trying to reproject? The problem with batch converting each tile seperately is that you will get a black NO DATA are around each and when you come to put them side to side it will look terrible. So your method of creating a VRT is the best route. If it does not work in QGIS download and install the GDAL Complete binary (if on windows) and open the command prompt and run the command from there – tjmgis Jun 11 '14 at 12:11
  • thank you for your suggestions - the rasters are just tiff files that came with tab and tfw files from ordnance survey. should I take the tiffs and combine in qgis as a vrt, then how do I convert the vrt projection so I can get it into tile mill and save it out? thanks so much for your help! I'm on a mac also - – user32172 Jun 11 '14 at 12:38
  • when I said save it out I meant export as mbtiles – user32172 Jun 11 '14 at 12:39
  • Thank you very much indeed! This has helped me enormously - I've managed to make an mbtiles file now from within tile mill. As the tiles do not show up in tile mill i'm assuming I need to use their custom css to do this? Best Wishes - – user32172 Jun 12 '14 at 10:35

Gdal2Tiles_parallel.py is the way to go free and fast. Check out geopackage python library. Tiles2gpkg_parallel.py to build geopackage sqlite

|improve this answer|||||

Try MapTiler (http://www.maptiler.com/).

Installer for Mac OS X is available after you fill the form http://www.maptiler.com/demo/ - and you can drag&drop GeoTIFFs directly (do not make VRTs - they only slow down the tile rendering process).

Here is a video tutorial: https://youtu.be/WQbX4dqlHgY

See an example zoomable tile map of whole UK made of Ordnance Survey OpenData: http://os.tileserver.com/.

(BTW you can get from us the MBTiles from us too)

|improve this answer|||||

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.