Description Usage Arguments Value Examples
Load a polygon geometry stored in a PostgreSQL database into R.
1 2 |
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 polygon 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 SpatialPolygons object) |
query |
character, additional SQL to append to modify select query from table |
SpatialPolygonsDataFrame or SpatialPolygons
1 2 3 4 5 6 | #library(RPostgreSQL)
#drv<-dbDriver("PostgreSQL")
#conn<-dbConnect(drv,dbname='dbname',host='host',port='5432',user='user',password='password')
#pgis2spol(conn,'schema.tablename')
#pgis2spol(conn,'schema.states',geom='statesgeom',gid='state_ID',proj=4326,other.cols='area,population', query = "AND area > 1000000 ORDER BY population LIMIT 10")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.