The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
The rpostgis
package provides an interface between R and
PostGIS
-enabled PostgreSQL
databases
to transparently transfer spatial data. Both vector (points, lines,
polygons) and raster data are supported in read and write modes. Also
provides convenience functions to execute common procedures in
PostgreSQL
/PostGIS
.
You can install the latest released version from CRAN:
::pak("rpostgis") pak
A stable version of the package is always available on the project’s GitHub page, and may be ahead of the CRAN version. To install it, use the following command:
::pak("Cidree/rpostgis") pak
For the latest (possibly unstable) development version, use:
::install_github("Cidree/rpostgis", ref = "dev") remotes
rpostgis
relies on a working connection provided by the
RPostgreSQL
package to a PostgreSQL database, e.g.:
<- RPostgreSQL::dbConnect(
conn drv = "PostgreSQL",
host = "localhost",
dbname = "<DB_NAME>",
user = "<USER>",
password = "<PASSWORD>"
)
Note: as of
rpostgis 1.4.3
theRPostgres::Postgres()
driver is also allowed for connection objects; however, this should be considered experimental and is not recommended for most use cases.
Once the connection is established, the first step is to check if the
database has PostGIS
already installed (and install it if
it’s not the case):
pgPostGIS(conn)
If the function returns TRUE
, the database is ready and
functional. You can check the geometries and rasters present in the
database with:
pgListGeom(conn, geog = TRUE)
pgListRast(conn)
To terminate the session, close and clear the connection with:
::dbDisconnect(conn) RPostgreSQL
Full documentation with the complete list of functions of the package
can be found on rpostgis
homepage.
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.