2009-12-10 117 views

回答

4

似乎有兩種方法可以做到這一點:

首先,從文檔:

如果你有自己的地圖,你可以使用Mapnik作爲一個框架和OpenStreetMap爲您的主機。然後,您可以使用RMOpenStreetMapsSource類指向您的地圖以指定URL。

另外,

你可以使用一個應用程序路徑,這家名爲SimpleMap一個名爲Map2sqlite擴展一起。這使您可以使用一個類別RMDBTileSource並指向您的地圖的sqlite數據庫文件作爲源。我發現這個珍聞google groups article covering this topic.

2

所以,下面的代碼應該完成工作?

id <RMTileSource> tileSource; 
NSURL *mapURL = [NSURL URLWithString:@"myOSM_URL"]; 
tileSource = [[[RMOpenStreetMapSource alloc] initWithURL:mapURL] autorelease]; 

這樣做的結果,錯誤:

-[RMOpenStreetMapSource initWithURL:]: unrecognized selector sent to instance 0x5b0c310 
4

谷歌地圖中的路線,我例如:

在RegionGmapTile.h在RegionGmapTile.m

#import <Foundation/Foundation.h> 
#import "RMAbstractMercatorWebSource.h" 

@interface RegionGmapTile : RMAbstractMercatorWebSource 
{  
} 

@end 

#import "RegionGmapTile.h" 


@implementation RegionGmapTile 

-(NSString*) tileURL: (RMTile) tile 
{ 


    NSString* url = [NSString stringWithFormat:@"http://mt0.google.com/vt/[email protected]&x=%d&y=%d&z=%d",tile.x, tile.y,tile.zoom]; 
    return url; 
} 

-(NSString*) uniqueTilecacheKey 
{ 
    return @"NLSHistoricMap"; 
} 

-(NSString *)shortName 
{ 
    return @"NLS Historic Map"; 
} 
-(NSString *)longDescription 
{ 
    return @"NLS Historic Map Test"; 
} 
-(NSString *)shortAttribution 
{ 
    return @"Google maps"; 
} 
-(NSString *)longAttribution 
{ 
    return @"Google maps"; 
} 


@end 

somwehere在你的路線,我

[[RMMapContents alloc] initForView:mvMap]; 

mvMap.contents.tileSource = [[RegionGmapTile alloc] init]; 

和谷歌地圖顯示,沒有任何按鍵

相關問題