Skip to content

Commit

Permalink
Passed tms compatibility option to GlobalGeodetic object.
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven D. Lander committed Jul 25, 2013
1 parent 9f37a9d commit 36af00c
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions gdal/swig/python/scripts/gdal2tiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,16 +352,16 @@ class GlobalGeodetic(object):
WMS, KML Web Clients, Google Earth TileMapService
"""

def __init__(self, tileSize = 256):
def __init__(self, tmscompatible, tileSize = 256):
self.tileSize = tileSize
if self.options.tmscompatible:
# Defaults the resolution factor to 0.703125 (2 tiles @ level 0)
# Adhers to OSGeo TMS spec http://wiki.osgeo.org/wiki/Tile_Map_Service_Specification#global-geodetic
self.resFact = 360.0 / self.tileSize
else:
if tmscompatible is not None:
# Defaults the resolution factor to 1.40625 (1 tile @ level 0)
# Adheres OpenLayers, MapProxy, etc default resolution for TMS
self.resFact = 180.0 / self.tileSize
else:
# Defaults the resolution factor to 0.703125 (2 tiles @ level 0)
# Adhers to OSGeo TMS spec http://wiki.osgeo.org/wiki/Tile_Map_Service_Specification#global-geodetic
self.resFact = 360.0 / self.tileSize

def LatLonToPixels(self, lat, lon, zoom):
"Converts lat/lon to pixel coordinates in given zoom of the EPSG:4326 pyramid"
Expand Down Expand Up @@ -990,7 +990,7 @@ def open_input(self):

if self.options.profile == 'geodetic':

self.geodetic = GlobalGeodetic() # from globalmaptiles.py
self.geodetic = GlobalGeodetic(self.options.tmscompatible) # from globalmaptiles.py

# Function which generates SWNE in LatLong for given tile
self.tileswne = self.geodetic.TileLatLonBounds
Expand Down

0 comments on commit 36af00c

Please sign in to comment.