Lets face it, iOS Maps uses up too much of your data package. If you don’t believe me, try this:

  • Check your data usage in Settings -> Usage -> Cellular Usage
  • Reset it, or take a note of the value
  • Go to Maps, and search for a city youve never viewed before in map
  • Zoom in a few times, and pan around for 30 seconds
  • Check your data usage again
  • That’s right, 2-3 MB for that small privilege!

The problem isnt just the amount of data itself, but the fact that it gets deleted soon after you download it! Why? The maps app on the iPhone has a very small, ~22MB cache. So even if you use your home WiFi to pre-download all you need for your week away to Paris, it’s likely you can only access a tiny bit of your previously viewed maps before you need to download again. And for that you need cell access, to drain more data from your monthly allowance (or force you to sell your house to pay for roaming fees), and patience.

The Solution

1. First you need to jailbreak. Luckily this is possible on all devices, including the iPhone 4S (at time of writing).

2. Now there are a number of existing solutions you can try. However, I found (at time of writing), some are difficult to understand, and none of them work with Google Maps or iOS5. In case this changes, and because it’s likely my solution will one day fail, I’ll list some of them here:

We are going to modify the cache database to stop it deleting old map tiles, thereby allowing it to increase in size indefinitely. Don’t worry, its not as hard as it sounds.

  1. Find and Copy the /var/mobile/Library/Caches/Maps/MapTiles/MapTiles.sqlitedb file to your Mac / PC (you can do this using a file copying program such as iExplorer [http://www.macroplant.com/iexplorer/], or using ssh).
  2. Open it with an SqlLite database reader. I used MesaSQLite [http://www.desertsandsoftware.com/?realmesa_home] for Mac.
  3. Add the following trigger to the database by executing the following query:- “CREATE TRIGGER prevent_delete BEFORE DELETE ON image  BEGIN SELECT raise(IGNORE); END”
  4. Quit Maps on your iPhone
  5. Copy the MapTiles.sqlitedb back to the same location on your phone, replacing the original
  6. Ensure the file has the correct permissions, owner: mobile, 775. You can use terminal, ssh, or even iFile (an app available in Cydia) to do this.
  7. Restart your iPhone.

Now try it out! It’s best if your on a wifi network, but 3G will do. Pan and zoom around the map all you like, and after a few minutes check the size of the MapTiles.sqlitedb file. It should grow beyond 22Mb, and when you go back to previously visited places, it will load instantly, and without need for network.

PLEASE NOTE:

  • You may have to be connected to the internet for a second or two when you first load the maps app after a phone restart in order for them to work offline. After that you should be able to close and open it and view all tiles without being online and not using any data.
  • GPS does NOT appear to work at all without a network connection in the Maps app or any apps that use Google Maps API in iOS, even if you have perfect line of sight to the sky and the area you’re in is definitely cached. I have no idea why this is. Please correct me if I’m wrong.
  • Your maps will eventually become outdated if you live in a fast changing country like China. You may want to delete the cache file at this point and repeat the process above to make sure it’s not limited to 22MB
  • Your Maps may eventually have problems, after all this is a hack, though mine hasn’t yet with my cache file at 150mb.
  • If your very geeky like me, you can discover the location of the MapTiles database for all the applications other than the official Map app, that use the maps api. One of my favourite such apps is called cartographer. By creating a symbolic link from your modified MapTiles database to the common location for the other apps, you can use the same cache for all your maps related apps!
  • One day the tool iMapsManager [http://imapsmanager.ru/mapConverter/mapConverter_eng.htm] will hopefully be updated to allow you to create maps using the google map downloaded toll and load them onto your iPhone.
  1. Hi,
    Was excited to use your tutorial today to get my maps working offline.

    the path /private/var/Library/Caches/Maps/MapTiles/MapTiles.sqlitedb does not exist on my iphone (iPhone 4, iOS v5.0.1)

    Do you know the proper location of the MapTiles.sqlitedb file for iOS 5.0.1

    Thanks

  2. Does not seem to work here. File maxes out at 22MB despite change. Ipod Touch 4thG 5.0.1. :(

  3. Hey Nick,

    Did it maybe take a ton of looking around in the Maps App to suddenly see the MapTiles.sqlitedb change in size? Also, is this tweak still hitching you up and working well?

    I used to *LOVE* MapsEnhancer, but ever since broke with the switch to iOS5 I’ve been looking for a replacement.

    Thanks for the post saying this stuff! :-)

    • Phil,

      If your cache is already at around 20MB, which it should be, and you have a high res iphone 4, it should take no time at all. I racked up another 14MB of Map data (taking me to 34MB database) in just a few minutes.

      I’ve had no issues with this hack, except when my maps grew beyond 800mb it would start crashing. Since I’ve finished travelling and am in a new country now, I’ve reset it and started again. Still very useful!

      • DOH! I’m an idiot. Even though I read over the part about using the correct directory, I guess I was too eager to try it. :-)

        Works for me!!!!

        When things started crashing, is it safe to just remover the MapTiles.sqlitedb cache file and fire Maps up again?

        Have some fun/safe travels!

        Phil

  4. thanks for the tip to change the SQL db! That is great. I wonder if someone could make a CYDIA tweak to make a GUI for this. It is super helpful as it is, but it would also super helpful to make it easy to reset the cache if needed – - just so it doesn’t grow out of control or so you don’t have year old maps on your phone which don’t get updated.

Leave a Reply...