[GRASS-user] Re: [GRASS-dev] gdal import an nodata cells

Hamish hamish_nospam at yahoo.com
Thu Jul 19 21:08:12 EDT 2007


> Carlos "Guâno" Grohmann wrote:
> > I just imported a DEM that was sent to to in Erdas IMG format (HFA),
> > with r.in.gdal, and after importing I had to use r.mapcalc to make
> > the NODATA cells -- which were tagged as -32768 -- became NULL.
> > 
> > I was just wondering if there is a way to do this automatically? can
> > I pass the -32768 value as an option to r.in.gdal so the cell will
> > be imported as null?

Frank Warmerdam wrote:
> I don't see any options to provide a nodata on the r.in.gdal
> commandline, but r.in.gdal will set pixels to null if GDAL "knows" the
> nodata value for the source dataset.  Nodata support does exist now in
> the HFA (.img) driver but I think it was recently introduced.  It is
> also possible that the nodata value wasn't properly marked in the
> source .img file.
> 
> A commandline argument for this could be added to r.in.gdal, but given
> the relative ease of fixing it up with r.mapcalc, I'm not sure it
> would be worth the complication.


see also r.out.gdal's createopt= option and gdal_translate's -a_nodata
option for setting the no data value.

does gdalinfo show the nodata value? (I'm not sure if it should or not)


Hamish




More information about the grass-user mailing list