Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Commented out code for debugging (saving of metatiles), fixed python …
…formatting
  • Loading branch information
Marcel Dancak committed Apr 24, 2019
1 parent 4ab9bb6 commit efdd52c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions python/plugins/processing/algs/qgis/TilesXYZ.py
Expand Up @@ -52,14 +52,15 @@
from processing.algs.qgis.QgisAlgorithm import QgisAlgorithm


# Math functions taken from https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames
# Math functions taken from https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames #spellok
def deg2num(lat_deg, lon_deg, zoom):
lat_rad = math.radians(lat_deg)
n = 2.0 ** zoom
xtile = int((lon_deg + 180.0) / 360.0 * n)
ytile = int((1.0 - math.log(math.tan(lat_rad) + (1 / math.cos(lat_rad))) / math.pi) / 2.0 * n)
return (xtile, ytile)


def num2deg(xtile, ytile, zoom):
n = 2.0 ** zoom
lon_deg = xtile / n * 360.0 - 180.0
Expand Down Expand Up @@ -251,7 +252,6 @@ def initAlgorithm(self, config=None):
self.outputs,
defaultValue=0))


def name(self):
return 'tilesxyz'

Expand Down Expand Up @@ -344,9 +344,9 @@ def processAlgorithm(self, parameters, context, feedback):
painter.end()

# For analysing metatiles (labels, etc.)
metatile_dir = os.path.join(output_dir, name, str(zoom))
os.makedirs(metatile_dir, exist_ok=True)
image.save(os.path.join(metatile_dir, 'metatile_%s.png' % i))
# metatile_dir = os.path.join(output_dir, name, str(zoom))
# os.makedirs(metatile_dir, exist_ok=True)
# image.save(os.path.join(metatile_dir, 'metatile_%s.png' % i))

progress += 1
feedback.setProgress(100 * (progress / metatiles_count))
Expand Down

0 comments on commit efdd52c

Please sign in to comment.