if (Sys.getenv("USER") %in% c("edzer", "travis")) { # load meuse to postgis
library(sp)
example(meuse, ask = FALSE, echo = FALSE)
st_write(st_as_sf(meuse), "PG:dbname=postgis", "meuse_sf", driver = "PostgreSQL",
layer_options = c("OVERWRITE=yes", "LAUNDER=true"))
demo(nc, ask = FALSE)
st_write(nc, "PG:dbname=postgis", "sids", driver = "PostgreSQL",
layer_options = "OVERWRITE=true")
}
nc = st_read(system.file("shape/nc.shp", package="sf"), "nc", crs = 4267)
st_write(nc, ".", "nc")
Run the code above in your browser using DataLab