Offline maps with the Mobile SDK
Working offline is kind of a big deal. There are many mobile apps that always need to work not just when a device is online. In previous posts we covered offline routing features. Today I’d like to tell you all about offline basemaps for the CartoDB Mobile SDK. It should come as no surprise that the most common reason developers have sought out and use the SDK is that our basemaps work offline!
The Mobile SDK provides several solutions for offline basemaps:
Country-wide packages: The CartoDB SDK provides OpenStreetMap-based vector map packages for every country in the world. For bigger countries we have additional separate states. Countries are also organized into continents and subcontinents. All our offline packages are pre-packaged on the server side which means a very fast download rate via CDN. See our long list of available country packages. As an alternative we provide Here.com maps for a similar country-wide package. Here.com maps have great address geocoding and routing data. Additionally in some instances you may only need one particular country or state to be available. Some app providers have created an interactive country selection menu (e.g. [Offline Maps app for Android].
Maps for limited regions: This is useful for when you do not need to visualize the whole country. For example Lonely Planet uses this approach in their Guides app for Android which is powered by CartoDB. In the Guides app we use pre-packaged maps which offers a very fast download speed especially compared to the tile-by-tile download approach.
Your own map data packages: The Mobile SDK supports Mbtiles as a map package format (via MBTilesTileDataSource) and you can find several tools to create these files (see our list here). For more compact vector packages there are no ready-made open source tools that we know of but we can provide you with custom scripts. You’ll need to have a vector tile server with your data and a script that scrapes all tiles for your area of interest and saves them to an mbtiles script. Our tools for this supports data encryption which is useful when you want to avoid copying and misuse of your valuable vector data assets. For more advanced cases you can also combine online and offline data sources. With your own map packages you can bundle map data with an app which makes installation bigger but you won't need the additional download.
Happy offline mobile mapping!