GIS的学习(四十五)【转】Integration of the MBTiles format on Android
转载自
http://www.makina-corpus.org/blog/integration-mbtiles-format-android
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:
-Createalibrarywithavisualexamplefordebugging/funpurpose:loadonetileatatimegivenuserinputanddisplayingmetadata
- 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 (http://www.maptiler.org/google-maps-coordinates-tile-bounds-projection/) - 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:
- https://github.com/djcoin/MBTilesOsmdroidExample
- https://github.com/djcoin/MBTilesDroidSpitter
- https://github.com/djcoin/MBTilesDroidSpitterExampleSimple
My work was rewarded by a tweet from developmentseed / mapbox !
Thanksforthisandforyourawesomework,
Cheers!