ST_read

0th

Percentile

read simple features from file or database

read simple features from file or database

read PostGIS table directly through DBI and RPostgreSQL interface, converting wkb

Usage
st_read(dsn, layer, ...)
st_write(sf, dsn = ".", layer, driver = "ESRI Shapefile", opts = character(), ...)
st_read_pg(cn = NULL, query, dbname, geom_column = NULL, ...)
Arguments
dsn
data source name (interpretation varies by driver - for some drivers, dsn is a file name, but may also be a folder)
layer
layer name (varies by driver, may be a file name without extension)
...
parameter(s) passed on to st_as_sf
sf
object of class sf
driver
driver name
opts
options to pass on to driver
cn
open database connection
query
SQL query to select records
dbname
character; database name, only used if cn is NULL
geom_column
character or integer: indicator of name or position of the geometry column; if not provided, the last column of type character is chosen
Aliases
  • st_read
  • st_read_pg
  • st_write
Examples
if (Sys.getenv("USER") == "edzer") {
 (s = st_read("PG:dbname=test", "test"))
 summary(s)
}
(s = st_read(system.file("shapes/", package="maptools"), "sids"))[1:10,]
summary(s)
if (Sys.getenv("USER") == "edzer") {
  st_read_pg(dbname = "postgis", query = "select * from meuse2 limit 3;")
}
Documentation reproduced from package sf, version 0.1-1, License: GPL-2 | MIT + file LICENSE

Community examples

Looks like there are no examples yet.