jorgealmerio / valuetool

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

[Feature request] Band limit option when identifying a cell #9

Open chau-intl opened 3 years ago

chau-intl commented 3 years ago

When I hover over a cell in QGIS value tool will send an identify request to the selected raster layer. If I have a raster layer with thousands of bands this look up takes quite a while and QGIS freezes mean while.

Would it be possible some how to configure the tool to either lookup all, specific or maybe just the visible bands?

It looks like the QgsRasterDataProvider has a sample function which can be used on individual bands instead of all bands like the identify does.

jorgealmerio commented 3 years ago

Yes, you can! Just choose the desired raster bands on options tab / Show Bands / Selected bands and click on the little button right side as shown in figure below. valueTool_bands

chau-intl commented 3 years ago

But as far as I can tell that only limits what I see in the table tab and not the actual QGIS request to the raster layer. See the getValue method.

So if my raster contains 3 bands and I only select one band as you have shown in the image, QGIS will return the values for all 3 bands but value tool only displays the value for the band I selected. Thus if my raster contains 1000 bands the values for all 1000 bands will be fetched but value tool only displays what I configured the layer to show.

Does that make sense?

jorgealmerio commented 3 years ago

You are right, the tool algorithm could be optimized to fetch only what it requested by user. Maybe I improve it someday. Thank you for the comments! And sorry for my delayed answer!

jfbourdon commented 2 years ago

Should be adressed now, but one should use QGIS 3.22 because of a bug in previous version of QGIS with the sampling method I used.