'Clipping a las file with a shapefile getting error
I want to clip a las file with 5m radius shapefile.
library(rgdal)
library(lidR)
library(sp)
library(raster)
ctg = readLAS("............")
plot(ctg)
spdf <- readOGR(dsn = ".......", layer = "shapefile")
plot(spdf)
clipped_las = clip_roi(ctg, spdf)
plot(clipped_las)
But I am getting following error:
clipped_las = clip_roi(ctg, spdf)
#> Error in st_geos_binop("intersects", x, y, sparse = sparse, prepared = prepared, :
#> st_crs(x) == st_crs(y) is not TRUE
plot(clipped_las)
#> Error: Cannot display an empty point cloud
Alternatively I tried:
ctg = readLAScatalog(".......")
plot(ctg)
spdf <- readOGR(dsn = ".......", layer = "shapefile")
plot(spdf)
poly <- spdf@polygons[[1]]@Polygons[[1]]
clipped_las = clip_roi(ctg, poly)
plot(clipped_las)
In that case I am getting following error:
clipped_las = clip_roi(ctg, poly)
#> Processing [=======================================================] 100% (1/1) eta: 0s
#> No point found for within region of interest 1.
How can I clip the pointcloud?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
