GRASS GIS 7 Programmer's Manual  7.9.dev(2021)-e5379bbd7
region.c File Reference
#include <stdio.h>
#include <math.h>
#include <grass/raster.h>
#include "raster3d_intern.h"
Include dependency graph for region.c:

Go to the source code of this file.

Functions

void Rast3d_extract2d_region (RASTER3D_Region *region3d, struct Cell_head *region2d)
 Returns in region2d the 2d portion of region3d. More...
 
void Rast3d_region_to_cell_head (RASTER3D_Region *region3d, struct Cell_head *region2d)
 Returns in region2d the 2d portion of region3d. More...
 
void Rast3d_incorporate2d_region (struct Cell_head *region2d, RASTER3D_Region *region3d)
 Replaces the 2d portion of region3d with the values stored in region2d. More...
 
void Rast3d_region_from_to_cell_head (struct Cell_head *region2d, RASTER3D_Region *region3d)
 Replaces the 2d portion of region3d with the values stored in region2d. More...
 
void Rast3d_adjust_region (RASTER3D_Region *region)
 Computes an adjusts the resolutions in the region structure from the region boundaries and number of cells per dimension. More...
 
void Rast3d_adjust_region_res (RASTER3D_Region *region)
 Computes an adjusts the number of cells per dimension in the region structure from the region boundaries and resolutions. More...
 
void Rast3d_region_copy (RASTER3D_Region *regionDest, RASTER3D_Region *regionSrc)
 Copies the values of regionSrc into regionDst. More...
 
int Rast3d_read_region_map (const char *name, const char *mapset, RASTER3D_Region *region)
 
int Rast3d_is_valid_location (RASTER3D_Region *region, double north, double east, double top)
 Returns 1 if region-coordinates (north, east, top) are inside the region of map. Returns 0 otherwise. More...
 
void Rast3d_location2coord (RASTER3D_Region *region, double north, double east, double top, int *x, int *y, int *z)
 Converts region-coordinates (north, east, top) into cell-coordinates (x, y, z). More...
 
void Rast3d_location2coord_double (RASTER3D_Region *region, double north, double east, double top, double *x, double *y, double *z)
 Converts region-coordinates (north, east, top) into cell-coordinates (x, y, z). More...
 
void Rast3d_location2coord2 (RASTER3D_Region *region, double north, double east, double top, int *x, int *y, int *z)
 Converts region-coordinates (north, east, top) into cell-coordinates (x, y, z). This function calls Rast3d_fatal_error in case location is not in window. More...
 
void Rast3d_coord2location (RASTER3D_Region *region, double x, double y, double z, double *north, double *east, double *top)
 Converts cell-coordinates (x, y, z) into region-coordinates (north, east, top). More...
 

Function Documentation

◆ Rast3d_adjust_region()

void Rast3d_adjust_region ( RASTER3D_Region region)

Computes an adjusts the resolutions in the region structure from the region boundaries and number of cells per dimension.

Parameters
region
Returns
void

Definition at line 151 of file region.c.

◆ Rast3d_adjust_region_res()

void Rast3d_adjust_region_res ( RASTER3D_Region region)

Computes an adjusts the number of cells per dimension in the region structure from the region boundaries and resolutions.

Parameters
region
Returns
void

Definition at line 177 of file region.c.

◆ Rast3d_coord2location()

void Rast3d_coord2location ( RASTER3D_Region region,
double  x,
double  y,
double  z,
double *  north,
double *  east,
double *  top 
)

Converts cell-coordinates (x, y, z) into region-coordinates (north, east, top).

  • Note: x, y and z is a double:
  • x+0.0 will return the easting for the western edge of the column.
  • x+0.5 will return the easting for the center of the column.
  • x+1.0 will return the easting for the eastern edge of the column.
  • y+0.0 will return the northing for the northern edge of the row.
  • y+0.5 will return the northing for the center of the row.
  • y+1.0 will return the northing for the southern edge of the row.
  • z+0.0 will return the top for the lower edge of the depth.
  • z+0.5 will return the top for the center of the depth.
  • z+1.0 will return the top for the upper edge of the column.
Parameters
region
x
y
z
north
east
top
Returns
void

Definition at line 392 of file region.c.

◆ Rast3d_extract2d_region()

◆ Rast3d_incorporate2d_region()

void Rast3d_incorporate2d_region ( struct Cell_head region2d,
RASTER3D_Region region3d 
)

◆ Rast3d_is_valid_location()

int Rast3d_is_valid_location ( RASTER3D_Region region,
double  north,
double  east,
double  top 
)

Returns 1 if region-coordinates (north, east, top) are inside the region of map. Returns 0 otherwise.

Parameters
region
north
east
top
Returns
int

Definition at line 263 of file region.c.

◆ Rast3d_location2coord()

void Rast3d_location2coord ( RASTER3D_Region region,
double  north,
double  east,
double  top,
int *  x,
int *  y,
int *  z 
)

Converts region-coordinates (north, east, top) into cell-coordinates (x, y, z).

Parameters
region
north
east
top
x
y
z
Returns
void

Definition at line 290 of file region.c.

◆ Rast3d_location2coord2()

void Rast3d_location2coord2 ( RASTER3D_Region region,
double  north,
double  east,
double  top,
int *  x,
int *  y,
int *  z 
)

Converts region-coordinates (north, east, top) into cell-coordinates (x, y, z). This function calls Rast3d_fatal_error in case location is not in window.

Parameters
region
north
east
top
x
y
z
Returns
void

Definition at line 347 of file region.c.

◆ Rast3d_location2coord_double()

void Rast3d_location2coord_double ( RASTER3D_Region region,
double  north,
double  east,
double  top,
double *  x,
double *  y,
double *  z 
)

Converts region-coordinates (north, east, top) into cell-coordinates (x, y, z).

Note: The results are double numbers. Casting them to int will give the column, row and depth number.

Parameters
region
north
east
top
x
y
z
Returns
void

Definition at line 321 of file region.c.

◆ Rast3d_read_region_map()

int Rast3d_read_region_map ( const char *  name,
const char *  mapset,
RASTER3D_Region region 
)

Definition at line 232 of file region.c.

◆ Rast3d_region_copy()

◆ Rast3d_region_from_to_cell_head()

◆ Rast3d_region_to_cell_head()