Skip to main content
update
Source Link
mdag02
  • 306
  • 2
  • 4

Edit :

As of 2021, the preferred solution would be to use the {sf} package, even when using {sp} classes :

library(sf)
library(RPostgres)

con <- dbConnect(Postgres(), user = "PG_USER", password = "PG_PASS", host = "192.0.2.0",dbname = "dbname")
st_write(st_as_sf(my_layer), con, Id(schema = "public", table = "my_layer"))

Former answer :

The package PostGIStools can help. See for example the vignette.

Another way could be to transform your Spatial*DataFrame geometry to WKT, insert into PostGIS using the classic RPostgreSQL package and re-create the geom there.

The package PostGIStools can help. See for example the vignette.

Another way could be to transform your Spatial*DataFrame geometry to WKT, insert into PostGIS using the classic RPostgreSQL package and re-create the geom there.

Edit :

As of 2021, the preferred solution would be to use the {sf} package, even when using {sp} classes :

library(sf)
library(RPostgres)

con <- dbConnect(Postgres(), user = "PG_USER", password = "PG_PASS", host = "192.0.2.0",dbname = "dbname")
st_write(st_as_sf(my_layer), con, Id(schema = "public", table = "my_layer"))

Former answer :

The package PostGIStools can help. See for example the vignette.

Another way could be to transform your Spatial*DataFrame geometry to WKT, insert into PostGIS using the classic RPostgreSQL package and re-create the geom there.

Source Link
mdag02
  • 306
  • 2
  • 4

The package PostGIStools can help. See for example the vignette.

Another way could be to transform your Spatial*DataFrame geometry to WKT, insert into PostGIS using the classic RPostgreSQL package and re-create the geom there.