Skip to content

Instantly share code, notes, and snippets.

@mojodna
Created January 23, 2014 04:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mojodna/8572615 to your computer and use it in GitHub Desktop.
Save mojodna/8572615 to your computer and use it in GitHub Desktop.
Watercolor map provider for the Mapbox SDK.
//
// SDWatercolorMapSource.h
// Watercolor Maps
//
#import <MapBox.h>
#import <UIKit/UIKit.h>
@interface SDWatercolorMapSource : RMAbstractWebMapSource
@end
//
// 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