Question

How to filter and count point from LAS 1.4 with classification flags?

  • 2 August 2021
  • 6 replies
  • 16 views

Badge

fme2Is there a trick on how to read and count points with a classification flag?

 

This link (http://docs.safe.com/fme/2016.1/html/FME_Desktop_Documentation/FME_ReadersWriters/las/quick_facts_las.htm) seem to indicate that there is but I can't find any transformer that does.

Classification_flag is not part of the different field available in PointCloudPropertyExtractor.

Writing "classification_flags" manually does seem to output a few things, but it only seems to be a 0 (there's no flags) or 1 (there's flags) kind of thing.

==1, ==2. ==3 doesn't output anything.

 

How to count flags like in LASinfo?

fme3 


6 replies

Userlevel 4
Badge +26

Seems like you're doing everything right to me, however, the PointCloudSplitter might be closer to what you actually want. It should work in a similar way to the Filter here but in this case it will create an attribute so you can see what the actual value is.

Have you been able to inspect the pointcloud where classification_flags != 0 to see the values?

If you're able to show that LASTools is providing different results to FME based on this number then this seems like a potential bug.

 

PointCloudSplitter

Badge

Seems like you're doing everything right to me, however, the PointCloudSplitter might be closer to what you actually want. It should work in a similar way to the Filter here but in this case it will create an attribute so you can see what the actual value is.

Have you been able to inspect the pointcloud where classification_flags != 0 to see the values?

If you're able to show that LASTools is providing different results to FME based on this number then this seems like a potential bug.

 

PointCloudSplitter

Thank you that was a good idea to try with classification_flags on the Splitter. Interesting results.

So basically the filter has only two output port I think, flag set to 0 or not set to 0. It only checks if a flag has been set on a point.

Filter:

@Component(classification_flags)==0: 1,937,761 points

@Component(classification_flags)!=0: 11,620,899 points

 

PointCloudPropertyExtractor (max number of flags) shows 8 though, which is weird because it does not output anything at @Component(classification_flags)==8

Potential bug there.

 

Splitter:fme4 

Split on classification_flags, left empty to keep all. Three outputs, split value 0, 4 and 8

classification_flag 0: 1,937,761 points

classification_flag 4: 1,662,158 points

classification_flag 8: 9,958,741 points

 

filter==0 is the same as splitter 0 (no flag set on a point)

filter!=0 is the same as spliter (4) + splitter (8)

 

In a LAS viewer, 0 is flag = none, (4) is Withheld, (8) is overlap.

 

I tested on another dataset, which comes with additional flag values. Splitter (2) is key point, splitter (10) outputs the points flagged with both 'Overlap,Key-point'. (0) is still none, (8) is still Overlap.

 

Are those value documented somewhere? I thought it would only be 0,1,2,3 but it seems like there are FME specific values.

 

 

 

 

 

 

Userlevel 4
Badge +26

Thank you that was a good idea to try with classification_flags on the Splitter. Interesting results.

So basically the filter has only two output port I think, flag set to 0 or not set to 0. It only checks if a flag has been set on a point.

Filter:

@Component(classification_flags)==0: 1,937,761 points

@Component(classification_flags)!=0: 11,620,899 points

 

PointCloudPropertyExtractor (max number of flags) shows 8 though, which is weird because it does not output anything at @Component(classification_flags)==8

Potential bug there.

 

Splitter:fme4 

Split on classification_flags, left empty to keep all. Three outputs, split value 0, 4 and 8

classification_flag 0: 1,937,761 points

classification_flag 4: 1,662,158 points

classification_flag 8: 9,958,741 points

 

filter==0 is the same as splitter 0 (no flag set on a point)

filter!=0 is the same as spliter (4) + splitter (8)

 

In a LAS viewer, 0 is flag = none, (4) is Withheld, (8) is overlap.

 

I tested on another dataset, which comes with additional flag values. Splitter (2) is key point, splitter (10) outputs the points flagged with both 'Overlap,Key-point'. (0) is still none, (8) is still Overlap.

 

Are those value documented somewhere? I thought it would only be 0,1,2,3 but it seems like there are FME specific values.

 

 

 

 

 

 

OK so yep, seem a little bit like a bug to me, however, I can see what is happening. Here's a tables from the specs of LAS 1.4.

LAS_specNote that in fact the number actually represents the bit position- Not exactly an actual number. FME reads/interprets the 4 bits of binary (0000) as a Uint8.

 

Here's a link showing the conversion between normal numbers (decimal) and Uint8: https://makeapppie.com/2018/04/25/tips-why-use-int8/ (take a look at the table)

In particular you can see that the position of the 1 in the binary block is what gives the classification_flags it's value.

So, 0001 is a 1 in FME, 0010 is a 2 in FME, 0100 is a 4 in FME, 1000 is an 8 in FME. These 4 sets represent the four different types. You can see the 1 moves position from index 0 to index 3.

A combination, like '1010', represents two types (8 and 2 in FME) but is actually interpreted by FME as a 10.

 

From the link you can see that there are 16 different theoretical combinations depending on which bits are set to 1. FME will return a number from 0 to 15. This can be easily mapped with an AttributeValueMapper to a proper string.

 

 

 

 

 

 

 

Userlevel 4
Badge +26

Thank you that was a good idea to try with classification_flags on the Splitter. Interesting results.

So basically the filter has only two output port I think, flag set to 0 or not set to 0. It only checks if a flag has been set on a point.

Filter:

@Component(classification_flags)==0: 1,937,761 points

@Component(classification_flags)!=0: 11,620,899 points

 

PointCloudPropertyExtractor (max number of flags) shows 8 though, which is weird because it does not output anything at @Component(classification_flags)==8

Potential bug there.

 

Splitter:fme4 

Split on classification_flags, left empty to keep all. Three outputs, split value 0, 4 and 8

classification_flag 0: 1,937,761 points

classification_flag 4: 1,662,158 points

classification_flag 8: 9,958,741 points

 

filter==0 is the same as splitter 0 (no flag set on a point)

filter!=0 is the same as spliter (4) + splitter (8)

 

In a LAS viewer, 0 is flag = none, (4) is Withheld, (8) is overlap.

 

I tested on another dataset, which comes with additional flag values. Splitter (2) is key point, splitter (10) outputs the points flagged with both 'Overlap,Key-point'. (0) is still none, (8) is still Overlap.

 

Are those value documented somewhere? I thought it would only be 0,1,2,3 but it seems like there are FME specific values.

 

 

 

 

 

 

but we should let @nampreetatsafe​  know about this so that Safe can update the documentation on the LAS reader about the classificaiton_flags

Badge

Thank you that was a good idea to try with classification_flags on the Splitter. Interesting results.

So basically the filter has only two output port I think, flag set to 0 or not set to 0. It only checks if a flag has been set on a point.

Filter:

@Component(classification_flags)==0: 1,937,761 points

@Component(classification_flags)!=0: 11,620,899 points

 

PointCloudPropertyExtractor (max number of flags) shows 8 though, which is weird because it does not output anything at @Component(classification_flags)==8

Potential bug there.

 

Splitter:fme4 

Split on classification_flags, left empty to keep all. Three outputs, split value 0, 4 and 8

classification_flag 0: 1,937,761 points

classification_flag 4: 1,662,158 points

classification_flag 8: 9,958,741 points

 

filter==0 is the same as splitter 0 (no flag set on a point)

filter!=0 is the same as spliter (4) + splitter (8)

 

In a LAS viewer, 0 is flag = none, (4) is Withheld, (8) is overlap.

 

I tested on another dataset, which comes with additional flag values. Splitter (2) is key point, splitter (10) outputs the points flagged with both 'Overlap,Key-point'. (0) is still none, (8) is still Overlap.

 

Are those value documented somewhere? I thought it would only be 0,1,2,3 but it seems like there are FME specific values.

 

 

 

 

 

 

oh woah, thanks for this, it makes complete sense!

The PropertyExtractor did show Uint8 and yeah, the different combination binary/decimal are matching. Thank you

Badge

Thank you that was a good idea to try with classification_flags on the Splitter. Interesting results.

So basically the filter has only two output port I think, flag set to 0 or not set to 0. It only checks if a flag has been set on a point.

Filter:

@Component(classification_flags)==0: 1,937,761 points

@Component(classification_flags)!=0: 11,620,899 points

 

PointCloudPropertyExtractor (max number of flags) shows 8 though, which is weird because it does not output anything at @Component(classification_flags)==8

Potential bug there.

 

Splitter:fme4 

Split on classification_flags, left empty to keep all. Three outputs, split value 0, 4 and 8

classification_flag 0: 1,937,761 points

classification_flag 4: 1,662,158 points

classification_flag 8: 9,958,741 points

 

filter==0 is the same as splitter 0 (no flag set on a point)

filter!=0 is the same as spliter (4) + splitter (8)

 

In a LAS viewer, 0 is flag = none, (4) is Withheld, (8) is overlap.

 

I tested on another dataset, which comes with additional flag values. Splitter (2) is key point, splitter (10) outputs the points flagged with both 'Overlap,Key-point'. (0) is still none, (8) is still Overlap.

 

Are those value documented somewhere? I thought it would only be 0,1,2,3 but it seems like there are FME specific values.

 

 

 

 

 

 

For whoever read this in the future, here is the result after applying flags 'manually' with lastools to a sample, here is how FME and the Splitter return it:

 

synthetic: classification_flags == 1

key point: classification_flags == 2

withheld: classification_flags==4

overlap: classification_flags==8

Reply