Is there a way by which I can directly use mbtiles database with MKTileOverlay without using a third party framework like MapBox or any other?
Right now, I have the tiles stored in a folder structure and the code I am using is below:
NSString *tileDirectory = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"Tiles"];
NSString *tileDirectoryURL = [NSURL fileURLWithPath:tileDirectory isDirectory:YES];
NSString *tileURL = [NSString stringWithFormat:@"%@Z{z}/{y}_{x}.png", tileDirectoryURL];
tileOverlay = [[MKTileOverlay alloc] initWithURLTemplate:tileURL];
[tileOverlay setGeometryFlipped:YES];
[mainMapView addOverlay:tileOverlay];
But now I want to have a tiles.mbtiles sqlite database instead of the files in folders.
Please suggest me how can I do this. How do I initialize the MKTileOverlay object if I choose to use sqlite database. How will I put {x},{y},{z}.
I went through the documentation of MKTileOverlay and found that :
- (void)loadTileAtPath:(MKTileOverlayPath)path result:(void (^)(NSData *tileData, NSError *error))result
can be used but I am not able to understand how can I use it? If any one can please give ma a short example then it would be very helpful.