write.linelistShape {maptools} | R Documentation |
The function calls code from shapelib to write an arc-type shapefile from a list of matrices of line coordinates with no NAs.
write.linelistShape(linelist, df, file, factor2char = TRUE, strictFilename=FALSE)
linelist |
a list of matrices of line coordinates |
df |
a data frame object |
file |
a file name of maximum 8 chararacters, numbers or the underscore symbol to be written, omitting the extensions *.shp, *.shx and *.dbf, which are added in the function |
factor2char |
logical, default TRUE, convert factor columns to character |
strictFilename |
if TRUE, impose file basename length limit of 8 characters |
The function calls code from shapelib to write an arc-type shapefile (both the geometry file with a *.shp extension, the index file with a *.shx extension, and the database file with a *.dbf extension - see write.dbf
for details of the data frame export within this function.
no return value.
From maptools 0.4-10, this function is placed in the user-visible namespace on a trial basis, and reports of any malfunction should be sent to the package maintainer, Roger Bivand Roger.Bivand@nhh.no. It is likely that this function and its arguments will be changed.
Nicholas J. Lewin-Koh, modified by Roger Bivand; shapelib by Frank Warmerdam
x <- 10 * 1:nrow(volcano) y <- 10 * 1:ncol(volcano) line.list <- contourLines(x, y, volcano) vol.levels <- data.frame(alt=sapply(line.list, function(x) x[[1]])) vol.ll <- lapply(line.list, function(x) cbind(x$x, x$y)) tmpshp <- paste(tempdir(), "volcano", sep="/") write.linelistShape(vol.ll, vol.levels, file=tmpshp) try1 <- readShapeLines(tmpshp) plot(try1)