readFeatureLayer: Create a sf dataframe from a (vector) feature layer

View source: R/readFeatureLayer.R

readFeatureLayerR Documentation

Create a sf dataframe from a (vector) feature layer

Description

This function reads a (vector) feature layer from a dsn and creates a simple features dataframe (using package sf).

Usage

readFeatureLayer(dsn, layer, drivers = character(0), crs = NULL)

Arguments

dsn

-data source name (interpretation varies by driver)

layer
  • feature layer to read (interpretation varies by driver)

drivers
  • RGDAL drivers to use to read feature class (limited set of short names of drivers to try; default is to try all)

crs
  • a sf::crs object, EPSG code, or string describing the output coordinate reference system (or NULL to keep the original)

Details

The function uses sf::st_read to read the feature layer from the dsn. If crs is NULL, the coordinate reference system for the layer is unchanged. to it.

If the layer did not have a coordinate reference system originally associated with it, then crs is used to set the sf object's coordinate reference system.

If the layer has a coordinate reference system associated with it, wtsGIS::transformCRS is used to transform/project the sf object to that represented by crs

Value

a sf::sf data.frame.


wStockhausen/wtsGIS documentation built on Aug. 23, 2023, 2:31 a.m.