Giter Site home page Giter Site logo

rpostgis's Introduction

rpostgis

CRAN Status Project Status: Active- The project has reached a stable
state. Total Downloads Last Month Downloads.

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.

Installation of the released versions

You can install the latest released version from CRAN:

install.packages("rpostgis")

You can then use update.packages() to update to the latest CRAN version.

Installation of the development versions

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 remotes:

remotes::install_github("Cidree/rpostgis")

For the latest (possibly unstable) development version, use:

remotes::install_github("Cidree/rpostgis", ref = "dev")

Getting started

rpostgis relies on a working connection provided by the RPostgreSQL package to a PostgreSQL database, e.g.:

conn <- RPostgreSQL::dbConnect("PostgreSQL", host = "localhost",
    dbname = "<DB_NAME>", user = "<USER>", password = "<PASSWORD>")

Note: as of rpostgis 1.4.3 the RPostgres::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:

RPostgreSQL::dbDisconnect(conn)

Documentation

Full documentation with the complete list of functions of the package can be found on rpostgis homepage.

rpostgis's People

Contributors

dnbucklin avatar cidree avatar basille avatar polymathematic avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.