run <- FALSE
if (require("spatstat.geom", quietly=TRUE)) run <- TRUE
if (run) {
data(meuse.riv)
mr <- Line(meuse.riv)
mr_psp <- as(mr, "psp")
mr_psp
}
if (run) {
plot(mr_psp)
}
if (run) {
xx_back <- as(mr_psp, "SpatialLines")
plot(xx_back)
}
if (run) {
xx <- readShapeLines(system.file("shapes/fylk-val.shp", package="maptools")[1],
proj4string=CRS("+proj=utm +zone=33 +ellps=WGS84"))
xx_psp <- as(xx["LENGTH"], "psp")
xx_psp
}
if (run) {
plot(xx_psp)
}
if (run) {
xx_back <- as(xx_psp, "SpatialLines")
plot(xx_back)
}
if (run) {
xx <- readShapeLines(system.file("shapes/fylk-val-ll.shp", package="maptools")[1],
proj4string=CRS("+proj=longlat +ellps=WGS84"))
try(xx_psp <- as(xx["LENGTH"], "psp"))
}
Run the code above in your browser using DataLab