Skip to content
Browse files

Added transparency to areas with no vector data.

Originally the background colour defaulted to white with no transparency for areas without vector data. I have added an alpha channel to the geotiff and set it zero (full transparency) for areas with no vector data. This could be optional, in case the user wants a solid background.
  • Loading branch information
Trashmonk authored and m-kuhn committed Dec 21, 2017
1 parent 9fe8729 commit 4fbea384391d3f613e050442d8809b9bc5161cb2
Showing with 7 additions and 2 deletions.
  1. +7 −2 python/plugins/processing/algs/qgis/
@@ -21,7 +21,7 @@

from processing.algs.qgis.QgisAlgorithm import QgisAlgorithm

from qgis.PyQt.QtGui import QImage, QPainter
from qgis.PyQt.QtGui import QImage, QPainter, QColor
from qgis.PyQt.QtCore import QSize
from qgis.core import (
@@ -228,7 +228,7 @@ def __init__(self, map_theme, layer, extent, tile_size, mupp, output,
xsize = self.x_tile_count * tile_size
ysize = self.y_tile_count * tile_size

self.dataset = driver.Create(output, xsize, ysize, 3) # 3 bands
self.dataset = driver.Create(output, xsize, ysize, 4) # 4 bands
[extent.xMinimum(), mupp, 0, extent.yMaximum(), 0, -mupp])
@@ -240,6 +240,7 @@ def __init__(self, map_theme, layer, extent, tile_size, mupp, output,
self.settings.setFlag(QgsMapSettings.Antialiasing, True)
self.settings.setFlag(QgsMapSettings.RenderMapTile, True)

@@ -277,6 +278,10 @@ def renderTile(self, x, y, feedback):
:param x: The x index of the current tile
:param y: The y index of the current tile

background_colour = QColor(255,255,255,0)

painter = QPainter(self.image)


0 comments on commit 4fbea38

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