Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 369
Ian Avatar asked Mar 27 '13 16:03

Ian


People also ask

How do I use OpenStreetMap on my iPhone?

The most basic way to use OpenStreetMap on your iOS device is to open www.openstreetmap.org in a Web browser such as Safari. The website is optimized for small screens such as those found on iPhone and iPod touch.

How do I export OpenStreetMap data?

Go to openstreetmap.org and zoom to the extent of your area of interest using the search box or the mouse. Click on Export Data in the sidebar on the left to bring up the Export pane. If you are satisfied with the visible extent, click Export. You will be prompted to save map.

Can OpenStreetMap be used offline?

Many software tools and services allow you to use OpenStreetMap data offline, without an Internet connection. You may want to use OpenStreetMap offline to: Access the map quickly if you live or work in an area with poor Internet service. Continue to use the map while underground in a basement or subway (metro)

How do I download open street maps offline?

Download Directly from OSM Simply go to www.openstreetmap.org and find the area you would like to download data for. Hit the “Export” button and you will see a screen with the Extent of the download appear. You can customize this download as either the “current extent” or manually select an area by bounding box.


2 Answers

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

like image 54
Ian Avatar answered Sep 21 '22 22:09

Ian


I would suggest trying the MapBox iOS SDK. It is actually forked from the Route-Me library and will allow you to accomplish everything on your list.

A key point to remember is that you have another step in between downloading the OSM data and storing it locally on the iOS device, that is, generating the map tiles and storing them in some sort of database.

Here is an example iOS app using the MapBox SDK that has both online and offline map sources and is a good place to start.

like image 44
StuGrey Avatar answered Sep 18 '22 22:09

StuGrey