read_vect: read a vector spatial file to R

Description Usage Arguments Details Value See Also Examples

View source: R/read_vect.R

Description

function for easily opening a ESRI shapefile (or other OGR compatible vector file) by simply specifying its filename

Usage

1
read_vect(shp_file, as_sp = FALSE, ...)

Arguments

shp_file

character Filename of ESRI shapefile to be opened

as_sp

logical If TRUE, the opened object is automatically converted to sp format. Otherwise, an sf object is returned. Default: FALSE

...

other arguments to be passed tosf::st_read

Details

simple wrapper around sf::read_sf, with some checks on inputs and possibility of automatic re-casting to *sp objects

Value

sf or sp object (depending on as_sp setting)

See Also

read_sf

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 
library(sprawl.data)
# open a shapefile as a `sf` object
 shp_file = system.file("extdata","lc_polys.shp", package = "sprawl.data")
 read_vect(shp_file)

# open a shapefile as a `sp` object
 shp_file = system.file("extdata","lc_polys.shp", package = "sprawl.data")
 read_vect(shp_file, as_sp = TRUE)

## End(Not run)

IREA-CNR-MI/sprawl documentation built on May 27, 2019, 1:12 p.m.