spExportSpatial: Spatial - Exports an sf object.

View source: R/spExportSpatial.R

spExportSpatialR Documentation

Spatial - Exports an sf object.

Description

Exports an sf object to a specified output.

Usage

spExportSpatial(sfobj, savedata_opts = NULL)

Arguments

sfobj

sf class R object. Spatial object to export.

savedata_opts

List. See help(savedata_options()) for a list of options for saving data. If out_layer = NULL, default = 'datsp'.

Details

Wrapper for sf::st_write function.

Value

An sf spatial object is written to outfolder.

Note

If out_fmt='shp':
The ESRI shapefile driver truncates variable names to 10 characters or less. Variable names are changed before export using an internal function (trunc10shp). Name changes are output to the outfolder, 'out_layer'_newnames.csv.

If sf object has more than 1 record, it cannot be exported to a shapefile.

Author(s)

Tracey S. Frescino

Examples

# Set up data from FIESTA
WYbh <- spImportSpatial(system.file("extdata",
                                    "sp_data/WYbighorn_adminbnd.shp",
                                    package = "FIESTA"))

# Export data with spExportSpatial
spExportSpatial(WYbh,
                savedata_opts = list(out_dsn = "WYbh.shp", 
                                     outfolder = tempdir(), 
                                     overwrite_dsn = TRUE))

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