我使用的方法是:
- (void)loadTileAtPath:(MKTileOverlayPath)path result:(void (^)(NSData *data, NSError *error))result
MKTileOverlayPath给了我一个x,y和z。我试着走这条路,并对这个区域的Apple Maps版本进行快照,这样我就可以对图像应用滤镜。
我使用的是MKMapSnapshotter,但是不知道应该给它什么值来绘制这个区域的苹果地图表示。
MKMapSnapshotOptions *options = [[MKMapSnapshotOptions alloc] init];
options.scale = [[UIScreen mainScreen] scale];
options.showsBuildings = NO;
options.showsPointsOfInterest = NO;
options.mapType = MKMapTypeStandard;
MKMapSnapshotter *snapshotter = [[MKMapSnapshotter alloc] initWithOptions:options];
[snapshotter startWithCompletionHandler:^(MKMapSnapshot *snapshot, NSError *error) {
if (error || !snapshot) {
NSLog(@"snapshotter error: %@", error);
return;
}
}];或者可能有另一种已知的方法从这个地区获取地图图像。
发布于 2014-06-18 01:53:42
x/y/z和坐标之间的转换如下所示:
https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames
使用它来确定(间接地)和MKMapRect来捕获,设置您的地图视图,然后使用MKMapSnapshotter来抓取要处理的图像。
https://stackoverflow.com/questions/24209133
复制相似问题