Geographic Information Systems Asked on March 27, 2021
Using lidR 3.1.3, is it possible to classify points inside polygons shapefile for a LASCatalog
, something like the previous lasclassify()
function. I’m looking for a equivalent of this PDAL method.
ctg <- lidR::readLAScatalog(path_to_folder)
shapefile = rgdal::readOGR(shapefile_file)
opt_output_files(ctg) <- paste0(path_to_folder, "/{ORIGINALFILENAME}_classified")
# Need to classify here
output<- classify_within_polygons(ctg, shapefile)
With a loaded point-cloud (LAS
) you can use merge_spatial()
. Lets load some data first:
library(lidR)
library(sf)
LASfile <- system.file("extdata", "Megaplot.laz", package="lidR")
shp <- system.file("extdata", "lake_polygons_UTM17.shp", package = "lidR")
las <- readLAS(LASfile)
poly <- st_read(shp, quiet = TRUE)
plot(las@header)
plot(poly, add = TRUE)
We can now use merge_spatial()
to know if points are in or out the polygon(s). Then we can use this information to clip or classify.
las <- merge_spatial(las, poly, "inpoly")
las$Classification[las$inpoly == TRUE] <- LASWATER
las$Classification[las$inpoly == FALSE & las$Classification != LASGROUND] <- LASLOWVEGETATION
plot(las, color = "Classification")
veg = filter_poi(las, inpoly == FALSE)
plot(veg)
However it is not possible (yet) to directly classify the point-cloud from a LAScatalog
. You must build your own tools based on this answer and catalog_apply()
Correct answer by JRR on March 27, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP