Skip to content
Permalink
Browse files

Commented out code for debugging (saving of metatiles), fixed python …

…formatting
  • Loading branch information
Marcel Dancak
Marcel Dancak committed Apr 24, 2019
1 parent 4ab9bb6 commit efdd52cb2f7d7e85acb43f937fa9558fd16813b7
Showing with 5 additions and 5 deletions.
  1. +5 −5 python/plugins/processing/algs/qgis/TilesXYZ.py
@@ -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
@@ -251,7 +252,6 @@ def initAlgorithm(self, config=None):
self.outputs,
defaultValue=0))


def name(self):
return 'tilesxyz'

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

0 comments on commit efdd52c

Please sign in to comment.
You can’t perform that action at this time.