[GRASS-dev] Difficulties on accessing a CELL type raster- C rotine
Glynn Clements
glynn at gclements.plus.com
Tue Oct 19 07:41:26 EDT 2010
Pedro Roma wrote:
> For pixels where my training_map is null(), according to map display pixel
> query, if I print that value using: c = ((CELL *) inrast)[col]; I get
> -2147483648 instead of null() or something.
> Is this expected?
Yes; that is the value used to represent integer nulls.
To test whether a value is null, use one of:
int G_is_null_value(const void *, RASTER_MAP_TYPE);
int G_is_c_null_value(const CELL *);
int G_is_f_null_value(const FCELL *);
int G_is_d_null_value(const DCELL *);
[In 7.0, these functions have been moved to the raster library, and
have "Rast_" as the prefix rather than "G_".]
In general, you can't test for nulls using "==" as the value used for
floating-point nulls is NaN, which isn't equal to itself.
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-dev
mailing list