2

Is there some way to disable the Google layers when using a MKMapView? I intend to supply all the tiles myself.

The way I see it at the moment I have to pick which type of Google data my map uses but no way to turn it off altogether.

Update Just to reiterate. I don't want my app to contact Google at all. No map imagery should be received, therefore I'd like to think I'm not at the whim of their license agreement.

Craig
  • 8,093
  • 8
  • 42
  • 74

5 Answers5

1

As of iOS 7, this is now very easy to do. This code (which you can place in your viewDidLoad: method) will look for tiles in the map-tiles/ folder in the app bundle:

NSString *baseURL = [[[NSBundle mainBundle] bundleURL] absoluteString];
NSString *template = [baseURL stringByAppendingString:@"map-tiles/{z}/{x}/{y}.png"];
MKTileOverlay *overlay = [[MKTileOverlay alloc] initWithURLTemplate:template];
overlay.canReplaceMapContent = YES;
[self.mapView addOverlay:overlay level:MKOverlayLevelAboveLabels];

This page has details on how to download OpenStreetMap tiles for offline usage.

Stewart Macdonald
  • 2,062
  • 24
  • 27
0

I've answered this question on another stackoverflow question.

Though to be more precise, it doesn't prevent the Google Calls (they are most likely still made because the solution involves changing the drawing behavior) but you will not see the tiles.

Hope it'll help you.

Community
  • 1
  • 1
apouche
  • 9,703
  • 6
  • 40
  • 45
0

This is part of the Google API License Agreement.

You can not, ever, hide their Logo, labels or images.

Even if you manage to do this using private classes I assure you your app will be rejected.

The only thing you can do is add overlays and pins.

Good luck!

Zebs
  • 5,378
  • 2
  • 35
  • 49
  • It's not about hiding their logo, it's about not using their data in any way. I want the MKMapView, it does all the stuff I want, I don't want Google Map, Google Terrain, Google Satellite or any hybrid of the above. Since it is possible load overlays that obscure their map data, and my map data will fill the entire screen, I can't see it being part of the LA that I can't opt out of the agreement and choose to not use their data. What would be the point of insisting on having their data downloaded and then hidden anyway? – Craig Feb 13 '11 at 19:46
  • 1
    I dont think I understand what you want to do then; but if you are not using anything the MKMapVIew has to offer except adding overlays, wouldn't you be better off creating your own view? Hopefully you can explain what you need better; so I can advise you the best I can. – Zebs Feb 17 '11 at 06:11
  • 1
    MKMapView has a lot more to offer already baked in. Zooming, scaling and caching of tiles. User location and tracking. The only thing I don't want is the Google tiles. I have my own tiles but I tried creating my own view and it doesn't do anything nearly as well as the official Apple one. – Craig Feb 27 '11 at 04:15
  • My MKMapView only shows the map itself not any Google logos or anything, so if I add my overlays (like Craig want to), it would not be visible that it might be a Google thing... – Pangolin Jun 10 '11 at 20:00
0

I think Craig's question is more "is there an MKMapView-like control that I can use to display my own maps and map tiles, which does all the things MKMapView does (handles zooming from "my house" to "entire planet", animates scrolling to a specific lat/lon coordinate, etc.), but uses my content instead?"

...and the answer is no, or at least that Apple doesn't provide "map" controls other than MKMapView, and there's no way to use MKMapView without using Google Maps. You'd have to start with a subclass of UIScrollView and write your own methods, or look into third-party SDKs for displaying maps.

Scott Forbes
  • 7,397
  • 1
  • 26
  • 39
  • Personally I'd rather use the actual MKMapView control. It can already use my own data very well. The trouble is it *always* uses Google data, I just want to turn that bit off. – Craig Feb 27 '11 at 04:07
  • Craig, kudos for trying to do this. I too have lots of map data I want to leverage without the Google restrictions. The MapKit features are great and it's a shame we have to link it to any specific map. Keep up the good fight. – VTPete Oct 31 '11 at 15:17
0

If you're objection to using the MKMapView class is that it's based on Google data then I'd recommend checking out CloudMade as an alternative map provider. They have their own SDK and UI controls which are extremely easy to use.

mmccomb
  • 13,516
  • 5
  • 39
  • 46
  • My objection is that MKMapView uses *external* data, I want it to stay offline and use only my data which is built in. If I loaded CloudMade data onto my MKMapView it'd still be loading the Google data beneath. – Craig Feb 27 '11 at 04:14