Hi James,
here hopefully a solution to the problem.
Attached the generic testdata we used.
We have 90 points in our base flightline, then we copied the flightlines 2 and 3 which differ in
2: xy 2 2 is missing
xy 3 3 is missing
xy 4 4 has delta z > 0.1
xy 5 5 has delta z > 0.1
3: xy 2 2 is missing
xy 4 4 has delta z > 0.1
xy 6 6 is missing
xy 7 7 has delta z > 0.1
4 points differ < 0.1
we expect as class 18(noise):
xy 2 2 for fl 1
xy 4 4 for fl 1,2,3
xy 5 5 for fl 2
xy 7 7 for fl 3
This is the script we run:
:: first we convert our sample data to a LAZ file
txt2las64 -i sample_data.csv -o tmp_raw.laz
...
Column description detected. Parse string is xyzp
(266 pts)
...
:: then we split by flightlines, this is mandatory, because lascopy64 always work with source and target files to match
md tmpfl
lassplit64 -i tmp_raw.laz -o tmp -olaz -odir tmpfl
we get
tmpfl\tmp_0000001.laz
tmpfl\tmp_0000002.laz
tmpfl\tmp_0000003.laz
for our 3 flightlines (90/88/88 pts)
:: next we set the classification to each future target to noise. this noise will remain if the other flightlines does not match(>copy)
md tmp18
las2las64 -i tmpfl\*.laz -odir tmp18 -olaz -set_classification 18
:: now we need to merge all source combinations to match against a target
:: for many flightlines this can be done using a looping script or a python snippet
lasmerge64 -i tmpfl\tmp_0000001.laz tmpfl\tmp_0000002.laz -o tmpfl\tmp_00000012.laz
lasmerge64 -i tmpfl\tmp_0000001.laz tmpfl\tmp_0000003.laz -o tmpfl\tmp_00000013.laz
lasmerge64 -i tmpfl\tmp_0000002.laz tmpfl\tmp_0000003.laz -o tmpfl\tmp_00000023.laz
:: now we can copy each flightline as source against the noise classified target. also a script maybe help to do this on large filesets.
md tmpcp
lascopy64 -i tmpfl\tmp_00000023.laz -i tmp18\tmp_0000001.laz -odir tmpcp -olaz -match_xyz 0.1 -copy_classification
lascopy64 -i tmpfl\tmp_00000013.laz -i tmp18\tmp_0000002.laz -odir tmpcp -olaz -match_xyz 0.1 -copy_classification
lascopy64 -i tmpfl\tmp_00000012.laz -i tmp18\tmp_0000003.laz -odir tmpcp -olaz -match_xyz 0.1 -copy_classification
:: we extract all noise to separate files
md tmp18only
las2las64 -i tmpcp\*.laz -olaz -odir tmp18only -cores 16 -keep_class 18
(2 surviving points each)
:: we extract all matching points out of one copied file - which should have class 0
md tmpcommon
las2las64 -i tmpcp\tmp_0000001.laz -olaz -odir tmpcommon -keep_class 0
(22 surviving points)
:: we merge the common points with the noise points
lasmerge -i tmpcommon\*.laz -i tmp18only\*.laz -o final.laz
(94 points)
:: finally we check the result
lasinfo64 -i final.laz
histogram of classification of points:
88 never classified (0)
6 Reserved for ASPRS Definition (18)
las2txt64 -i final.laz -o final.txt -parse xyzpc -coldesc
all points has class 0 excpt this:
2.0000000 2.0000000 3.56 1 18
4.0000000 4.0000000 0.38 1 18
4.0000000 4.0000000 0.58 2 18
5.0000000 5.0000000 2.17 2 18
4.0000000 4.0000000 0.68 3 18
7.0000000 7.0000000 2.18 3 18
:: optional cleanup of all temp files
del tmp*.*
rmdir /s /q tmpcommon
rmdir /s /q tmp18only
rmdir /s /q tmpcp
rmdir /s /q tmpfl
rmdir /s /q tmp18
This is done by classes itself.
If the classes are populated already you can use a flag as marker and set noise at the final end using the marker (e.g. synthetic flag).
Also this is done by distance from point to point (which make sense in our opinion).
If you really want to use 3d boxes/voxels you need to assign a voxel to each point before and then work with this voxel IDs.
Probably lasvoxel -compute_IDs_and_voxel_table could help you there.
Cheers,
Jochen @rapidlasso