木曜日, 1月 20, 2011

iPhone load map offline tiles

From:iPhone load map offline tiles
downloaded the tiles from OpenStreetMap with the Global Map Download Tool.

map2sqlite tool 1.0 from route-me inside groups.google.com

About RMDBTileSource:
Assuming that the database is called "mymap.db" ,change the
tile source init code as follows:

- (void)viewDidLoad {
[super viewDidLoad];

...

RMDBMapSource* dbTilesource = [[[RMDBMapSource alloc]
initWithPath:@"mymap.db"] autorelease];
[[[RMMapContents alloc] initWithView:mapView
tilesource:dbTilesource] autorelease];

...

}


DB tile source for offline maps
:
storing the map tiles in an sqlite database and index the tiles using the RMTileKey() function. For best performance it makes sense to disable the internal route-me
database cache as all tiles are already stored in a database. I have
accomplished this using a routeme.plist file.

The code consists of a custom tile source (RMDBTileSource) and a new
tile image (RMDBTileImage). The RMDBTileSource.m file contains the
documentation of the database layout and the name/value pairs for the
meta data.

To get started , need to create an sqlite db with the two tables
(preferences and tiles) and store the tile images as blobs in the
tiles table and index them with the RMTileKey() function. Then add the
minimun and maximum zoom level as well as the tile size to the
preference table and you're done.

0 件のコメント: