MapKit 中的 MapTypeStyle

2023-12-14

我想知道是否有任何方法可以配置我们的 MapKit 地图,就像我们在 Google 地图 API 中使用 MapTypeStyle 对象一样。

如果我参考Apple文档,MKMapView有一个mapType选项,它需要MKMapType常量但没有像 MapOptions 这样的样式参数地图类型样式地图类型样式器这对于快速定制地图非常强大。

所以我的问题是:有没有办法实现与 MapKit 框架类似的东西,如果没有,最好的框架/库是什么?我在想MapBox和类似产品。


我的朋友,有几个选择供你选择。您可以使用这些框架之一

http://cloudmade.com/products/iphone-sdk

https://github.com/route-me/route-me

或者你可以只使用mapbox。他们的 api 看起来相当不错。 或者,您可以提供自己的地图图块和叠加地图套件。 MKOverlayView 中类似的东西

- (void)drawMapRect:(MKMapRect)mapRect zoomScale:(MKZoomScale)zoomScale inContext:(CGContextRef)context {

NSURL* fileURL = [(HeatMap*)self.overlay localUrlForStyle:@"alien" withMapRect:mapRect andZoomScale:zoomScale];
NSData *imageData = [NSData dataWithContentsOfURL:fileURL ];
if (imageData != nil) {
    UIImage* img = [UIImage imageNamed:@"aTileX.png"];
    // Perform the image render on the current UI context
    UIGraphicsPushContext(context);
    [img drawInRect:[self rectForMapRect:mapRect] blendMode:kCGBlendModeNormal alpha:1.0];
    UIGraphicsPopContext();
    }
}

如果您想要不受支持的“地形”模式,也请检查一下http://openradar.appspot.com/9621632

我实际上正在执行一个需要在地图上叠加图块的程序。这个例子非常有帮助。您需要研究 MKOverlay 和 MKOverlayView。我正在做的项目涉及使用gheat。我通过 NSURLConnection 访问图块并将其存储在本地。 Agist我的实施。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

MapKit 中的 MapTypeStyle 的相关文章