GRASS GIS 7 Programmer's Manual  7.7.svn(2018)-r73570
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
sample.c File Reference

Raster library - Sampling methods (extract a cell value from raster map) More...

#include <string.h>
#include <unistd.h>
#include <math.h>
#include <grass/gis.h>
#include <grass/raster.h>
#include <grass/glocale.h>
Include dependency graph for sample.c:

Go to the source code of this file.

Functions

DCELL Rast_get_sample (int fd, const struct Cell_head *window, struct Categories *cats, double north, double east, int usedesc, INTERP_TYPE itype)
 Extract a cell value from raster map. More...
 
DCELL Rast_get_sample_nearest (int fd, const struct Cell_head *window, struct Categories *cats, double north, double east, int usedesc)
 Extract a cell value from raster map (neighbor interpolation) More...
 
DCELL Rast_get_sample_bilinear (int fd, const struct Cell_head *window, struct Categories *cats, double north, double east, int usedesc)
 Extract a cell value from raster map (bilinear interpolation). More...
 
DCELL Rast_get_sample_cubic (int fd, const struct Cell_head *window, struct Categories *cats, double north, double east, int usedesc)
 Extract a cell value from raster map (cubic interpolation). More...
 

Detailed Description

Raster library - Sampling methods (extract a cell value from raster map)

1/2006: moved to libgis from v.sample/v.drape for clone removal

(C) 2001-2009 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.

Author
James Darrell McCauley <darrell mccauley-usa.com>, http://mccauley-usa.com/

Definition in file sample.c.

Function Documentation

DCELL Rast_get_sample ( int  fd,
const struct Cell_head window,
struct Categories cats,
double  north,
double  east,
int  usedesc,
INTERP_TYPE  itype 
)

Extract a cell value from raster map.

Extract a cell value from raster map at given northing and easting with a sampled 3x3 window using a specified interpolation method.

  • NEAREST neighbor interpolation
  • BILINEAR bilinear interpolation
  • CUBIC cubic interpolation
Parameters
fdfile descriptor
windowregion settings
catscategories
northnorthing position
easteasting position
usedescflag to scan category label
itypeinterpolation method
Returns
cell value at given position

Definition at line 48 of file sample.c.

References _, G_fatal_error(), INTERP_BICUBIC, INTERP_BILINEAR, INTERP_NEAREST, Rast_get_sample_bilinear(), Rast_get_sample_cubic(), and Rast_get_sample_nearest().

DCELL Rast_get_sample_bilinear ( int  fd,
const struct Cell_head window,
struct Categories cats,
double  north,
double  east,
int  usedesc 
)

Extract a cell value from raster map (bilinear interpolation).

Extract a cell value from raster map at given northing and easting with a sampled 3x3 window using a bilinear interpolation.

Parameters
fdfile descriptor
windowregion settings
catscategories
northnorthing position
easteasting position
usedescflag to scan category label
Returns
cell value at given position

Definition at line 148 of file sample.c.

References G_free(), G_squeeze(), int, Rast_allocate_d_buf(), Rast_easting_to_col(), Rast_get_c_cat(), Rast_get_d_row(), Rast_interp_bilinear(), Rast_is_d_null_value(), Rast_northing_to_row(), Rast_set_d_null_value(), Rast_window_cols(), and Rast_window_rows().

Referenced by Rast_get_sample().

DCELL Rast_get_sample_cubic ( int  fd,
const struct Cell_head window,
struct Categories cats,
double  north,
double  east,
int  usedesc 
)

Extract a cell value from raster map (cubic interpolation).

Extract a cell value from raster map at given northing and easting with a sampled 3x3 window using a cubic interpolation.

Parameters
fdfile descriptor
windowregion settings
catscategories
northnorthing position
easteasting position
usedescflag to scan category label
Returns
cell value at given position

Definition at line 238 of file sample.c.

References G_free(), G_squeeze(), int, Rast_allocate_d_buf(), Rast_easting_to_col(), Rast_get_c_cat(), Rast_get_d_row(), Rast_interp_bicubic(), Rast_is_d_null_value(), Rast_northing_to_row(), Rast_set_d_null_value(), Rast_window_cols(), and Rast_window_rows().

Referenced by Rast_get_sample().

DCELL Rast_get_sample_nearest ( int  fd,
const struct Cell_head window,
struct Categories cats,
double  north,
double  east,
int  usedesc 
)

Extract a cell value from raster map (neighbor interpolation)

Extract a cell value from raster map at given northing and easting with a sampled 3x3 window using a neighbor interpolation.

Parameters
fdfile descriptor
windowregion settings
catscategories
northnorthing position
easteasting position
usedescflag to scan category label
Returns
cell value at given position

Definition at line 91 of file sample.c.

References G_free(), G_squeeze(), int, Rast_allocate_d_buf(), Rast_easting_to_col(), Rast_get_c_cat(), Rast_get_d_row(), Rast_is_d_null_value(), Rast_northing_to_row(), Rast_set_d_null_value(), Rast_window_cols(), and Rast_window_rows().

Referenced by Rast_get_sample().