/QSMapKit

A framework for loading .mbtiles file on your map view for iOS

Primary LanguageObjective-CMIT LicenseMIT

QSMapKit

QSMapkit is a set of classes which takes tiles formatted in MBTiles SQLite3 database to presents offline map within a pre-defined region on iOS devices.

It work with Apple Map.

To make QSMapKit to work its need a combination code base on OSMMapKit and FMDB

OSMMapKit by t2wu

https://github.com/t2wu/OSMMapKit

FMDB by cccus

https://github.com/ccgus/fmdb

How to use

It work with subclass MKMapView too

Load MBTiles

NSURL *urlBundle = [[NSBundle mainBundle] URLForResource:@"Maps" withExtension:@"bundle"];
NSBundle *resouceBundle = [NSBundle bundleWithURL:urlBundle];
NSURL *baseTile = [resouceBundle URLForResource:@"BaseMap" withExtension:@"mbtiles"];

MBTilesDB *db = [[MBTilesDB alloc] initWithDBURL:baseTile];

MBTilesOverlay *overlay = [[MBTilesOverlay alloc] initWithMBTilesDB:db];
overlay.tileTitle = @"BaseMap";
overlay.geometryFlipped = YES;
overlay.canReplaceMapContent = NO;

[self.mapView addOverlay:overlay level:MKOverlayLevelAboveLabels];

Base code and Credit

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.