spImportSpatial: Spatial - Imports a spatial vector layer to an S4 Spatial...

View source: R/spImportSpatial.R

spImportSpatialR Documentation

Spatial - Imports a spatial vector layer to an S4 Spatial object.

Description

Imports a spatial vector layer to an S4 Spatial object.

Usage

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(s)

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"))

FIESTA documentation built on Nov. 22, 2023, 1:07 a.m.