Skip to content

Commit

Permalink
wxGUI AddWSDialog RenderWMSMgr: fix render WMS jpeg source format (#640)
Browse files Browse the repository at this point in the history
  • Loading branch information
tmszi committed May 18, 2020
1 parent 2496652 commit a3e3624
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions gui/wxpython/core/ws.py
Expand Up @@ -170,14 +170,21 @@ def OnRenderDone(self, event):
self.mapMerger.AddRasterBands(self.tempMap, {1: 1, 2: 2, 3: 3})
del self.mapMerger

add_alpha_channel = True
mask_fill_value = 0
if self.fetching_cmd[1]['format'] == 'jpeg':
mask_fill_value = 255 # white color, g.pnmcomp doesn't apply mask (alpha channel)
add_alpha_channel = False

self.maskMerger = GDALRasterMerger(
targetFile=self.layer.maskfile,
region=self.renderedRegion,
bandsNum=1,
gdalDriver='PNM',
fillValue=0)
#{4 : 1} alpha channel (4) to first and only channel (1) in mask
self.maskMerger.AddRasterBands(self.tempMap, {4: 1})
fillValue=mask_fill_value)
if add_alpha_channel:
#{4 : 1} alpha channel (4) to first and only channel (1) in mask
self.maskMerger.AddRasterBands(self.tempMap, {4: 1})
del self.maskMerger

self.fetched_data_cmd = self.fetching_cmd
Expand Down

0 comments on commit a3e3624

Please sign in to comment.