Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Toner map provider for the Mapbox SDK.
//
// SDTonerMapSource.h
// Toner Maps
//
#import <MapBox.h>
#import <UIKit/UIKit.h>
@interface SDTonerMapSource : RMAbstractWebMapSource
@end
//
// 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
You can’t perform that action at this time.