Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
2016-12-27: 1.4.7
- Added Python 3 support.

2014-05-10: 1.4.6
- Moved VERSION to setup package_data so it will actually work.

Expand Down
8 changes: 4 additions & 4 deletions ModestMaps/BlueMarble.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
9 changes: 5 additions & 4 deletions ModestMaps/CloudMade.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion ModestMaps/Geo.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"""

import math
from Core import Point, Coordinate
from .Core import Point, Coordinate

class Location:
def __init__(self, lat, lon):
Expand Down
9 changes: 5 additions & 4 deletions ModestMaps/MapQuest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
9 changes: 5 additions & 4 deletions ModestMaps/Microsoft.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
8 changes: 4 additions & 4 deletions ModestMaps/OpenStreetMap.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions ModestMaps/Providers.py
Original file line number Diff line number Diff line change
@@ -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',
Expand Down
9 changes: 5 additions & 4 deletions ModestMaps/Stamen.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,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, style, tile_format='png'):
Expand Down
2 changes: 1 addition & 1 deletion ModestMaps/Tiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion ModestMaps/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.4.6
1.4.7
8 changes: 4 additions & 4 deletions ModestMaps/Yahoo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
33 changes: 21 additions & 12 deletions ModestMaps/__init__.py
Original file line number Diff line number Diff line change
@@ -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)

Expand Down Expand Up @@ -68,13 +69,21 @@

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:
Expand All @@ -85,11 +94,11 @@
# 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
Expand Down Expand Up @@ -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]),
Expand Down Expand Up @@ -221,7 +230,7 @@ def printlocked(lock, *stuff):
"""
"""
if lock.acquire():
print >> sys.stderr, ' '.join([str(thing) for thing in stuff])
print(' '.join([str(thing) for thing in stuff]), file=sys.stderr)
lock.release()

class TileRequest:
Expand Down