/usr/share/pyshared/ModestMaps/CloudMade.py is in python-modestmaps 1.3.1-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 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | """
>>> p = OriginalProvider('example')
>>> p.getTileUrls(Coordinate(25322, 10507, 16)) #doctest: +ELLIPSIS
('http://tile.cloudmade.com/example/1/256/16/10507/25322.png',)
>>> p = FineLineProvider('example')
>>> p.getTileUrls(Coordinate(25322, 10507, 16)) #doctest: +ELLIPSIS
('http://tile.cloudmade.com/example/2/256/16/10507/25322.png',)
>>> p = TouristProvider('example')
>>> p.getTileUrls(Coordinate(25322, 10507, 16)) #doctest: +ELLIPSIS
('http://tile.cloudmade.com/example/7/256/16/10507/25322.png',)
>>> p = FreshProvider('example')
>>> p.getTileUrls(Coordinate(25322, 10507, 16)) #doctest: +ELLIPSIS
('http://tile.cloudmade.com/example/997/256/16/10507/25322.png',)
>>> p = PaleDawnProvider('example')
>>> p.getTileUrls(Coordinate(25322, 10507, 16)) #doctest: +ELLIPSIS
('http://tile.cloudmade.com/example/998/256/16/10507/25322.png',)
>>> p = MidnightCommanderProvider('example')
>>> p.getTileUrls(Coordinate(25322, 10507, 16)) #doctest: +ELLIPSIS
('http://tile.cloudmade.com/example/999/256/16/10507/25322.png',)
>>> p = BaseProvider('example', 510)
>>> p.getTileUrls(Coordinate(25322, 10507, 16)) #doctest: +ELLIPSIS
('http://tile.cloudmade.com/example/510/256/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, apikey, style=None):
# 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.key = apikey
if style:
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.cloudmade.com/%s/%d/256/%d/%d/%d.png' % (self.key, self.style, zoom, column, row),)
class OriginalProvider(BaseProvider):
style = 1
class FineLineProvider(BaseProvider):
style = 2
class TouristProvider(BaseProvider):
style = 7
class FreshProvider(BaseProvider):
style = 997
class PaleDawnProvider(BaseProvider):
style = 998
class MidnightCommanderProvider(BaseProvider):
style = 999
if __name__ == '__main__':
import doctest
doctest.testmod()
|