Skip to content
Permalink
Browse files

Update Rasterize.py

  • Loading branch information
Trashmonk authored and m-kuhn committed Dec 21, 2017
1 parent 82df4de commit d908518c4922a81efe0bc8d49da8c4fbd07343b9
Showing with 6 additions and 7 deletions.
  1. +6 −7 python/plugins/processing/algs/qgis/Rasterize.py
@@ -110,7 +110,7 @@ def initAlgorithm(self, config=None):
self.MAKE_BACKGROUND_TRANSPARENT,
self.tr('Make background transparent'),
defaultValue=False))

map_theme_param = QgsProcessingParameterString(
self.MAP_THEME,
description=self.tr(
@@ -136,7 +136,6 @@ def initAlgorithm(self, config=None):
self.tr(
'Output layer')))


def name(self):
# Unique (non-user visible) name of algorithm
return 'rasterize'
@@ -184,7 +183,7 @@ def processAlgorithm(self, parameters, context, feedback):
parameters,
self.MAKE_BACKGROUND_TRANSPARENT,
context)

mupp = self.parameterAsDouble(
parameters,
self.MAP_UNITS_PER_PIXEL,
@@ -244,12 +243,12 @@ def __init__(self, map_theme, layer, extent, tile_size, mupp, output,
no_bands = 4
else:
no_bands = 3

self.dataset = driver.Create(output, xsize, ysize, no_bands)
self.dataset.SetProjection(str(crs.toWkt()))
self.dataset.SetGeoTransform(
[extent.xMinimum(), mupp, 0, extent.yMaximum(), 0, -mupp])

self.image = QImage(QSize(tile_size, tile_size), QImage.Format_ARGB32)

self.settings = QgsMapSettings()
@@ -265,7 +264,7 @@ def __init__(self, map_theme, layer, extent, tile_size, mupp, output,
self.settings.setBackgroundColor(QColor(255, 255, 255, 0))
else:
self.settings.setBackgroundColor(QColor(255, 255, 255))

if QgsProject.instance().mapThemeCollection().hasMapTheme(map_theme):
self.settings.setLayers(
QgsProject.instance().mapThemeCollection(
@@ -318,7 +317,7 @@ def renderTile(self, x, y, feedback, make_trans):
job = QgsMapRendererCustomPainterJob(self.settings, painter)
job.renderSynchronously()
painter.end()

# Needs not to be deleted or Windows will kill it too early...
tmpfile = tempfile.NamedTemporaryFile(suffix='.png', delete=False)
try:

0 comments on commit d908518

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