shp2SLDF {sp} | R Documentation |
These functions show how to build converters from external formats to build SpatialLinesDataFrame objects: shp2SLDF
from "arc"
type ESRI shapefiles read into "Map"
objects using the read.shape()
function in the maptools package; arcobj2SLDF
from the list returned by the get.arcdata
function in the RArcInfo package; and contourLines2SLDF
from the list returned by the contourLines
function in the graphics package (here the data frame is just the contour levels, with one Slines object made up of at least one Sline object per level).
shp2SLDF(shp, proj4string = CRS(as.character(NA))) arcobj2SLDF(arc, proj4string=CRS(as.character(NA))) contourLines2SLDF(cL, proj4string=CRS(as.character(NA)))
shp |
a "Map" object returned by the read.shape() function in the maptools package |
arc |
a list returned by the get.arcdata function in the RArcInfo package |
cL |
a list returned by the contourLines function in the graphics package |
proj4string |
Object of class "CRS" ; see CRS-class |
A SpatialLinesDataFrame object
Roger Bivand; Edzer Pebesma
data(lnsshp) # retrieved as: # library(maptools) # lns <- read.shape(system.file("shapes/fylk-val.shp", package="maptools")[1]) res <- shp2SLDF(lns) plot(res) invisible(title("")) data(co37_d90_arc) # retrieved as: # library(RArcInfo) # fl <- "http://www.census.gov/geo/cob/bdy/co/co90e00/co37_d90_e00.zip" # download.file(fl, "co37_d90_e00.zip") # e00 <- zip.file.extract("co37_d90.e00", "co37_d90_e00.zip") # e00toavc(e00, "ncar") # arc <- get.arcdata(".", "ncar") res <- arcobj2SLDF(arc) plot(res) invisible(title("")) res <- contourLines2SLDF(contourLines(volcano)) plot(res, col=terrain.colors(nrow(res@data))) invisible(title(""))