我想知道是否有任何方法可以配置我们的 MapKit 地图,就像我们在 Google Maps API 中使用 MapTypeStyle 对象一样.
I wonder to know if there is any way to configure our MapKit maps like we do with the MapTypeStyle object in the Google Maps API.
如果我参考 Apple 文档,MKMapView 有一个 mapType 选项,它采用 MKMapType 常量 但没有样式参数,例如带有 MapTypeStyle 和 MapTypeStyler 对于快速地图定制来说非常强大.
If I refer to Apple doc's, MKMapView has a mapType option that takes MKMapType constant but no styles parameters like MapOptions with the MapTypeStyle and the MapTypeStyler wich is very powerfull for fast maps customizing.
所以我的问题是:有没有办法用 MapKit 框架实现类似的东西,如果没有,最好的框架/库是什么?我正在考虑 MapBox 和类似产品.
So my question is : Is there any way to achieve something similar with the MapKit framework, if not, what is the best framework/library to do this ? I'm thinking of MapBox and similar products.
我的朋友,你有几个选择.您可以使用这些框架之一
There are a few options for you my friend. You could use one of these frameworks
http://cloudmade.com/products/iphone-sdk
https://github.com/route-me/route-me
或者你可以只使用 mapbox.他们的 api 看起来很不错.或者,您提供自己的地图图块和覆盖地图套件.MKOverlayView 中的类似内容
Or you could just use mapbox. Their api looks pretty good. Alternatively you supply you own map tiles and overlay mapkit. Something like this in a 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
Also check this out if you want unsupported "terrain" mode http://openradar.appspot.com/9621632
实际上,我正在执行一个需要在地图上叠加图块的程序.这个例子很有帮助.您需要查看 MKOverlay 和 MKOverlayView.我正在做的项目涉及使用 gheat.我正在通过 NSURLConnection 访问磁贴并将它们存储在本地.我的实现的 gist.
I'm actually in the middle of a program that requires overlaying tiles over a map. This example has been very helpful. You'll want to look into MKOverlay and MKOverlayView. The project that I am doing involves using gheat. I am accessing the tiles through an NSURLConnection and storing them locally. A gist of my implementation.
这篇关于MapKit 中的 MapTypeStyle的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!