spExportSpatial {FIESTA} | R Documentation |
Exports an sf object to a specified output.
spExportSpatial(sfobj, savedata_opts = NULL)
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'. |
Wrapper for sf::st_write function.
An sf spatial object is written to outfolder.
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.
Tracey S. Frescino
# 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))