Description Usage Arguments Value Note Author(s) Examples
read.shp
reads ESRI shapefile format (.shp
). Currently
only polygons and polylines are supported.
1 2 |
where |
filename to read the data from or a binary connection or a raw vector with the data content |
format |
output format (see below for details), defaults to "list". |
close |
if |
The result depends on the value of the format
argument:
"list" |
list (generic vector) of shapes exactly as represented
in the
|
"pairlist" |
same as "list" except that the list of shapes is stored in a pairlist and not a list. This is the most memory-efficient way of reading a shapefile, because and all other formats are derived from first reading this format. Pairlists are good for linear scans but inefficient for indexing. |
"polygon" |
same as "list" except that coordinates are
represented in R polygon format (parts are separated by |
"table" |
The result is a data frame with the following columns:
|
Although other packages exist for reading shapefiles, the focus of this implementation is speed, so it works on very large compilations of shapes, such as the Tiger database which is impossible to load using naive R implementations.
Simon Urbanek
1 2 3 | # Census 2010 TIGER/Line(TM) state shapefile
fn <- system.file("shp", "tl_2010_us_state10.shp.xz", package="fastshp")
s <- read.shp(xzfile(fn, "rb"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.