rsaga.grid.to.points: Convert SAGA grid file to point shapefile

View source: R/RSAGA-modules.R

rsaga.grid.to.pointsR 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: .shp). Existing files will be overwritten!

in.clip.polygons

optional polygon shapefile to be used for clipping/masking an area

exclude.nodata

logical (default: TRUE): skip 'nodata' grid cells?

type

character string: "nodes": create point shapefile of grid center points; "cells" (only supported by SAGA GIS 2.0.6+): create polygon shapefile with grid cell boundaries

env

RSAGA geoprocessing environment created by rsaga.env(); required by rsaga.grid.to.points to determine version-dependent SAGA module name and arguments

...

Optional arguments to be passed to rsaga.geoprocessor()

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

Note

These functions use modules Grid Values to Points (in some versions also called 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).

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)

RSAGA documentation built on Dec. 10, 2022, 1:12 a.m.