Skip to content

wxGUI AddWSDialog RenderWMSMgr: Fix render WMS jpeg source format#640

Merged
petrasovaa merged 1 commit into
OSGeo:masterfrom
tmszi:fix_add_web_service_layer_jpeg_src_image_format
May 18, 2020
Merged

wxGUI AddWSDialog RenderWMSMgr: Fix render WMS jpeg source format#640
petrasovaa merged 1 commit into
OSGeo:masterfrom
tmszi:fix_add_web_service_layer_jpeg_src_image_format

Conversation

@tmszi

@tmszi tmszi commented May 16, 2020

Copy link
Copy Markdown
Member

To reproduce:

  1. Click on the Add web service layer (WMS, WMTS, NASA OnEarth) toolbar icon tool
  2. Set this url http://ows.mundialis.de/services/service? in the Server TextCtrl widget
  3. Click on the Connect button
  4. In the List of layers choose OpenStreetMap WMS - by terrestris -> default
  5. On the Source image format RadioBox widget check jpeg
  6. Choose proper Source projection CheckBox widget item (EPSG: 4326)
  7. Click on the Add layer button

Error message (Console page):

Traceback (most recent call last):
  File "/usr/lib64/grass79/gui/wxpython/core/gthread.py",
line 121, in OnDone

event.ondone(event)
  File "/usr/lib64/grass79/gui/wxpython/core/ws.py", line
200, in OnRenderDone

self.maskMerger.AddRasterBands(self.tempMap, {4: 1})
  File "/usr/lib64/grass79/gui/wxpython/core/ws.py", line
392, in AddRasterBands

bandData = sDataset.GetRasterBand(sBandNnum).ReadRaster(
AttributeError
:
'NoneType' object has no attribute 'ReadRaster'

Error message (Terminal emulator):

ERROR 5: /home/user/grassdata/osm/PERMANENT/.tmp/gnu-linux/12160.4: GDALDataset::GetRasterBand(4) - Illegal band #

@petrasovaa petrasovaa self-requested a review May 17, 2020 02:27
Comment thread gui/wxpython/core/ws.py Outdated
add_alpha_channel = True
mask_fill_value = 0
if self.fetching_cmd[1]['format'] == 'jpeg':
mask_fill_value = 256

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for fixing it, could you explain the fill value 256?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are welcome. Correct value should be 255 (white color), not 256 (but every value > 255 produce white color in this case). Alright I updated it to the correct value. If mask is white color g.pnmcomp doesn't apply mask for the input map (WMS jpeg source format) and rendering is correctly.

/gui/wxpython/core/render.py, row 658

if maps:
    ret, msg = RunCommand('g.pnmcomp',
                          getErrorMsg=True,
                          overwrite=True,
                          input='%s' % ",".join(maps),
                          mask='%s' % ",".join(masks),
                          opacity='%s' % ",".join(opacities),
                          bgcolor=bgcolor,
                          width=env['GRASS_RENDER_WIDTH'],
                          height=env['GRASS_RENDER_HEIGHT'],
                          output=self.Map.mapfile,
                          env=env)

@tmszi tmszi force-pushed the fix_add_web_service_layer_jpeg_src_image_format branch from 5732b36 to 33e6724 Compare May 17, 2020 19:03
@petrasovaa petrasovaa merged commit a3e3624 into OSGeo:master May 18, 2020
@tmszi tmszi deleted the fix_add_web_service_layer_jpeg_src_image_format branch July 28, 2020 07:09
@neteler neteler added this to the 8.0.0 milestone Dec 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants