import_vector_data: Import vector data into GRASS.

View source: R/import_data.R

import_vector_dataR Documentation

Import vector data into GRASS.

Description

Generic function to import vector data of various formats into the GRASS environment.

Usage

import_vector_data(data, name, layer = NULL, proj_ref_obj = NULL, snap = -1)

Arguments

data

character string or object; path to data vector file (shape), postgis data source name (dsn; see details), or sp or sf data object.

name

string giving the base name of the vector data within the GRASS environment (i.e. output)

layer

character string; default 1, particularly needed if data is a dsn for importing postgis data (see details)

proj_ref_obj

character; path to a georeferenced data file to be used as reference; only used if data is an sf of sp object, then, the two projections are compared to check if on-the-fly reprojection is needed for importing; typically the dem raster file used in this project.

snap

float; snapping threshold in map units. If != -1 (default) vertices are snapped to other vertices in this snapping distance during import. If used, the features are automatically cleaned afterwards (see GRASS tools v.import and v.clean )

Details

For importing data from Postgis, all data base credentials must be supplied in data and the correct layer and, if the table containing the polygons are in a specific schema also that one (see example)

Value

Nothing.

Author(s)

Mira Kattwinkel, mira.kattwinkel@gmx.net

Examples

# import data from Postgis
## Not run: 
import_vector_data(data = "PG: 'pgname=postgit_DB', 'host=123.45.67.890', 
'port='1234', 'user=username', 'password=password'",
 name = "forest", layer = "landuse_schema.forest")

## End(Not run)


MiKatt/openSTARS documentation built on June 17, 2022, 5:08 a.m.