简体   繁体   English

如何添加自定义地图源到路由我?

[英]How to add custom map source to route-me?

'route-me' is an iPhone map engine and I want to add my own map source to it. 'route-me'是一个iPhone地图引擎,我想添加自己的地图源。 I've got all the map images on my server but I dont know how to add the map source? 我在我的服务器上有所有的地图图像,但我不知道如何添加地图源? Any one could help? 任何人都可以帮忙吗?

There seems to be two ways to do this: 似乎有两种方法可以做到这一点:

First, from the documentation: 首先,从文档:

If you have your own maps, you can use Mapnik as a framework and OpenStreetMap as your host. 如果您有自己的地图,可以使用Mapnik作为框架,使用OpenStreetMap作为主机。 You can then point to your map with the RMOpenStreetMapsSource class to specify the URL. 然后,您可以使用RMOpenStreetMapsSource类指向您的地图以指定URL。

Alternatively, 或者,

You can use an app for route-this called SimpleMap along with an extension called Map2sqlite. 您可以使用应用程序进行路由 - 这称为SimpleMap以及名为Map2sqlite的扩展。 This allows you to use a class caled RMDBTileSource and point to a sqlite DB file of your maps as the source. 这允许您使用类别为RMDBTileSource并指向您的地图的sqlite DB文件作为源。 I found this tidbit on a google groups article covering this topic. 我在一篇关于这个主题谷歌小组文章中找到了这个小窍门

google maps in route-me example: 在路线我的谷歌地图示例:

in RegionGmapTile.h 在RegionGmapTile.h中

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

@interface RegionGmapTile : RMAbstractMercatorWebSource 
{    
}

@end

in RegionGmapTile.m 在RegionGmapTile.m中

#import "RegionGmapTile.h"


@implementation RegionGmapTile

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


    NSString* url = [NSString stringWithFormat:@"http://mt0.google.com/vt/lyrs=m@127&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 in your route-me 在你的路线上,我是一个人

[[RMMapContents alloc] initForView:mvMap];

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

and google maps are shown without any key 和谷歌地图显示没有任何键

So, code below should get the job done? 那么,下面的代码应该完成工作?

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

Doing this results with error: 这样做会导致错误:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM