[modestmaps-py] 01/06: Imported Upstream version 1.4.7

Bas Couwenberg sebastic at debian.org
Wed Dec 28 07:12:27 UTC 2016


This is an automated email from the git hooks/post-receive script.

sebastic pushed a commit to branch master
in repository modestmaps-py.

commit 6992b0f735edbcb783c97311ecd95f6987a1e4c0
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date:   Wed Dec 28 07:45:09 2016 +0100

    Imported Upstream version 1.4.7
---
 ModestMaps/BlueMarble.py    |  8 ++++----
 ModestMaps/CloudMade.py     |  9 +++++----
 ModestMaps/Geo.py           |  2 +-
 ModestMaps/MapQuest.py      |  9 +++++----
 ModestMaps/Microsoft.py     |  9 +++++----
 ModestMaps/OpenStreetMap.py |  8 ++++----
 ModestMaps/Providers.py     | 10 ++--------
 ModestMaps/Stamen.py        | 22 ++++++++++++----------
 ModestMaps/Tiles.py         |  2 +-
 ModestMaps/VERSION          |  2 +-
 ModestMaps/Yahoo.py         |  8 ++++----
 ModestMaps/__init__.py      | 35 ++++++++++++++++++++++-------------
 PKG-INFO                    |  2 +-
 13 files changed, 67 insertions(+), 59 deletions(-)

diff --git a/ModestMaps/BlueMarble.py b/ModestMaps/BlueMarble.py
index 31729b6..c2397c0 100644
--- a/ModestMaps/BlueMarble.py
+++ b/ModestMaps/BlueMarble.py
@@ -8,11 +8,11 @@
 
 from math import pi
 
-from Core import Coordinate
-from Geo import MercatorProjection, deriveTransformation
-from Providers import IMapProvider
+from .Core import Coordinate
+from .Geo import MercatorProjection, deriveTransformation
+from .Providers import IMapProvider
 
-import Tiles
+from . import Tiles
 
 class Provider(IMapProvider):
     def __init__(self):
diff --git a/ModestMaps/CloudMade.py b/ModestMaps/CloudMade.py
index 6f9478f..de5f000 100644
--- a/ModestMaps/CloudMade.py
+++ b/ModestMaps/CloudMade.py
@@ -30,11 +30,12 @@
 
 from math import pi
 
-from Core import Coordinate
-from Geo import MercatorProjection, deriveTransformation
-from Providers import IMapProvider
+from .Core import Coordinate
+from .Geo import MercatorProjection, deriveTransformation
+from .Providers import IMapProvider
 
-import random, Tiles
+import random
+from . import Tiles
 
 class BaseProvider(IMapProvider):
     def __init__(self, apikey, style=None):
