/OSMMapKit

A library for MapBox's MBTiles data (some problem with built system, not ready for prime time yet)

Primary LanguageObjective-C

#OSMMapKit

OSMMapKit (MapKit for OpenStreetMap) is a tiny set of classes (just with a big name, lol) which takes tiles formatted in MBTiles SQLite3 database from MapBox and display it on iOS 7 MapKit. In other words, it presents offline map within a pre-defined region on iOS devices.

##Usage

###With MBTiles

NSURL *tilesURL = [[NSBundle mainBundle] URLForResource:@"SanFrancisco" withExtension:@"mbtiles"];

MBTilesDB *tilesDB = [[MBTilesDB alloc] initWithDBURL:tilesURL];

self.mapView = [[OSMMapView alloc] initWithFrame:self.view.bounds andMBTiles:tilesDB];

[self.view addSubview:self.mapView];

###Without MBTiles When used without MBTiles, iOS 7 MapKit already provides the necessary MKTileOverlay to for external map such as Stamen's. The kit only provides additional facilities such as zoom level and map constraint.

##Installation Drag the project into your directory. In your Build Phases add libOSMMapKit.a to "Link binary with libraries".

Required external dependnecy

FMDB and Apple's own MapKit

##How to obtain the data source OpenStreetMap is a mapping project collecting geographical data from collaborators worldwide (For more information, please refer to OpenStreetMap Wiki). The data are available as XML files from OpenStreetMap (OSM data download).

To make MBTiles, a SQLite3 database with a specific schema storing the tile images which OSMMapKit uses, import the data into PostGis with either osm2pqsql or Imposm. The desktop tile-making tool TileMill from MapBox can then generate the map tile images from the PostGis database according to Carto stylesheet (for starter, try OSM Bright) and package them into MBTiles.

Tutorial is available from MapBox. (OSM Bright Mac OS X quickstart)

##Known problem (to be fixed) Tiles around overlay seems to disappear when zoom-in.

##License

###MIT

Code heavily influenced by sources from MapBox iOS SDK and MBXMapKit, as well as various sources, notably the discussion thread on ZoomLevel from Troy Brant and input on constraining the map region from Anna Karenina.

##Disclaimer The project is not in any way associated with MapBox.