Skip to content

Commit

Permalink
handle better null values
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@12924 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
rblazek committed Feb 11, 2010
1 parent 389cbb4 commit 8bc36d6
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/providers/grass/qgis.g.info.c
Expand Up @@ -108,6 +108,8 @@ int main( int argc, char **argv )
rast_type = G_get_raster_map_type( fd );
cell = G_allocate_c_raster_buf();
dcell = G_allocate_d_raster_buf();
void *ptr;
double val;

if ( rast_type == CELL_TYPE )
{
Expand All @@ -116,7 +118,8 @@ int main( int argc, char **argv )
G_fatal_error(( "Unable to read raster map <%s> row %d" ),
rast_opt->answer, row );
}
fprintf( stdout, "value:%d\n", cell[col] );
val = cell[col];
ptr = &(cell[col]);
}
else
{
Expand All @@ -125,7 +128,16 @@ int main( int argc, char **argv )
G_fatal_error(( "Unable to read raster map <%s> row %d" ),
rast_opt->answer, row );
}
fprintf( stdout, "value:%f\n", dcell[col] );
val = dcell[col];
ptr = &(dcell[col]);
}
if ( G_is_null_value( ptr, rast_type ) )
{
fprintf( stdout, "value:null\n" );
}
else
{
fprintf( stdout, "value:%f\n", val );
}
}
G_close_cell( fd );
Expand Down

0 comments on commit 8bc36d6

Please sign in to comment.