jorgealmerio / valuetool

QGis plugin to display in a table or plot the values from the visible raster layers at the current mouse position
5 stars 7 forks source link

Feature request: add support for WCS layers #25

Open zirneklitis opened 2 years ago

zirneklitis commented 2 years ago

Hi. As more and more data is used as the web-based service, it would be great to add the support for WCS layers.

jorgealmerio commented 2 years ago

Yes, you are right!

j-brewer commented 1 year ago

I did a quick test, and it's pretty easy to include WCS layers. In valuewidget.py, just change line 260 from

layer.providerType() == "gdal" and \

to

(layer.providerType() == "gdal" or layer.providerType() == "wcs") and \

There was one rather obvious and potentially problematic side-effect though. The call to

layer.dataProvider().sample(pos, band)[0]

in the getValue function triggers a download of the WCS area of interest (which makes sense). For me, waving my mouse around over 10-20 miles of a WCS layer immediately triggered a massive data request to the WCS server and caused my QGIS UI to become very sluggish until the requests had finished. When zoomed in though, the value tool (with the above modification) worked on my WCS layer (just like a local raster layer).

The API documentation at https://qgis.org/pyqgis/master/core/QgsRasterDataProvider.html#qgis.core.QgsRasterDataProvider.sample suggests that this problem can be worked around by sampling WCS layers with the appropriate bounding box and/or at the correct zoom level. Unfortunately, that's starting to get a little beyond my current level of expertise in QGIS programming, so I'm just leaving this comment here for anyone else who might find it useful.

jorgealmerio commented 1 year ago

Very good comment! Thank you!

AlisterH commented 1 year ago

Version 0.8.5 of the Value tool supported wcs and it didn't seem have the performance issue described by j-brewer (which I have confirmed).

j-brewer commented 1 year ago

I believe v0.8.5 was built for QGIS 2. The version at https://plugins.qgis.org/plugins/valuetool/version/0.8.5/ doesn't work with QGIS 3.

Just for fun, I modified the metadata file to bypass the compatibility check. However, that just results in a Python error when trying to load the old plugin.

I think some things have changed in the QGIS 3 API that render code from the previous versions of the Value Tool (working or not) moot.

AlisterH commented 1 year ago

Yes, I was testing it in QGIS 2.

ar-siddiqui commented 8 months ago

If I remember correctly, I have seen the older versions of Value Tool working on WCS in QGIS 3. Did the support get dropped, or my memory is bad?