pgis2spts: Load a point geometry stored in a PostgreSQL database into R.

Description Usage Arguments Value Examples

Description

Load a point geometry stored in a PostgreSQL database into R.

Usage

1
2
pgis2spts(conn, table, geom = "geom", gid = "gid", proj = NULL,
  other.cols = "*", query = NULL)

Arguments

conn

A connection object created in RPostgreSQL package.

table

character, Name of the schema-qualified table in Postgresql holding the geometry.

geom

character, Name of the column in 'table' holding the geometry object (Default = 'geom')

gid

character, Name of the column in 'table' holding the ID for each point geometry. Should be unique if additional columns of unique data are being appended. (Default = 'gid')

proj

numeric, Can be set to TRUE to automatically take the SRID for the table in the database. Alternatively, the number of EPSG-specified projection of the geometry (Default is NULL, resulting in no projection.)

other.cols

character, names of additional columns from table (comma-seperated) to append to dataset (Default is all columns, other.cols=NULL returns a SpatialPoints object)

query

character, additional SQL to append to modify select query from table

Value

SpatialPointsDataFrame or SpatialPoints

Examples

1
2
3
4
5
6
#library(RPostgreSQL)
#drv<-dbDriver("PostgreSQL")
#conn<-dbConnect(drv,dbname='dbname',host='host',port='5432',user='user',password='password')

#pgis2spts(conn,'schema.tablename')
#pgis2spts(conn,'schema.cities',geom='citygeom',gid='city_ID',proj=4326,query = "AND city_population > 10000")

dnbucklin/pgis2r documentation built on May 15, 2019, 9:38 a.m.