R/spImportSpatial.R
spImportSpatial.Rd
Imports a spatial vector layer to an S4 Spatial object.
spImportSpatial(
layer = NULL,
dsn = NULL,
sql = NULL,
polyfix = FALSE,
gui = FALSE
)
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.
String. Name of database where layer is. The dsn varies by driver. See gdal OGR vector formats (https://www.gdal.org/ogr_formats.html).
String. A sql syntax query to subset spatial layer.
Logical. If polyfix=TRUE, uses buffer with 0 width to clean up polygons.
Logical. If TRUE, search for layer within dsn.
A spatial object
Wrapper for sf package... st_read function.
# Import data from `FIESTA`, save as object in environment
WYbh <- spImportSpatial(system.file("extdata",
"sp_data/WYbighorn_adminbnd.shp",
package = "FIESTA"))