rsaga.grid.to.points {RSAGA} | R Documentation |
Convert SAGA grid file to point shapefile
Description
Convert SAGA grid file to point (or polygon) shapefile - either completely or only a random sample of grid cells.
Usage
rsaga.grid.to.points(
in.grids,
out.shapefile,
in.clip.polygons,
exclude.nodata = TRUE,
type = "nodes",
env = rsaga.env(),
...
)
rsaga.grid.to.points.randomly(in.grid, out.shapefile, freq, ...)
Arguments
in.grids |
Input: names of (possibly several) SAGA GIS grid files to be converted into a point shapefile. |
out.shapefile |
Output: point shapefile (default extension: |
in.clip.polygons |
optional polygon shapefile to be used for clipping/masking an area |
exclude.nodata |
logical (default: |
type |
character string: |
env |
RSAGA geoprocessing environment created by |
... |
Optional arguments to be passed to |
in.grid |
Input: SAGA grid file from which to sample. |
freq |
integer >=1: sampling frequency: on average 1 out of 'freq' grid cells are selected |
Value
The type of object returned depends on the intern
argument passed to the rsaga.geoprocessor()
. For intern=FALSE
it is a numerical error code (0: success), or otherwise (default) a character vector with the module's console output.
Note
These functions use modules Grid Cells to Points/Polygons
(previously called Grid Values to Points
and in some earlier versions Grid Values to Shapes
) and Grid Values to Points (randomly)
in SAGA library shapes_grid
.
The SAGA 2.0.6+ version of this module is more flexible as it allows to create grid cell polygons instead of center points (see argument type
).
Since somewhere between SAGA 9.0.0 and 9.3.3, the NODATA
argument is numeric with values of 0: include all cells, 1: include cell if at least one grid provides data, and 2: exclude cell if at least one grid does not provide data. From 9.3.0 up, exclude.nodata=TRUE
is interpreted as (and converted to) 1
.
Author(s)
Alexander Brenning (R interface), Olaf Conrad (SAGA modules)
See Also
rsaga.add.grid.values.to.points()
Examples
## Not run:
# one point per grid cell, exclude nodata areas:
rsaga.grid.to.points("dem", "dempoints")
# take only every 20th point, but to not exclude nodata areas:
rsaga.grid.to.points.randomly("dem", "dempoints20", freq = 20)
## End(Not run)