Exports an sf object to a specified output.
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.
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))
#> writing to shapefile
#> Writing layer `outdat' to data source
#> `/tmp/RtmpouP0Eg/outdat.shp' using driver `ESRI Shapefile'
#> Writing 1 features with 11 fields and geometry type Polygon.