diff --git a/ModestMaps/Geo.py b/ModestMaps/Geo.py
index 55e67d4..01b4557 100644
--- a/ModestMaps/Geo.py
+++ b/ModestMaps/Geo.py
@@ -44,7 +44,7 @@
 """
 
 import math
-from Core import Point, Coordinate
+from .Core import Point, Coordinate
 
 class Location:
     def __init__(self, lat, lon):
diff --git a/ModestMaps/MapQuest.py b/ModestMaps/MapQuest.py
index c5f1b08..53b5380 100644
--- a/ModestMaps/MapQuest.py
+++ b/ModestMaps/MapQuest.py
@@ -14,11 +14,12 @@
 
 from math import pi
 
-from Core import Coordinate
-from Geo import MercatorProjection, deriveTransformation
-from Providers import IMapProvider
+from .Core import Coordinate
+from .Geo import MercatorProjection, deriveTransformation
+from .Providers import IMapProvider
 
-import random, Tiles
+import random
+from . import Tiles
 
 class AbstractProvider(IMapProvider):
     def __init__(self):
diff --git a/ModestMaps/Microsoft.py b/ModestMaps/Microsoft.py
index 3918400..43aaada 100644
--- a/ModestMaps/Microsoft.py
+++ b/ModestMaps/Microsoft.py
@@ -20,11 +20,12 @@
 
 from math import pi
 
-from Core import Coordinate
-from Geo import MercatorProjection, deriveTransformation
-from Providers import IMapProvider
+from .Core import Coordinate
+from .Geo import MercatorProjection, deriveTransformation
+from .Providers import IMapProvider
 
-import random, Tiles
+import random
+from . import Tiles
 
 class AbstractProvider(IMapProvider):
     def __init__(self):
diff --git a/ModestMaps/OpenStreetMap.py b/ModestMaps/OpenStreetMap.py
index 5519222..39fe924 100644
--- a/ModestMaps/OpenStreetMap.py
+++ b/ModestMaps/OpenStreetMap.py
@@ -8,11 +8,11 @@
 
 from math import pi
 
-from Core import Coordinate
-from Geo import MercatorProjection, deriveTransformation
-from Providers import IMapProvider
+from .Core import Coordinate
+from .Geo import MercatorProjection, deriveTransformation
+from .Providers import IMapProvider
 
-import Tiles
+from . import Tiles
 
 class Provider(IMapProvider):
     def __init__(self):
diff --git a/ModestMaps/Providers.py b/ModestMaps/Providers.py
index 680ca81..9404ff9 100644
--- a/ModestMaps/Providers.py
+++ b/ModestMaps/Providers.py
@@ -1,8 +1,8 @@
 import re
 from math import pi, pow
 
-from Core import Coordinate
-from Geo import LinearProjection, MercatorProjection, deriveTransformation
+from .Core import Coordinate
+from .Geo import LinearProjection, MercatorProjection, deriveTransformation
 
 ids = ('MICROSOFT_ROAD', 'MICROSOFT_AERIAL', 'MICROSOFT_HYBRID',
        'YAHOO_ROAD',     'YAHOO_AERIAL',     'YAHOO_HYBRID',
@@ -16,9 +16,6 @@ class IMapProvider:
     def getTileUrls(self, coordinate):
         raise NotImplementedError("Abstract method not implemented by subclass.")
 
-    def getTileUrls(self, coordinate):
-        raise NotImplementedError("Abstract method not implemented by subclass.")
-
     def tileWidth(self):
         raise NotImplementedError("Abstract method not implemented by subclass.")
     
@@ -32,9 +29,6 @@ class IMapProvider:
         return self.projection.coordinateLocation(location)
 
     def sourceCoordinate(self, coordinate):
-        raise NotImplementedError("Abstract method not implemented by subclass.")
-
-    def sourceCoordinate(self, coordinate):
         wrappedColumn = coordinate.column % pow(2, coordinate.zoom)
         
         while wrappedColumn < 0:
diff --git a/ModestMaps/Stamen.py b/ModestMaps/Stamen.py
index 11bc977..ed02e32 100644
--- a/ModestMaps/Stamen.py
+++ b/ModestMaps/Stamen.py
@@ -9,28 +9,30 @@
 
 >>> p = TerrainProvider()
 >>> p.getTileUrls(Coordinate(25322, 10507, 16)) #doctest: +ELLIPSIS
-('http://tile.stamen.com/terrain/16/10507/25322.png',)
+('http://tile.stamen.com/terrain/16/10507/25322.jpg',)
 
 >>> p = WatercolorProvider()
 >>> p.getTileUrls(Coordinate(25322, 10507, 16)) #doctest: +ELLIPSIS
-('http://tile.stamen.com/watercolor/16/10507/25322.png',)
+('http://tile.stamen.com/watercolor/16/10507/25322.jpg',)
 """
 
 from math import pi
 
-from Core import Coordinate
-from Geo import MercatorProjection, deriveTransformation
-from Providers import IMapProvider
+from .Core import Coordinate
+from .Geo import MercatorProjection, deriveTransformation
+from .Providers import IMapProvider
 
-import random, Tiles
+import random
+from . import Tiles
 
 class BaseProvider(IMapProvider):
-    def __init__(self, style):
+    def __init__(self, style, tile_format='png'):
         # 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
+        self.tile_format = tile_format
 
     def tileWidth(self):
         return 256
@@ -40,7 +42,7 @@ class BaseProvider(IMapProvider):
 
     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),)
+        return ('http://tile.stamen.com/%s/%d/%d/%d.%s' % (self.style, zoom, column, row, self.tile_format),)
 
 class TonerProvider(BaseProvider):
     def __init__(self):
@@ -48,11 +50,11 @@ class TonerProvider(BaseProvider):
 
 class TerrainProvider(BaseProvider):
     def __init__(self):
-        BaseProvider.__init__(self, 'terrain')
+        BaseProvider.__init__(self, 'terrain', 'jpg')
 
 class WatercolorProvider(BaseProvider):
     def __init__(self):
-        BaseProvider.__init__(self, 'watercolor')
+        BaseProvider.__init__(self, 'watercolor', 'jpg')
 
 if __name__ == '__main__':
     import doctest
