[GRASS-dev] [GRASS GIS] #2041: wxgui: error attempting to display imported raster map that was imported as three bands

#2041: wxgui: error attempting to display imported raster map that was imported as
three bands
-----------------------------------+----------------------------------------
Reporter: mlennert | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: wxGUI | Version: svn-trunk
Keywords: raster import display | Platform: Unspecified
      Cpu: Unspecified |
-----------------------------------+----------------------------------------
When you use the File->Import raster data->Common formats import wizard
frontend to r.in.gdal to import a raster file that will be split into
.red, .green, .blue bands on import, and you have "Add imported layers to
layer tree" checked, then you get an error message since the GUI tries to
zoom to and display a map with a name without the band extensions.

To reproduce, use the wizard to import any jpg, png, tiff or other raster
format that gets split into the three color bands.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2041&gt;
GRASS GIS <http://grass.osgeo.org>

#2041: wxgui: error attempting to display imported raster map that was imported as
three bands
-----------------------------------+----------------------------------------
Reporter: mlennert | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: wxGUI | Version: svn-trunk
Keywords: raster import display | Platform: Unspecified
      Cpu: Unspecified |
-----------------------------------+----------------------------------------

Comment(by wenzeslaus):

As a temporary solution, GUI currently contains a text that says that
''Add layers...'' may not work with multiple bands.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2041#comment:1&gt;
GRASS GIS <http://grass.osgeo.org>

#2041: wxgui: error attempting to display imported raster map that was imported as
three bands
-----------------------------------+----------------------------------------
Reporter: mlennert | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: wxGUI | Version: svn-trunk
Keywords: raster import display | Platform: Unspecified
      Cpu: Unspecified |
-----------------------------------+----------------------------------------

Comment(by mlennert):

Replying to [comment:1 wenzeslaus]:
> As a temporary solution, GUI currently contains a text that says that
''Add layers...'' may not work with multiple bands.

I guess to get a "real" solution, the dialog would have to run gdalinfo
first to check whether there are multiple bands in the file ? Either using
the python gdal api (RasterCount) or using some basic grep:

{{{
gdalinfo MyRaster.File | grep Band | wc -l
}}}

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2041#comment:2&gt;
GRASS GIS <http://grass.osgeo.org>

#2041: wxgui: error attempting to display imported raster map that was imported as
three bands
-----------------------------------+----------------------------------------
Reporter: mlennert | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: wxGUI | Version: svn-trunk
Keywords: raster import display | Platform: Unspecified
      Cpu: Unspecified |
-----------------------------------+----------------------------------------

Comment(by mmetz):

Replying to [comment:2 mlennert]:
> Replying to [comment:1 wenzeslaus]:
> > As a temporary solution, GUI currently contains a text that says that
''Add layers...'' may not work with multiple bands.
>
> I guess to get a "real" solution, the dialog would have to run gdalinfo
first to check whether there are multiple bands in the file ?

This is not enough, you would also need to check if the band option or the
k flag is used with r.in.gdal.

In order to keep things sufficiently simple (which the wxGUI not longer
is, but anyway), I would rather suggest to test if the output raster
exists, if not, the GUI should not attempt to display it.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2041#comment:3&gt;
GRASS GIS <http://grass.osgeo.org>

#2041: wxgui: error attempting to display imported raster map that was imported as
three bands
-----------------------------------+----------------------------------------
Reporter: mlennert | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: wxGUI | Version: svn-trunk
Keywords: raster import display | Platform: Unspecified
      Cpu: Unspecified |
-----------------------------------+----------------------------------------

Comment(by neteler):

See also bug #1716

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/2041#comment:4&gt;
GRASS GIS <http://grass.osgeo.org>

#2041: wxgui: error attempting to display imported raster map that was imported as
three bands
-----------------------------------+----------------------------------------
Reporter: mlennert | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: wxGUI | Version: svn-trunk
Keywords: raster import display | Platform: Unspecified
      Cpu: Unspecified |
-----------------------------------+----------------------------------------

Comment(by wenzeslaus):

Please test the current trunk. See Martin's r64372 and r64371 and Anna's
r64570 (r64598).

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/2041#comment:5&gt;
GRASS GIS <http://grass.osgeo.org>

#2041: wxgui: error attempting to display imported raster map that was imported as
three bands
--------------------------+-------------------------------------------------
  Reporter: mlennert | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: normal | Milestone: 7.0.0
Component: wxGUI | Version: svn-trunk
Resolution: fixed | Keywords: raster import display
  Platform: Unspecified | Cpu: Unspecified
--------------------------+-------------------------------------------------
Changes (by mlennert):

  * status: new => closed
  * resolution: => fixed

Comment:

Replying to [comment:5 wenzeslaus]:
> Please test the current trunk. See Martin's r64372 and r64371 and Anna's
r64570 (r64598).

yes, this is fixed. Thank you for the reminder !

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/2041#comment:6&gt;
GRASS GIS <http://grass.osgeo.org>