Created
February 21, 2014 02:49
-
-
Save mojodna/9127887 to your computer and use it in GitHub Desktop.
Toner map provider for the Mapbox SDK.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// SDTonerMapSource.h | |
// Toner Maps | |
// | |
#import <MapBox.h> | |
#import <UIKit/UIKit.h> | |
@interface SDTonerMapSource : RMAbstractWebMapSource | |
@end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// SDTonerMapSource.m | |
// Toner Maps | |
// | |
#import "SDTonerMapSource.h" | |
@implementation SDTonerMapSource | |
- (id)init | |
{ | |
if (!(self = [super init])) { | |
return nil; | |
} | |
self.minZoom = 1; | |
self.maxZoom = 18; | |
return self; | |
} | |
#pragma mark - RMAbstractWebMapSource overrides | |
- (NSURL *)URLForTile:(RMTile)tile | |
{ | |
NSAssert4(((tile.zoom >= self.minZoom) && (tile.zoom <= self.maxZoom)), | |
@"%@ tried to retrieve tile with zoomLevel %d, outside source's defined range %f to %f", | |
self, tile.zoom, self.minZoom, self.maxZoom); | |
return [NSURL URLWithString:[NSString stringWithFormat:@"http://tile.stamen.com/toner/%d/%d/%d.png", tile.zoom, tile.x, tile.y]]; | |
} | |
- (NSString *)uniqueTilecacheKey | |
{ | |
return @"StamenToner"; | |
} | |
- (NSString *)shortName | |
{ | |
return @"Toner"; | |
} | |
- (NSString *)longDescription | |
{ | |
return @"These high-contrast B+W (black and white) maps are featured in our Dotspotting project. They are perfect for data mashups and exploring river meanders and coastal zones."; | |
} | |
- (NSString *)shortAttribution | |
{ | |
return @"<style>body { text-align: left; font-size: 12px; }</style>Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under CC BY SA."; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment