> See the help for SpatialLines, Lines, Line, and > SpatialLinesDataFrame... Or I might have a solution in half an hour...
Bit quicker than half an hour... Try this - its a simpliified version of ContourLines2SLDF that keeps the level lines separate: ContourLines2SLDF2 <- function (cL, proj4string = CRS(as.character(NA))) { if (length(cL) < 1) stop("cL too short") df <- data.frame(level = sapply(cL,function(x){x$level})) m <- length(cL) res <- vector(mode = "list", length = m) IDs <- paste("C", 1:m, sep = "_") row.names(df) <- IDs for (i in 1:m) { res[[i]] <- Lines(Line(cbind(cL[[i]]$x,cL[[i]]$y)), ID = IDs[i]) } SL <- SpatialLines(res, proj4string = proj4string) res <- SpatialLinesDataFrame(SL, data = df) res } -- blog: http://geospaced.blogspot.com/ web: http://www.maths.lancs.ac.uk/~rowlings web: http://www.rowlingson.com/ twitter: http://twitter.com/geospacedman pics: http://www.flickr.com/photos/spacedman _______________________________________________ R-sig-Geo mailing list R-sig-Geo@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo