Accueil / Blog / Métier / Archives / Integration of the MBTiles format on Android

Integration of the MBTiles format on Android

Par Simon Thépot — publié 11/04/2011

MapBox is a great GIS project with many great tools.
I was delighted when Makina Corpus allowed me to spend a few days to bring contributions back to the project.

I headed to integrate the Mapbox tile format on Android. Having a quick chat on #mapbox irc channel, revealed that no MBTiles Android component existed yet.
MBTiles embeds tiles in an SQLite database to improve performance, to share a unique file for offline maps, and to offer cross-platform capabilities as database handling is shared among all languages.   

I added support for MBTiles to Android in two steps:
- Create a library with a visual example for debugging/fun purpose : load one tile at a time given user input and displaying metadata
- Create/Submit a patch for Osmdroid (A great library that many GIS/Android projects depend on, equivalent of Google MapView but not bound to GoogleMaps) with a simple example showing a map built from the tile set.

Thus, the code should be pretty straightforward as it's actually making a simple query to get the matching tile.
Only a few points stand by:

  • You need to add a table with simple information to make your SQLite database Android compatible (not much doc about it)
  • The tileset is stored using the Google Specification ( - Y-axis is inverted, a one-liner solves this
  • I wrote a Metadata parser by spec that validates the metadata information contained in the database

For more in-depth information, have a look to my Github account:


My work was rewarded by a tweet from developmentseed / mapbox !
Thanks for this and for your awesome work,
Cheers !