MapKit中的MapTypeStyle

ray*_*nco 5 google-maps map mapkit ios ios5

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

如果我引用Apple doc,MKMapView有一个mapType选项,它使MKMapType保持不变,但没有样式参数,如MapType,MapTypeStyleMapTypeStyler,对于快速地图自定义非常强大.

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

Ric*_*man 3

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

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();
    }
}
Run Code Online (Sandbox Code Playgroud)

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

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