GDAL 2.0 to Support MBTiles

Blog

Estimated
2 min read

GDAL, the library underlying nearly all major open source geospatial projects (it’s used in apps like QGIS, ArcGIS, and Google Earth), has gained MBTiles read support. This adds a big name to the list of MBTiles supporting implementations because GDAL shines at data exploration and format conversion. It means MBTiles will be easier to use from any application that uses GDAL, and the list is impressively long. Once GDAL 2.0 is released, this potentially means you’ll be able to open MBTiles files directly in applications like QGIS. But already with GDAL trunk you can do fancy things like:

Query remote mbtiles for their metadata:

$ gdalinfo /vsicurl/http://a.tiles.mapbox.com/v3/mapbox.geography-class.mbtiles | grep description

One of the example maps that comes with [TileMill](http://mapbox.com/tilemill/) - a bright and colorful world map that blends retro and high-tech with its folded paper texture and interactive flag tooltips.

Or turn Konstantin’s gorgeous Iceland Map into a single 1.5 GB image suitable for high resolution printing:

$ wget [http://a.tiles.mapbox.com/v3/kkaefer.iceland.mbtiles](http://a.tiles.mapbox.com/v3/kkaefer.iceland.mbtiles)
$ gdal_translate kkaefer.iceland.mbtiles iceland.tiff
Input file size is 16384, 16384
0...10...20...30...40...50...60...70...80...90...100 - done.
$ ls -lh *tiff
-rw-r--r--  1 dane  staff   1.0G Jan  8 18:12 iceland.tiff

Or even remotely lookup a temperature anomaly value for a given coordinate in the World Bank Climate Scenario A2 Map:

$ gdallocationinfo /vsicurl/http://a.tiles.mapbox.com/v3/worldbank-climate.wbc-temp-anom-a2.mbtiles -wgs84 2 49 -b 1
Report:
  Location: (5279P,11525L)
  Band 1:
    11549{"control_vals":"-1.90,-1.08,1.09,3.90,8.48,12.43,15.96,15.42,11.18,6.04,1.80,-1.11,-1.90","id":11549,"p10_vals":"-1.58,-0.09,1.85,4.70,8.60,13.81,17.82,17.62,13.58,6.83,2.19,-0.38,-1.58","p10_yr_anom":3,"p50_vals":"1.17,1.85,3.71,6.75,11.32,16.57,21.35,21.34,16.14,10.01,5.37,1.88,1.17","p90_vals":"4.28,5.05,6.68,9.34,13.67,19.06,24.62,25.00,19.31,12.18,7.59,5.43,4.28","p90_yr_anom":4.7}
    Value: 255

More details about GDAL’s MBTiles support are on its docs page.

This is brilliant. I noticed the addition two weeks ago in #gdal IRC and quickly realized it was Even Rouault (profile/blog) at work. He’s a true force of nature — an amazingly smart and focused developer and one of the lead maintainers of the GDAL project. This is a very key position now that the lead and founder of the project Frank Warmerdam has been hired by Google and his commits have understandably declined. In addition to helping maintain a huge project, Even seems insanely deft at adding new drivers overnight to the delight of programmers the world over.

So, thanks for this awesome feature Even, and thanks Frank and others for creating such a powerful library for developers like Even to build on. We notice :)

What we're doing.

Latest