/usr/lib/python2.7/dist-packages/ModestMaps/Stamen.py is in python-modestmaps 1.4.6-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | """
>>> p = BaseProvider('toner')
>>> p.getTileUrls(Coordinate(25322, 10507, 16)) #doctest: +ELLIPSIS
('http://tile.stamen.com/toner/16/10507/25322.png',)
>>> p = TonerProvider()
>>> p.getTileUrls(Coordinate(25322, 10507, 16)) #doctest: +ELLIPSIS
('http://tile.stamen.com/toner/16/10507/25322.png',)
>>> p = TerrainProvider()
>>> p.getTileUrls(Coordinate(25322, 10507, 16)) #doctest: +ELLIPSIS
('http://tile.stamen.com/terrain/16/10507/25322.png',)
>>> p = WatercolorProvider()
>>> p.getTileUrls(Coordinate(25322, 10507, 16)) #doctest: +ELLIPSIS
('http://tile.stamen.com/watercolor/16/10507/25322.png',)
"""
from math import pi
from Core import Coordinate
from Geo import MercatorProjection, deriveTransformation
from Providers import IMapProvider
import random, Tiles
class BaseProvider(IMapProvider):
def __init__(self, style):
# the spherical mercator world tile covers (-π, -π) to (π, π)
t = deriveTransformation(-pi, pi, 0, 0, pi, pi, 1, 0, -pi, -pi, 0, 1)
self.projection = MercatorProjection(0, t)
self.style = style
def tileWidth(self):
return 256
def tileHeight(self):
return 256
def getTileUrls(self, coordinate):
zoom, column, row = coordinate.zoom, coordinate.column, coordinate.row
return ('http://tile.stamen.com/%s/%d/%d/%d.png' % (self.style, zoom, column, row),)
class TonerProvider(BaseProvider):
def __init__(self):
BaseProvider.__init__(self, 'toner')
class TerrainProvider(BaseProvider):
def __init__(self):
BaseProvider.__init__(self, 'terrain')
class WatercolorProvider(BaseProvider):
def __init__(self):
BaseProvider.__init__(self, 'watercolor')
if __name__ == '__main__':
import doctest
doctest.testmod()
|