1

I have a bit of an unusual LAS tiles. I know that all my points represent "ground". The LAS files were already pre-processed and classified. But all the points are Class = 8L. I need to reclassify all of them to 2L to be able to work with them as terrain.

I see it works fine for LAS class, where the Classification slot is. las$Classification <- 2L but how to do this for LAScatalog? I tried several ways but no success. Maybe it is possible to define a custom Classifier?

EDIT: Proposed spolution by @JRR works perfectly for me, but only for single las tile, not for LAScatalog.

l<-list.files(mylasfiles)
cg<-readLAScatalog(l[1:10], filter = "-change_classification_from_to 8 2") # does not work
cg<-readLAScatalog(l[1], filter = "-change_classification_from_to 8 2") # works fine
matej
  • 15
  • 6

1 Answers1

1

You do not need to rewrite your file, you can transform at read time

readLAS(file, filter = "-change_classification_from_to 8 2")

You can do the same with a LAScatalog

readLAScatalog(file, filter = "-change_classification_from_to 8 2")
JRR
  • 3,024
  • 2
  • 13
  • 37
  • Thank you very much for showing me this direction. I am impressed how big list of filter commands is there available - - https://lastools.github.io/download/las2las_README.md – matej Aug 03 '23 at 10:46
  • The filter commands are from LASlib that is used internally to read and write LAS files – JRR Aug 03 '23 at 11:28
  • unfortunately for LAScatalog this not works for me. For single tile this works, but for catalog does not. – matej Aug 03 '23 at 11:41
  • It should. There is no reason it is not working. You made a mistake somewhere. Please open a new question with a reproducible example on https://gis.stackexchange.com/questions/tagged/lidr which is where lidR questions are supposed to be. – JRR Aug 03 '23 at 13:35