readShapefile: Create a sf dataframe object from an ESRI shapefile

View source: R/readShapefile.R

readShapefileR Documentation

Create a sf dataframe object from an ESRI shapefile

Description

This function reads a shapefile and creates a sf spatial dataframe object.

Usage

readShapefile(file, crs = NULL)

Arguments

file
  • shapefile to read

crs
  • an 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 shapefile. If crs is NULL, the coordinate reference system for the shapefile is unchanged.

If the shapefile 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 shapefile has a coordinate reference system associated with it, 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.