Learn R Programming

sf (version 0.2-2)

st_write_db: write simple feature table to a spatial database

Description

write simple feature table to a spatial database

Usage

st_write_db(conn = NULL, obj, table = substitute(obj), geom_name = "wkb_geometry", ..., dropTable = FALSE, binary = TRUE)

Arguments

conn
open database connection
obj
object of class sf
table
name for the table in the database
geom_name
name of the geometry column in the database
...
arguments passed on to dbWriteTable
dropTable
logical; should table be dropped first?
binary
logical; use well-known-binary for transfer?

Examples

Run this code
if (Sys.getenv("USER") %in% c("travis", "edzer")) {
  library(sp)
  data(meuse)
  sf = st_as_sf(meuse, coords = c("x", "y"), crs = 28992)
  library(RPostgreSQL)
  conn = dbConnect(PostgreSQL(), dbname = "postgis")
  st_write_db(conn, sf, "meuse_tbl", dropTable = FALSE)
}

Run the code above in your browser using DataLab