diff --git a/ModestMaps/Tiles.py b/ModestMaps/Tiles.py
index bfcfb00..b288fca 100644
--- a/ModestMaps/Tiles.py
+++ b/ModestMaps/Tiles.py
@@ -83,7 +83,7 @@ def toBinaryString(i):
     """
     return ''.join([octalStrings[int(c)]
                     for c
-                    in oct(i)]).lstrip('0')
+                    in oct(i).lstrip('0o')]).lstrip('0')
 
 def fromBinaryString(s):
     """ Return an integer for a binary string.
diff --git a/ModestMaps/VERSION b/ModestMaps/VERSION
index c514bd8..be05bba 100644
--- a/ModestMaps/VERSION
+++ b/ModestMaps/VERSION
@@ -1 +1 @@
-1.4.6
+1.4.7
diff --git a/ModestMaps/Yahoo.py b/ModestMaps/Yahoo.py
index 52ae84d..0cfcda5 100644
--- a/ModestMaps/Yahoo.py
+++ b/ModestMaps/Yahoo.py
@@ -20,11 +20,11 @@
 
 from math import pi
 
-from Core import Coordinate
-from Geo import MercatorProjection, deriveTransformation
-from Providers import IMapProvider
+from .Core import Coordinate
+from .Geo import MercatorProjection, deriveTransformation
+from .Providers import IMapProvider
 
-import Tiles
+from . import Tiles
 
 ROAD_VERSION = '3.52'
 AERIAL_VERSION = '1.7'
diff --git a/ModestMaps/__init__.py b/ModestMaps/__init__.py
index 4325d3b..bf436f8 100644
--- a/ModestMaps/__init__.py
+++ b/ModestMaps/__init__.py
@@ -1,8 +1,9 @@
+from __future__ import print_function
 """
 >>> m = Map(Microsoft.RoadProvider(), Core.Point(600, 600), Core.Coordinate(3165, 1313, 13), Core.Point(-144, -94))
 >>> p = m.locationPoint(Geo.Location(37.804274, -122.262940))
 >>> p
-(370.724, 342.549)
+(370.752, 342.626)
 >>> m.pointLocation(p)
 (37.804, -122.263)
 
@@ -68,14 +69,22 @@ __version__ = open(os.path.join(os.path.dirname(__file__), 'VERSION')).read().st
 
 import sys
 import urllib
-import httplib
-import urlparse
-import StringIO
 import math
-import thread
 import time
 
 try:
+    import httplib
+    import urlparse
+    import StringIO
+    import thread
+except ImportError:
+    # Python 3
+    import http.client as httplib
+    import urllib.parse as urlparse
+    from io import StringIO
+    import _thread as thread
+
+try:
     import Image
 except ImportError:
     try:
@@ -85,11 +94,11 @@ except ImportError:
         # 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, Stamen
+from . import Tiles
+from . import Providers
+from . import Core
+from . import Geo
+from . import Yahoo, Microsoft, BlueMarble, OpenStreetMap, CloudMade, MapQuest, Stamen
 import time
 
 # a handy list of possible providers, which isn't
@@ -174,7 +183,7 @@ def calculateMapExtent(provider, width, height, *args):
         returns the coordinate of an initial tile and its point placement,
         relative to the map center.
     """
-    coordinates = map(provider.locationCoordinate, args)
+    coordinates = list(map(provider.locationCoordinate, args))
     
     TL = Core.Coordinate(min([c.row for c in coordinates]),
                          min([c.column for c in coordinates]),
@@ -221,7 +230,7 @@ def printlocked(lock, *stuff):
     """
     """
     if lock.acquire():
-        print ' '.join([str(thing) for thing in stuff])
+        print(' '.join([str(thing) for thing in stuff]), file=sys.stderr)
         lock.release()
 
 class TileRequest:
@@ -272,7 +281,7 @@ class TileRequest:
                         cache[(netloc, path, query)] = img
                         lock.release()
                 
-                elif scheme == 'http':
+                elif scheme in ('http', 'https'):
                     conn = httplib.HTTPConnection(netloc)
                     conn.request('GET', path + ('?' + query).rstrip('?'), headers={'User-Agent': 'Modest Maps python branch (http://modestmaps.com)'})
                     response = conn.getresponse()
diff --git a/PKG-INFO b/PKG-INFO
index 97b0ac2..111aa1d 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: ModestMaps
-Version: 1.4.6
+Version: 1.4.7
 Summary: Modest Maps python port
 Home-page: http://modestmaps.com
 Author: Michal Migurski

-- 
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