GIS library - get raster row. More...
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <rpc/types.h>
#include <rpc/xdr.h>
#include <grass/config.h>
#include <grass/glocale.h>
#include "G.h"
Go to the source code of this file.
Defines | |
#define | NULL_FILE "null" |
Functions | |
int | G_get_map_row_nomask (int fd, CELL *buf, int row) |
Read raster row without masking (this routine is deprecated) | |
int | G_get_raster_row_nomask (int fd, void *buf, int row, RASTER_MAP_TYPE data_type) |
Read raster row without masking. | |
int | G_get_c_raster_row_nomask (int fd, CELL *buf, int row) |
Read raster row without masking (CELL type) | |
int | G_get_f_raster_row_nomask (int fd, FCELL *buf, int row) |
Read raster row without masking (FCELL type) | |
int | G_get_d_raster_row_nomask (int fd, DCELL *buf, int row) |
Read raster row without masking (DCELL type) | |
int | G_get_map_row (int fd, CELL *buf, int row) |
Get raster row (this routine is deprecated!) | |
int | G_get_raster_row (int fd, void *buf, int row, RASTER_MAP_TYPE data_type) |
Get raster row. | |
int | G_get_c_raster_row (int fd, CELL *buf, int row) |
Get raster row (CELL type) | |
int | G_get_f_raster_row (int fd, FCELL *buf, int row) |
Get raster row (FCELL type) | |
int | G_get_d_raster_row (int fd, DCELL *buf, int row) |
Get raster row (DCELL type) | |
int | G_get_null_value_row (int fd, char *flags, int row) |
Read or simmulate null value row. |
GIS library - get raster row.
(C) 2003-2008 by the GRASS Development Team
This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details.
Definition in file get_row.c.
int G_get_c_raster_row | ( | int | fd, |
CELL * | buf, | ||
int | row | ||
) |
Get raster row (CELL type)
Reads a row of raster data and leaves the NULL values intact. (As opposed to the deprecated function G_get_map_row() which converts NULL values to zero.)
NOTE. When the raster map is old and null file doesn't exist, it is assumed that all 0-cells are no-data. When map is floating point, uses quant rules set explicitly by G_set_quant_rules() or stored in map's quant file to convert floats to integers.
fd | file descriptor for the opened raster map |
buf | buffer for the row to be placed into |
row | data row desired |
Definition at line 923 of file get_row.c.
References G_get_raster_row().
int G_get_c_raster_row_nomask | ( | int | fd, |
CELL * | buf, | ||
int | row | ||
) |
Read raster row without masking (CELL type)
Same as G_get_c_raster_row() except no masking occurs.
fd | file descriptor for the opened raster map |
buf | buffer for the row to be placed into |
row | data row desired |
data_type | data type |
Definition at line 781 of file get_row.c.
References G_get_raster_row_nomask().
int G_get_d_raster_row | ( | int | fd, |
DCELL * | buf, | ||
int | row | ||
) |
Get raster row (DCELL type)
Same as G_get_f_raster_row() except that the array dcell is double
.
fd | file descriptor for the opened raster map |
buf | buffer for the row to be placed into |
row | data row desired |
Definition at line 966 of file get_row.c.
References G_get_raster_row().
Referenced by G_get_raster_sample_bilinear(), G_get_raster_sample_cubic(), and G_get_raster_sample_nearest().
int G_get_d_raster_row_nomask | ( | int | fd, |
DCELL * | buf, | ||
int | row | ||
) |
Read raster row without masking (DCELL type)
Same as G_get_d_raster_row() except no masking occurs.
fd | file descriptor for the opened raster map |
buf | buffer for the row to be placed into |
row | data row desired |
data_type | data type |
Definition at line 821 of file get_row.c.
References G_get_raster_row_nomask().
int G_get_f_raster_row | ( | int | fd, |
FCELL * | buf, | ||
int | row | ||
) |
Get raster row (FCELL type)
Read a row from the raster map open on fd into the float
array fcell performing type conversions as necessary based on the actual storage type of the map. Masking, resampling into the current region. NULL-values are always embedded in fcell
(never converted to a value).
fd | file descriptor for the opened raster map |
buf | buffer for the row to be placed into |
row | data row desired |
Definition at line 946 of file get_row.c.
References G_get_raster_row().
int G_get_f_raster_row_nomask | ( | int | fd, |
FCELL * | buf, | ||
int | row | ||
) |
Read raster row without masking (FCELL type)
Same as G_get_f_raster_row() except no masking occurs.
fd | file descriptor for the opened raster map |
buf | buffer for the row to be placed into |
row | data row desired |
data_type | data type |
Definition at line 801 of file get_row.c.
References G_get_raster_row_nomask().
int G_get_map_row | ( | int | fd, |
CELL * | buf, | ||
int | row | ||
) |
Get raster row (this routine is deprecated!)
If the map is floating-point, quantize the floating-point values to integer using the quantization rules established for the map when the map was opened for reading (this quantization is read from cell_misc/name/f_quant file, but can be reset after opening raster map by G_set_quant_rules()). NULL values are converted to zeros.
This routine is deprecated! Use G_get_raster_row() instead.
fd | file descriptor for the opened raster map |
buf | buffer for the row to be placed into |
row | data row desired |
int G_get_map_row_nomask | ( | int | fd, |
CELL * | buf, | ||
int | row | ||
) |
Read raster row without masking (this routine is deprecated)
This routine reads the specified row from the raster map open on file descriptor fd into the buf buffer like G_get_map_row() does. The difference is that masking is suppressed. If the user has a mask set, G_get_map_row() will apply the mask but G_get_map_row_nomask() will ignore it. This routine prints a diagnostic message and returns -1 if there is an error reading the raster map. Otherwise a nonnegative value is returned.
Note. Ignoring the mask is not generally acceptable. Users expect the mask to be applied. However, in some cases ignoring the mask is justified. For example, the GRASS modules r.describe, which reads the raster map directly to report all data values in a raster map, and r.slope.aspect, which produces slope and aspect from elevation, ignore both the mask and the region. However, the number of GRASS modules which do this should be minimal. See Mask for more information about the mask.
This routine is deprecated! Use G_get_raster_row_nomask() instead.
fd | file descriptor for the opened raster map |
buf | buffer for the row to be placed into |
row | data row desired |
int G_get_null_value_row | ( | int | fd, |
char * | flags, | ||
int | row | ||
) |
Read or simmulate null value row.
Read or simmulate null value row and set the cells corresponding to null value to 1. The masked out cells are set to null when the mask exists. (the MASK is taken care of by null values (if the null file doesn't exist for this map, then the null row is simulated by assuming that all zeros in raster map are nulls. Also all masked out cells become nulls.
fd | file descriptor for the opened map |
buf | buffer for the row to be placed into |
row | data row desired |
int G_get_raster_row | ( | int | fd, |
void * | buf, | ||
int | row, | ||
RASTER_MAP_TYPE | data_type | ||
) |
Get raster row.
If data_type is
Reads appropriate information into the buffer buf associated with the requested row row. buf is associated with the current window.
Note, that the type of the data in buf (say X) is independent of the type of the data in the file described by fd (say Y).
fd | file descriptor for the opened raster map |
buf | buffer for the row to be placed into |
row | data row desired |
data_type | data type |
Definition at line 896 of file get_row.c.
Referenced by G_get_c_raster_row(), G_get_d_raster_row(), G_get_f_raster_row(), and G_get_raster_row_colors().
int G_get_raster_row_nomask | ( | int | fd, |
void * | buf, | ||
int | row, | ||
RASTER_MAP_TYPE | data_type | ||
) |
Read raster row without masking.
Same as G_get_raster_row() except no masking occurs.
fd | file descriptor for the opened raster map |
buf | buffer for the row to be placed into |
row | data row desired |
data_type | data type |
Definition at line 760 of file get_row.c.
Referenced by G_get_c_raster_row_nomask(), G_get_d_raster_row_nomask(), and G_get_f_raster_row_nomask().