Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # example of reading regular data table from Postgres using RPostgresSQL library
- library(RPostgreSQL)
- con <- dbConnect(PostgreSQL(), host="localhost", port="5432", user="username", password="password", dbname="db_name")
- result <- dbGetQuery(con, statement = "SELECT * FROM table1, table2 WHERE table1.key = table2.key")
- head(result)
- library(rpostgis)
- conn <- dbConnect(PostgreSQL(), host="localhost", port="5432", user="postgres", password="postgres", dbname="sp_db")
- dbSchema(conn, name = 'sp_db')
- dbTableInfo(conn, "sp_table")
- my_spdf<-pgGetGeom(conn, name="sp_table", geom = "wkb_geometry")
- head(my_spdf@data)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement