R/write_vector_to_pgres.R
write_vector_to_pgres.Rd
write spatial table to a PostGIS db table (simple wrapper around
sf::st_write_db
with automatic casting to sf
objects and argument
checks)
write_vector_to_pgres(in_vect, con, table_name, schema = "public", make_valid = FALSE, drop = FALSE, update = FALSE, row.names = FALSE, verbose = TRUE)
in_vect | either an "sf" or "sp" R object, or the full path of a valid vector file |
---|---|
con | a |
table_name |
|
schema |
|
make_valid |
|
drop |
|
row.names |
|
drop |
|
The function is called for its side effects
# NOT RUN { # establish a connection with a postGIS DB con <- DBI::dbConnect(PostgreSQL(), host = "xx.xxx.xx.xx", dbname = "xxxxx", user = "xxxxx", password = "xxxxx", port = 5432) > con# write a vector object in a table of the DB write_vector_to_pgres(in_vect, con = con, table_name = "my_table", schema = "public", drop = TRUE) # }