Imports a spatial vector layer to an S4 Spatial object.

spImportSpatial(
  layer = NULL,
  dsn = NULL,
  sql = NULL,
  polyfix = FALSE,
  gui = FALSE
)

Arguments

layer

Data frame object or String. Name of spatial layer. Can be layer with dsn, full pathname, including extension, or file name (with extension) in xy_dsn folder.

dsn

String. Name of database where layer is. The dsn varies by driver. See gdal OGR vector formats (https://www.gdal.org/ogr_formats.html).

sql

String. A sql syntax query to subset spatial layer.

polyfix

Logical. If polyfix=TRUE, uses buffer with 0 width to clean up polygons.

gui

Logical. If TRUE, search for layer within dsn.

Value

A spatial object

Note

Wrapper for sf package... st_read function.

Author

Tracey S. Frescino

Examples

# Import data from `FIESTA`, save as object in environment
WYbh <- spImportSpatial(system.file("extdata",
                                    "sp_data/WYbighorn_adminbnd.shp",
                                    package = "FIESTA"))