[modestmaps-py] 06/14: Imported Upstream version 1.4.6
Sebastiaan Couwenberg
sebastic at moszumanska.debian.org
Sun Aug 16 14:21:25 UTC 2015
This is an automated email from the git hooks/post-receive script.
sebastic pushed a commit to branch master
in repository modestmaps-py.
commit 221e97bfce37af58629b7ec0876940e148209145
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date: Sun Aug 16 15:31:09 2015 +0200
Imported Upstream version 1.4.6
---
._VERSION | Bin 171 -> 0 bytes
._setup.py | Bin 171 -> 0 bytes
ModestMaps/Providers.py | 2 +-
ModestMaps/Stamen.py | 59 ++++++++++++++++++++++++++++++++++++++++++++++++
ModestMaps/VERSION | 1 +
ModestMaps/__init__.py | 20 +++++++++++-----
PKG-INFO | 11 +++++++++
VERSION | 1 -
setup.py | 4 ++--
9 files changed, 88 insertions(+), 10 deletions(-)
diff --git a/._VERSION b/._VERSION
deleted file mode 100644
index dc859cc..0000000
Binary files a/._VERSION and /dev/null differ
diff --git a/._setup.py b/._setup.py
deleted file mode 100644
index 068b476..0000000
Binary files a/._setup.py and /dev/null differ
diff --git a/ModestMaps/Providers.py b/ModestMaps/Providers.py
index cf1db44..680ca81 100644
--- a/ModestMaps/Providers.py
+++ b/ModestMaps/Providers.py
@@ -54,7 +54,7 @@ class TemplatedMercatorProvider(IMapProvider):
self.templates = []
while template:
- match = re.match(r'^(http://\S+?)(,http://\S+)?$', template)
+ match = re.match(r'^((http|https|file)://\S+?)(,(http|https|file)://\S+)?$', template)
first = match.group(1)
if match:
diff --git a/ModestMaps/Stamen.py b/ModestMaps/Stamen.py
new file mode 100644
index 0000000..11bc977
--- /dev/null
+++ b/ModestMaps/Stamen.py
@@ -0,0 +1,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()
diff --git a/ModestMaps/VERSION b/ModestMaps/VERSION
new file mode 100644
index 0000000..c514bd8
--- /dev/null
+++ b/ModestMaps/VERSION
@@ -0,0 +1 @@
+1.4.6
diff --git a/ModestMaps/__init__.py b/ModestMaps/__init__.py
index df0303f..4325d3b 100644
--- a/ModestMaps/__init__.py
+++ b/ModestMaps/__init__.py
@@ -62,7 +62,9 @@
(-246.000, -179.000)
"""
-__version__ = '1.3.1'
+import os.path
+
+__version__ = open(os.path.join(os.path.dirname(__file__), 'VERSION')).read().strip()
import sys
import urllib
@@ -76,15 +78,18 @@ import time
try:
import Image
except ImportError:
- # you need PIL to do any actual drawing, but
- # maybe that's not what you're using MMaps for?
- import PIL.Image as Image
+ try:
+ import PIL.Image as Image
+ except ImportError:
+ # you need PIL to do any actual drawing, but
+ # maybe that's not what you're using MMaps for?
+ Image = None
import Tiles
import Providers
import Core
import Geo
-import Yahoo, Microsoft, BlueMarble, OpenStreetMap, CloudMade, MapQuest
+import Yahoo, Microsoft, BlueMarble, OpenStreetMap, CloudMade, MapQuest, Stamen
import time
# a handy list of possible providers, which isn't
@@ -106,7 +111,10 @@ builtinProviders = {
'CLOUDMADE_TOURIST': CloudMade.TouristProvider,
'CLOUDMADE_FRESH': CloudMade.FreshProvider,
'CLOUDMADE_PALEDAWN': CloudMade.PaleDawnProvider,
- 'CLOUDMADE_MIDNIGHTCOMMANDER': CloudMade.MidnightCommanderProvider
+ 'CLOUDMADE_MIDNIGHTCOMMANDER': CloudMade.MidnightCommanderProvider,
+ 'STAMEN_TONER': Stamen.TonerProvider,
+ 'STAMEN_TERRAIN': Stamen.TerrainProvider,
+ 'STAMEN_WATERCOLOR': Stamen.WatercolorProvider,
}
def mapByCenterZoom(provider, center, zoom, dimensions):
diff --git a/PKG-INFO b/PKG-INFO
new file mode 100644
index 0000000..97b0ac2
--- /dev/null
+++ b/PKG-INFO
@@ -0,0 +1,11 @@
+Metadata-Version: 1.1
+Name: ModestMaps
+Version: 1.4.6
+Summary: Modest Maps python port
+Home-page: http://modestmaps.com
+Author: Michal Migurski
+Author-email: UNKNOWN
+License: BSD
+Description: UNKNOWN
+Platform: UNKNOWN
+Requires: PIL
diff --git a/VERSION b/VERSION
deleted file mode 100644
index 3a3cd8c..0000000
--- a/VERSION
+++ /dev/null
@@ -1 +0,0 @@
-1.3.1
diff --git a/setup.py b/setup.py
index 532c677..f101410 100644
--- a/setup.py
+++ b/setup.py
@@ -2,7 +2,7 @@
from distutils.core import setup
-version = open('VERSION', 'r').read().strip()
+version = open('ModestMaps/VERSION', 'r').read().strip()
setup(name='ModestMaps',
version=version,
@@ -11,5 +11,5 @@ setup(name='ModestMaps',
url='http://modestmaps.com',
requires=['PIL'],
packages=['ModestMaps'],
- download_url='http://modestmaps.com/dist/ModestMaps-Py-%(version)s.tar.gz' % locals(),
+ package_data={'ModestMaps': ['VERSION']},
license='BSD')
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/modestmaps-py.git
More information about the Pkg-grass-devel
mailing list