我想添加一个基本上是1个PNG且大小为800x800的磁贴源。 我创建了一个RMAbstractWebMapSource的子类,它实现了下面的方法,但是它没有工作,我得到一个日志错误' tile源...的tile边长不同于tilesource容器'。
@implementation CustomTileSource
- (NSURL *)URLForTile:(RMTile)tile
{
return [[NSURL alloc] initWithString:@"THE_URL_OF_MY_PNG"];
}
- (NSString *)uniqueTilecacheKey
{
return @"NLSMap";
}
- (NSString *)shortName
{
return @"Map";
}
- (NSString *)longDescription
{
return @"Test";
}
- (NSString *)shortAttribution
{
return @"Google maps";
}
- (NSString *)longAttribution
{
return @"Google maps";
}
- (float)minZoom
{
return 7.0;
}
- (float)maxZoom
{
return 11.0;
}
- (float)centerZoom
{
return 8.0;
}
- (BOOL)coversFullWorld
{
return NO;
}
- (CLLocationCoordinate2D)centerCoordinate
{
return CLLocationCoordinate2DMake(33.3, -118.7);
}
- (RMSphericalTrapezium)latitudeLongitudeBoundingBox
{
RMSphericalTrapezium bounds = {
.southWest = {
.longitude = -122.2,
.latitude = 30.29,
},
.northEast = {
.longitude = -115.2,
.latitude = 36.209999999999994,
},
};
return bounds;
}
- (NSUInteger)tileSideLength
{
return 800.f;
}
- (BOOL)opaque
{
return NO;
}
@end
你知道我该怎么办吗?
由于
答案 0 :(得分:1)
您正在做的事情需要根据标准XYZ或TMS / Web墨卡托图块方案提供地图图块。您不能只提供光栅图像并将其放在正确的位置。你有几个选择:
使用TileMill之类的内容将光栅图像渲染为地图图块。这是一个教程:https://www.mapbox.com/tilemill/docs/guides/reprojecting-geotiff/
查看此资源以了解原生iOS功能:https://github.com/mapbox/mapbox-ios-sdk/issues/361