Thin wrapper around sf::st_write() that writes an sf object to a GeoPackage (.gpkg) at the supplied destination path, overwriting any existing layer.

save_gpkg(obj, dst)

Arguments

obj

An sf object to write.

dst

Character. Full destination path (including file name and extension) to write to.

Value

Invisibly returns dst, the destination path written to.

Examples

pts <- sf::st_sf(
  id = 1:2,
  geometry = sf::st_sfc(sf::st_point(c(0, 0)), sf::st_point(c(1, 1)), crs = 4326)
)
dst <- tempfile(fileext = ".gpkg")
save_gpkg(pts, dst)