[GRASS-dev] r.in.gdal: Ignores `band' parameter

  It seems that `r.in.gdal' ignores the `band' parameter -- the
  resulting raster is the same whatever band number is specified.

...
   378 /* -------------------------------------------------------------------- */
   379 /* Simple case. Import a single band as a raster cell. */
   380 /* -------------------------------------------------------------------- */
   381 if( !force_imagery )
   382 {
   383 int nBand = 1;
   384
   385 if( parm.band->answer != NULL )
   386 nBand = atoi(parm.band->answer);
   387
   388 hBand = GDALGetRasterBand(hDS,1);

  Shouldn't there be s/1/nBand/ instead?

   389 if( hBand == NULL )
   390 {
   391 sprintf( error_msg, _("Selected band (%d) does not exist.\n"),
   392 nBand );
   393 G_fatal_error( error_msg );
   394 }
   395
   396 ImportBand( hBand, output, NULL );
   397
   398 if (title)
   399 G_put_cell_title (output, title);
   400 }
...

Hi Ivan,

fixed in SVN [1], untested.

Regards,

Martin

[1] http://trac.osgeo.org/grass/changeset/29513

2007/12/26, Ivan Shmakov <ivan@theory.asu.ru>:

        It seems that `r.in.gdal' ignores the `band' parameter -- the
        resulting raster is the same whatever band number is specified.

...
   378 /* -------------------------------------------------------------------- */
   379 /* Simple case. Import a single band as a raster cell. */
   380 /* -------------------------------------------------------------------- */
   381 if( !force_imagery )
   382 {
   383 int nBand = 1;
   384
   385 if( parm.band->answer != NULL )
   386 nBand = atoi(parm.band->answer);
   387
   388 hBand = GDALGetRasterBand(hDS,1);

        Shouldn't there be s/1/nBand/ instead?

   389 if( hBand == NULL )
   390 {
   391 sprintf( error_msg, _("Selected band (%d) does not exist.\n"),
   392 nBand );
   393 G_fatal_error( error_msg );
   394 }
   395
   396 ImportBand( hBand, output, NULL );
   397
   398 if (title)
   399 G_put_cell_title (output, title);
   400 }
...

_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

--
Martin Landa <landa.martin@gmail.com> * http://gama.fsv.cvut.cz/~landa *