MapKit中的MapTypeStyle [英] MapTypeStyle in MapKit

查看:148
本文介绍了MapKit中的MapTypeStyle的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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



如果我提到苹果doc的MKMapView有一个mapType选项,它使用 MKMapType常量,但没有样式参数,如MapOptions, MapTypeStyle MapTypeStyler 是非常强大的快速地图定制。



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

解决方案

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



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



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



或者你可以使用mapbox。他们的api看起来不错。
或者您可以为您提供自己的地图图块和重叠地图套件。 (MKMapRect)mapRect zoomScale:(MKZoomScale)zoomScale inContext :((CGContextRef))(*)* )context {

NSURL * fileURL = [(HeatMap *)self.overlay localUrlForStyle:@alienwithMapRect:mapRect andZoomScale:zoomScale];
NSData * imageData = [NSData dataWithContentsOfURL:fileURL];
if(imageData!= nil){
UIImage * img = [UIImage imageNamed:@aTileX.png];
//在当前UI上下文执行图像渲染
UIGraphicsPushContext(context);
[img drawInRect:[self rectForMapRect:mapRect] blendMode:kCGBlendModeNormal alpha:1.0];
UIGraphicsPopContext();
}
}

还要检查这个是否需要不支持的terrain模式
http://openradar.appspot.com/9621632



我实际上处于一个需要在地图上覆盖瓷砖的程序的中间。 此示例非常有用。你会想看看MKOverlay和MKOverlayView。我正在进行的项目涉及使用 gheat 。我正在通过NSURLConnection访问磁贴,并将其存储在本地。我实施的要点


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.

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.

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

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();
    }
}

Also check this out if you want unsupported "terrain" mode http://openradar.appspot.com/9621632

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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