Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wxGUI: fix WMS, includes changing widget because listtreectrl didn't … #242

Merged
merged 3 commits into from
Jan 30, 2020

Conversation

petrasovaa
Copy link
Contributor

…behave correctly when selecting layers

@petrasovaa petrasovaa mentioned this pull request Dec 5, 2019
@ninsbl
Copy link
Member

ninsbl commented Dec 5, 2019

Cool, thanks. Would be great if this could go into 7.8.2

@petrasovaa petrasovaa added backport_needed bug Something isn't working labels Dec 6, 2019
@ninsbl
Copy link
Member

ninsbl commented Dec 6, 2019

Will test this weekend.

@ninsbl
Copy link
Member

ninsbl commented Dec 6, 2019

The GUI works, but when I add a map, I get:

*** BUG ***
In pixman_region32_init_rect: Invalid rectangle passed
Set a breakpoint on '_pixman_log_error' to debug


ERROR 5: /home/stefan.blumentrath/Documents/grassdata/epsg25832/PERMANENT/.tmp/localhost.localdomain/30575.1: Access window out of range in RasterIO().  Requested (812,0) of size 406x492 on raster of 813x492.
ERROR 5: /home/stefan.blumentrath/Documents/grassdata/epsg25832/PERMANENT/.tmp/localhost.localdomain/30575.1: Access window out of range in RasterIO().  Requested (1218,0) of size 406x492 on raster of 813x492.

And the WMS does not show up in the map display...

@petrasovaa
Copy link
Contributor Author

The first part is unrelated, the second part doesn't seem to come from GRASS. I was testing it with https://services.nationalmap.gov/arcgis/services/USGSNAIPPlus/MapServer/WMSServer for nc_spm dataset and although I got similar error, the result showed up.

Copy link
Member

@ninsbl ninsbl left a comment

Choose a reason for hiding this comment

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

OK, I double-checked and found that I had used an outdated build routine.

I can confirm that it works now (on the command line at least) in nc_basic_spm_grass7 with:

g.region -p raster=elevation
r.in.wms url=https://services.nationalmap.gov/arcgis/services/USGSNAIPPlus/MapServer/WMSServer output=layers layers=1 srs=3358 wms_version=1.1.1 --o

However, in the GUI I get

Traceback (most recent call last):
  File "/opt/src/grass_test/dist.x86_64-pc-linux-
gnu/gui/wxpython/core/gthread.py", line 121, in OnDone

event.ondone(event)
  File "/opt/src/grass_test/dist.x86_64-pc-linux-
gnu/gui/wxpython/core/ws.py", line 184, in OnRenderDone

(self.layer, event.ret, time.time() - self._startTime))
TypeError
:
%d format: a number is required, not NoneType

And the process gets stuck in Downloading data...

However, there are still some confusing situation:

  • Server errors are not handled properly (response is bytestream b'*))
  • GRASS should also give warning messages if BBox of the WMS and the current region do not overlapp...

And we should probably add tests for r.in.wms / d.wms?!

But that is another issue (ticket?)...

@neteler
Copy link
Member

neteler commented Jan 10, 2020

I made this test in G78 (Fedora 31):

g.region -p raster=elevation
# note that --ui is there:
r.in.wms url=https://services.nationalmap.gov/arcgis/services/USGSNAIPPlus/MapServer/WMSServer output=layers layers=1 srs=3358 wms_version=1.1.1 --ui

and get

(Fri Jan 10 08:24:25 2020)                                                      
/home/mneteler/software/grass78_git/dist.x86_64-pc-linux-gnu/scripts/r.in.wms url=https://services.nationalmap.gov/arcgis/services/USGSNAIPPlus/MapServer/WMSServer output=layers layers=1 srs=3358
Downloading data from WMS server...
Traceback (most recent call last):
  File "/home/mneteler/software/grass78_git/dist.x86_64-pc-
linux-gnu/scripts/r.in.wms", line 267, in <module>
    sys.exit(main())
  File "/home/mneteler/software/grass78_git/dist.x86_64-pc-
linux-gnu/scripts/r.in.wms", line 253, in main
    fetched_map = wms.GetMap(options, flags)
  File "/home/mneteler/software/grass78_git/dist.x86_64-pc-
linux-gnu/etc/r.in.wms/wms_base.py", line 214, in GetMap
    self.temp_map = self._download()
  File "/home/mneteler/software/grass78_git/dist.x86_64-pc-
linux-gnu/etc/r.in.wms/wms_drv.py", line 69, in _download
    self.cap_file = self._fetchCapabilities(self.params)
  File "/home/mneteler/software/grass78_git/dist.x86_64-pc-
linux-gnu/etc/r.in.wms/wms_base.py", line 264, in
_fetchCapabilities
    return grass.decode(cap)
  File "/home/mneteler/software/grass78_git/dist.x86_64-pc-
linux-gnu/etc/python/grass/script/utils.py", line 198, in
decode
    raise TypeError("can only accept types str and bytes")
TypeError: can only accept types str and
 bytes
(Fri Jan 10 08:24:28 2020) Command finished (3 sec)    

In addition, when closing the window, I get

...
(forms.py:596369): Gtk-CRITICAL **: 08:26:33.740: gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkSpinButton

(forms.py:596369): Gtk-CRITICAL **: 08:26:33.740: gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkSpinButton
Traceback (most recent call last):
  File "/home/mneteler/software/grass78_git/dist.x86_64-pc-linux-gnu/gui/wxpython/gui_core/forms.py", line 2523, in OnPageChange
    idx = self.notebook.GetPageIndexByName('manual')
  File "/home/mneteler/software/grass78_git/dist.x86_64-pc-linux-gnu/gui/wxpython/gui_core/widgets.py", line 209, in GetPageIndexByName
    for pageIndex in range(self.classObject.GetPageCount(self.widget)):
RuntimeError: wrapped C/C++ object of type FormNotebook has been deleted
Traceback (most recent call last):
  File "/home/mneteler/software/grass78_git/dist.x86_64-pc-linux-gnu/gui/wxpython/gui_core/forms.py", line 2523, in OnPageChange
    idx = self.notebook.GetPageIndexByName('manual')
  File "/home/mneteler/software/grass78_git/dist.x86_64-pc-linux-gnu/gui/wxpython/gui_core/widgets.py", line 209, in GetPageIndexByName
    for pageIndex in range(self.classObject.GetPageCount(self.widget)):
RuntimeError: wrapped C/C++ object of type FormNotebook has been deleted
...

@petrasovaa petrasovaa merged commit a06295e into OSGeo:master Jan 30, 2020
@petrasovaa petrasovaa deleted the wms-fix-gui branch January 30, 2020 04:08
@neteler
Copy link
Member

neteler commented Jan 31, 2020

@petrasovaa shall I cherry-pick this for relbr78?

petrasovaa added a commit that referenced this pull request Feb 2, 2020
* wxGUI: fix WMS, includes changing widget because listtreectrl didn't behave correctly when selecting layers

* avoid wx warnings about deprecated calls in wms dlg

* wms: fix returncode, py3 compatibility, typo
@petrasovaa
Copy link
Contributor Author

Done!

@neteler neteler added this to the 7.8.3 milestone Feb 11, 2020
petrasovaa added a commit to petrasovaa/grass that referenced this pull request Feb 18, 2020
* wxGUI: fix WMS, includes changing widget because listtreectrl didn't behave correctly when selecting layers

* avoid wx warnings about deprecated calls in wms dlg

* wms: fix returncode, py3 compatibility, typo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants