maptools (version 0.2-2)

read.shape: Read shapefile into Map object

Usage

read.shape(filen, dbf.data = TRUE)
dbf.read(filen)
getinfo.shape(filen)

Arguments

filen
name of file with *.shp extension, or *.dbf for dbf.read()
dbf.data
read DBF data together with shapes, default TRUE

Value

  • read.shape() returns either a list of shapes of class ShapeList, or if dbf.data = TRUE a list 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

Details

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

References

http://gdal.velocet.ca/projects/shapelib/

See Also

plot.Map

Examples

Run this code
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]))

Run the code above in your browser using DataLab