Created
January 23, 2014 04:01
-
-
Save mojodna/8572615 to your computer and use it in GitHub Desktop.
Watercolor map provider for the Mapbox SDK.
This file contains 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
// | |
// SDWatercolorMapSource.h | |
// Watercolor Maps | |
// | |
#import <MapBox.h> | |
#import <UIKit/UIKit.h> | |
@interface SDWatercolorMapSource : RMAbstractWebMapSource | |
@end |
This file contains 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
// | |
// SDWatercolorMapSource.m | |
// Watercolor Maps | |
// | |
#import "SDWatercolorMapSource.h" | |
@implementation SDWatercolorMapSource | |
- (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/watercolor/%d/%d/%d.jpg", tile.zoom, tile.x, tile.y]]; | |
} | |
- (NSString *)uniqueTilecacheKey | |
{ | |
return @"StamenWatercolor"; | |
} | |
- (NSString *)shortName | |
{ | |
return @"Watercolor"; | |
} | |
- (NSString *)longDescription | |
{ | |
return @"Reminiscent of hand drawn maps, our watercolor maps apply raster effect area washes and organic edges over a paper texture to add warm pop to any map. Watercolor was inspired by the Bicycle Portraits project. Thanks to Cassidy Curtis for his early advice."; | |
} | |
- (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