gpt4 book ai didi

ios - 将 MKTileOverlayPath 转换为 MKMapRect?

转载 作者:行者123 更新时间:2023-12-01 16:41:14 25 4
gpt4 key购买 nike

我正在使用以下方法:
- (void)loadTileAtPath:(MKTileOverlayPath)path
result:(void (^)(NSData *data, NSError *error))result

MKTileOverlayPath 给了我一个 x、y 和 z。我正在尝试沿此路径拍摄该区域的 Apple Maps 版本的快照,以便我可以对图像应用过滤器。

我正在使用 MKMapSnapshotter,但不知道给它什么值来绘制该区域的苹果 map 表示。

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;
}
}];

或者也许还有另一种从该区域获取 map 图像的已知方法。

最佳答案

x/y/z 之间的转换坐标在这里完成:

https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames

使用它来确定(间接)和MKMapRect捕获,设置您的 map View ,然后使用 MKMapSnapshotter抓取要处理的图像。

关于ios - 将 MKTileOverlayPath 转换为 MKMapRect?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24209133/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com