Learn R Programming

RSAGA (version 1.4.0)

rsaga.grid.to.points: 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

Author

Alexander Brenning (R interface), Olaf Conrad (SAGA modules)

See Also

rsaga.add.grid.values.to.points()

Examples

Run this code
if (FALSE) {
# 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)
}

Run the code above in your browser using DataLab