8.6 Data Output

Writing geographic data allows you to convert from one format to another and to save newly created objects.

Considerations

  • speed of writing the output to storage
  • size of the output object
  • speed of re-reading the object later
  • data type (vector or raster)
  • object class (geoTIFF, SpatRaster, etc)
  • layer structure within the file object

write_sf() has an available parameter append = TRUE

there is also st_write(), with different default parameters

writeRaster() saves SpatRaster objects to storage, using FLT4S as the default data type, though this encoding be unecessarily large on some rasters

There are seven other raster data types with different min / max precisions

GeoTIFF files are written in terra, by default, with the LZW compression.

See the terra docs