Search code examples
iosios6openstreetmap

How to store openstreetmap data locally on an iphone


I'm working on a project for college and I'm having great difficulty with part of it.

Simply put, I am looking to do the following 5 things:

  1. download the open street map data for my city

  2. store that data locally on the phone's harddrive.

  3. view that data in my iOS application as a map

  4. place markers on the map.

  5. draw paths along roads between those paths.

I have been working on this particular part of the project for a number of weeks and I'm getting nowhere with it. I haven't even been able to figure out how to store the map on the phone let alone view the map data. I've tried using the "Route-Me" library but cannot get it working (although it seems to be one of the best libraries for using openstreetmap data so I am looking to learn how to use it). I feel pretty goddamned defeated.

If anyone has accomplished any of the tasks I am trying to do could you please link me to tutorials/guides/videos that you have used.

I'm not looking for people to give me code or do the work for me, I want to learn how to do this, but if anyone can point me in the right direction of sites that I could learn off I would be very grateful.

Any advice or feedback would be much appreciated


Solution

  • Here's how I ended up solving the problem.

    Since Tilemill doesn't natively read .osm/.o5m/.pbf files I used Osmosis to convert a .osm file into .shp files.

    I then created a new project in Tilemill and added the particular .shp files I wanted as layers to the new project. It takes a little bit of tinkering to get the map to look like you want it to but it's very similar to css and pretty easy to pick up as you go.

    Once I had the map looking the way I wanted it I exported it as a .mbtiles file. This takes a long time to make and the files can be very large depending on how detailed the tiles are. I did one map of Ireland with zoom levels between 7-14 inclusive and I did one map of just Dublin city with zoom levels of 11-17 inclusive. Even though the map of just the city of Dublin had much less tiles, they were both ~200MB in size.

    I then found this tutorial online which explains how to store the .mbtiles file in you application and how to read it: http://martinsikora.com/creating-mbtiles-db-for-ios-mapbox-from-hi-res-map-image

    Here are a few other links that I found useful:

    http://www.kindle-maps.com/blog/using-tilemill-with-openstreetmap-data.html

    http://mapbox.com/developers/mbtiles/

    http://mapbox.com/mapbox-ios-sdk/api/

    http://mapbox.com/developers/api/#static_api

    http://support.mapbox.com/discussions

    I hope this is useful to someone