root/trunk/py/ModestMaps/BlueMarble.py

Revision 479, 0.9 kB (checked in by migurski, 10 months ago)

Added Blue Marble map provider

Line 
1 """
2 >>> p = Provider()
3 >>> p.getTileUrls(Coordinate(10, 13, 7))
4 ('http://s3.amazonaws.com/com.modestmaps.bluemarble/7-r10-c13.jpg',)
5 >>> p.getTileUrls(Coordinate(13, 10, 7))
6 ('http://s3.amazonaws.com/com.modestmaps.bluemarble/7-r13-c10.jpg',)
7 """
8
9 from Core import Coordinate
10 from Geo import MercatorProjection, Transformation
11 from Providers import IMapProvider
12
13 import Tiles
14
15 class Provider(IMapProvider):
16     def __init__(self):
17         t = Transformation(1.068070779e7, 0, 3.355443185e7,
18                                    0, -1.068070890e7, 3.355443057e7)
19
20         self.projection = MercatorProjection(26, t)
21
22     def tileWidth(self):
23         return 256
24
25     def tileHeight(self):
26         return 256
27
28     def getTileUrls(self, coordinate):
29         return ('http://s3.amazonaws.com/com.modestmaps.bluemarble/%d-r%d-c%d.jpg' % (coordinate.zoom, coordinate.row, coordinate.column),)
30
31 if __name__ == '__main__':
32     import doctest
33     doctest.testmod()
Note: See TracBrowser for help on using the browser.