# NOT RUN {
LASfile <- system.file("extdata", "Megaplot.laz", package="lidR")
shapefile_dir <- system.file("extdata", package = "lidR")
lidar = readLAS(LASfile)
lakes = rgdal::readOGR(shapefile_dir, "lake_polygons_UTM17")
# The field "inlake" does not exist in the shapefile. Points are classified as TRUE if in a polygon
lasclassify(lidar, lakes, "inlakes") # New column 'inlakes' is added.
forest = lasfilter(lidar, inlakes == FALSE)
plot(lidar)
plot(forest)
# The field "LAKENAME_1" exists in the shapefile.
# Points are classified with the values of the polygons
lasclassify(lidar, lakes, "LAKENAME_1") # New column 'LAKENAME_1' is added.
# }
Run the code above in your browser using DataLab