Bug report #4138

After selecting a specific band in raster properties, the dropdown in the style tab reverts always to "band1"

Added by Thaddeus - over 11 years ago. Updated almost 11 years ago.

Status:Closed
Priority:High
Assignee:-
Category:Rasters
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:Yes Resolution:fixed
Crashes QGIS or corrupts data:No Copied to github as #:14118

Description

QGIS 1.7.0 Wroclaw under Win.
Very tricky: cannot tell which of the many bands on a given layer is being displayed: cannot find any icon/name/info anywhere except under "Layer -> Properties -> Style, Single band properties" which shows the wrong band, always "Band 1" and sneakily modifies user chosen Band to always be "Band 1" if pressing OK/Apply, even when using other tabs like "Metadata".

TestData__Single_band_properties__LayerMisplacement.zip (173 KB) Thaddeus -, 2011-08-04 01:36 PM

QGIS_Main_Window.png (44.4 KB) Thaddeus -, 2011-08-04 01:38 PM

Composer.png (24 KB) Thaddeus -, 2011-08-04 01:39 PM

PDF_Printout.png (60 KB) Thaddeus -, 2011-08-04 01:39 PM

Associated revisions

Revision a6df30c9
Added by Alexander Bruy almost 11 years ago

display real band number for multiband rasters when single band gray
drawing style used (patch by Bill Clay, fix #4138)

Revision cf41e6c0
Added by Alexander Bruy almost 11 years ago

display real band number for multiband rasters when single band gray
drawing style used (patch by Bill Clay, fix #4138)

History

#1 Updated by Thaddeus - over 11 years ago

#2 Updated by Thaddeus - over 11 years ago

#3 Updated by Thaddeus - over 11 years ago

#4 Updated by Goyo D over 11 years ago

  • Category set to GUI

Confirmed in 1.8.0-trunk (Ubuntu Natty).

#5 Updated by Bill Clay over 11 years ago

Here is a fix. I apologize, but it was easier to fix the bug than for this git virgin to figure out how to make git create a patch file (even after reading the QGIS coding document). Guess it's time for me to graduate from SVN. Sorry!

diff --git a/src/app/qgsrasterlayerproperties.cpp b/src/app/qgsrasterlayerproperties.cpp
index 8e65d27..326644e 100644
--- a/src/app/qgsrasterlayerproperties.cpp
+++ b/src/app/qgsrasterlayerproperties.cpp
@@ -731,6 +731,7 @@ void QgsRasterLayerProperties::sync()
    cboRed->setCurrentIndex( cboRed->findText( mRasterLayer->redBandName() ) );
    cboGreen->setCurrentIndex( cboGreen->findText( mRasterLayer->greenBandName() ) );
    cboBlue->setCurrentIndex( cboBlue->findText( mRasterLayer->blueBandName() ) );
+   cboGray->setCurrentIndex( cboGray->findText( mRasterLayer->grayBandName() ) );

    //Display the current default contrast enhancement algorithm
    mDefaultContrastEnhancementAlgorithm = myQSettings.value( "/Raster/defaultContrastEnhancementAlgorithm", "NoEnhancement" ).toString();

#6 Updated by Giovanni Manghi over 11 years ago

  • Pull Request or Patch supplied changed from No to Yes
  • Assignee set to Tim Sutton

#7 Updated by Bill Clay over 11 years ago

The above one-line patch does NOT report the selected band information in metadata as Thaddeus, the original reporter, requested. It does, however, show the (correctly-remembered) selected band in the raster layer properties dialog, style tab, gray band field for single-band gray layers.

#8 Updated by Giovanni Manghi about 11 years ago

Hi Thaddeus, I can confirm the issue. Nevertheless I found not very handy to have many notes/feature_requests/described_issues embedded in the QGIS project you attached to this ticket. Please open proper tickets (one for each issue/feature request), describing everything in the "description" field, and attaching screenshot/sample data just to allow understand better the issue.

Tim: the issue is confirmed, while setting the raster to "single band" and selecting one the bands, in the raster properties it reverts always to "band1" (but QGIS is actually rendering a different band, the one selected before by the user). If the attached patch works I suggest to commit it ASAP. I confirmed the issue on qgis-trunk on Ubuntu.

Thaddeus, about the other issues you have described with annotations in the attached qgis project:

  • I cannot replicate this "_~300KB of input data produces 3MB PDF printout --just 100dpi: many repeated useless Stream images and bloated/corrupted PS code?_": on my pc (qgis-trunk/Ubuntu Linux) your project results in a 250kb PDF at 100dpi (printed as vector) and 200kb if printed as raster.
  • I cannot understand this "_Printing this as a vector PDF does not work: it prints an extremely-bloated wrong-coordinates raster PDF file?_" and also this "_New Feature: screen scale value exposed to the SQL queries on layers would be very nice._"
  • The folloowing feature request make sense and I will open a proper ticket for it: "_How can I tell which of the many Bands on this layer is being displayed? Please print indication on "Metadata" and many other places!_"

#9 Updated by Giovanni Manghi about 11 years ago

  • Category changed from GUI to Rasters

#10 Updated by Giovanni Manghi about 11 years ago

  • Subject changed from Unable to keep raster band, always defaulting to Band 1. to After selecting a specific band in raster properties, the dropdown in the style tab reverts always to "band1"

#11 Updated by Giovanni Manghi about 11 years ago

  • The folloowing feature request make sense and I will open a proper ticket for it: "_How can I tell which of the many Bands on this layer is being displayed? Please print indication on "Metadata" and many other places!_"

see #4353

#12 Updated by Thaddeus - about 11 years ago

Hi Giovanni, sorry about the confusion: all the notes and comments on the QGIS canvas screenshot were mainly taking notes for myself, I'm pretty sure I made bug reports for most/each of those issues, but, for some reason, they do not show on my Redmine profile --may have been reported before Redmine era.

Please see: Bug #3466, Feature #4144, Feature #4145, Bug #3028 (duplicate of #3448).

Bug #3466 Extremely Bloated PDF Vector Export under Win.

Feature #4144 New Feature: show Raster Band number on Layer Panel entries.

Feature #4145 New Feature: expose map scale to SQL queries (under "Layer Properties").

Bug #3028 Displacement between vector and WMS layers after printing

#13 Updated by Alister Hood about 11 years ago

Is there any reason Bill's patch can't be applied?
It works fine.

#14 Updated by Giovanni Manghi about 11 years ago

Alister Hood wrote:

Is there any reason Bill's patch can't be applied?
It works fine.

I agree, and the bug is really annoying. :)

#15 Updated by Thaddeus - about 11 years ago

What's the target version ? I just tried 1.7.2 and still forgets the raster band selection.

#16 Updated by Giovanni Manghi almost 11 years ago

  • Target version set to Version 1.7.4

#17 Updated by Giovanni Manghi almost 11 years ago

  • Affected QGIS version set to master
  • Assignee deleted (Tim Sutton)
  • Priority changed from Normal to 6
  • Crashes QGIS or corrupts data set to No

This is still confirmed on master and very annoying. Can someone review the patch and apply it?

#18 Updated by Alexander Bruy almost 11 years ago

  • % Done changed from 0 to 100
  • Status changed from Open to Closed

#19 Updated by Alexander Bruy almost 11 years ago

  • Resolution set to fixed

Also available in: Atom PDF