read.shape

0th

Percentile

Read shapefile into Map object

Read shapefile into Map object; the file should be given including its ".shp" extension, and the function will reconstruct the names of the database (dbf) file and the index (shx) file from these.

Keywords
spatial
Usage
read.shape(filen, dbf.data = TRUE, verbose=TRUE)
getinfo.shape(filen)
print.shapehead(x, ...)
Arguments
filen
name of file with *.shp extension
dbf.data
read DBF data together with shapes, default TRUE
verbose
default TRUE --- report type of shapefile and number of shapes
x
a shapehead list as returned by getinfo.shape
...
other arguments passed to print
Details

The function calls code from shapelib to read shapefiles, a file format used by ESRI GIS software among others

Value

  • read.shape() returns either a list of shapes of class ShapeList, or if dbf.data = TRUE a Map object with:
  • Shapesa list of shapes of class ShapeList; both the individual shapes and the list have attributes
  • att.dataa data frame of data from the associated DBF file; note that the field names are adjusted to use in R using make.names(), and so will permit the underscore character from R release 1.9.0.

References

http://shapelib.maptools.org/

See Also

plot.Map, read.dbf

Aliases
  • read.shape
  • getinfo.shape
  • print.shapehead
Examples
x <- read.shape(system.file("shapes/sids.shp", package="maptools")[1])
length(x$Shapes)
unlist(lapply(x$att.data, class))
str(getinfo.shape(system.file("shapes/fylk-val.shp", package="maptools")[1]))
Documentation reproduced from package maptools, version 0.4-13, License: GPL version 2 or later (R and interface code), MIT (shapelib code)

Community examples

Looks like there are no examples yet.