Reputation: 40437
I'd like to write some drawing rules inside drawMapRect:zoomScale:inContext:
based on the standard [0-20] zoom levels that mapping platforms like Google Maps use, but I can't seem to find a formula to convert MKZoomScale to that scale. Any takers?
Upvotes: 2
Views: 663
Reputation: 76
Try this category on MKMapView
@interface MKMapView (Additions)
- (double)zoomLevel;
@end
@implementation MKMapView (Additions)
- (double)zoomLevel {
double totalTilesAtMaxZoom = MKMapSizeWorld.width / 256.0;
NSInteger zoomLevelAtMaxZoom = log2(totalTilesAtMaxZoom);
return MAX(0, zoomLevelAtMaxZoom + log2f(self.zoomScale));
}
@end
Upvotes: 6