3

I want to read a LAS catalog, create a DEM, normalize the catalog, and run filter_poi() on the catalog.

My issue is that when I try to run filter_poi(), in the code below, I get the error "Argument is not a LAS object." Is there a way to run filter_poi() on a LAScatalog?

# Read LAScatalog
ctg <- readLAScatalog("__folder__\\tiled\\")

# Create DEM
dem<-grid_terrain(ctg, res=5, algorithm = knnidw(), overwrite=T)

# Set output files location
opt_output_files(ctg) <- "\\___folder___\\{ORIGINALFILENAME}"

# Normalize height
norm<-normalize_height(ctg, dem)

veg_canopy<-filter_poi(norm, Z>4 & Z<120 & Classification==5)

1 Answer 1

2

You don't need to filter these points which would imply creating a new copy of your collection of files. You can simply keep or discard points at read time.

readLAS("file.las", filter = "-drop_z_below 4 -drop_z_above 120 -keep_class 5")

btw grid_terrain is deprecated and does not have argument overwrite

3
  • Thank you! This answer combined with your response from this post leads me to think I need to use the opt-filter() function in order to apply the <filter = "..."> method to a LAScatalog. Does this sound right? Jul 17 at 17:10
  • Absolutely. If you want to keep or discard points at read time with a LAScatalog you can use opt_filter() to propagate the filter to readLAS internally.
    – JRR
    Jul 17 at 18:15
  • Awesome, that worked! Thank you so much. Before I mark the answer correct, could you add that to the answer possibly? Jul 18 at 16:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.