Skip to main content

I am a first time FME user. I want to analyse the closest LiDAR points that are to my point data (pit). I tried using NeighborFinder but I guess it does not like LiDAR data and produces a empty .shp file or .gdb file. I want my .shp or .gdb with the nearest 5 LiDAR points that are averaged to produce a z value for my point vector data (pit data). It will be very kind if someone could help me with what code I would need to produce the required result?

 

PS: plz disregard the aerial image in the background.

You can use the PointCloudCoercer to decompose a point cloud into individual point features, and then apply the NeighborFinder to find the closest point from the given point.

Just be aware, since the PointCloudCoercer converts all the points in the point cloud to individual point features, it could take a long time to complete the translation if you sent the entire point cloud into the transformer. I therefore think it would be better to clip the point cloud by a buffer area of the given point beforehand using the Clipper.


 

You could:

-clip with extruded buffered object.

-Calculate distance. (not a favorite I understand.)

- create surface or DEM and clip that. Calculate average z.

 

 


You can use the PointCloudCoercer to decompose a point cloud into individual point features, and then apply the NeighborFinder to find the closest point from the given point.

Just be aware, since the PointCloudCoercer converts all the points in the point cloud to individual point features, it could take a long time to complete the translation if you sent the entire point cloud into the transformer. I therefore think it would be better to clip the point cloud by a buffer area of the given point beforehand using the Clipper.

I reckon I did not explain my question well

I am trying to preserve z values from the LiDAR data and want to average the 5 nearest LiDAR points z values and compare it to the z values of the point vector data.

PointCloudCoercer preserves the z values but NeighborFinder removes them only providing nearest x and y values.

I used the following code:

 

 


You can use the PointCloudCoercer to decompose a point cloud into individual point features, and then apply the NeighborFinder to find the closest point from the given point.

Just be aware, since the PointCloudCoercer converts all the points in the point cloud to individual point features, it could take a long time to complete the translation if you sent the entire point cloud into the transformer. I therefore think it would be better to clip the point cloud by a buffer area of the given point beforehand using the Clipper.

If you set a list name to the Closest Candidate List Name parameter, the feature output via the Matched port would have a list attribute that contains attributes of the found neighbor features.

Addition I think you have to send the original point to the Base port of the NeighborFinder since you need to find points closest to the POINT (not its buffer).


If you set a list name to the Closest Candidate List Name parameter, the feature output via the Matched port would have a list attribute that contains attributes of the found neighbor features.

Addition I think you have to send the original point to the Base port of the NeighborFinder since you need to find points closest to the POINT (not its buffer).

Do you think my PointCloudCoercer is right? When I test it to output a shp file the attribute table in ArcMap lists no details of any LiDAR values.


If you set a list name to the Closest Candidate List Name parameter, the feature output via the Matched port would have a list attribute that contains attributes of the found neighbor features.

Addition I think you have to send the original point to the Base port of the NeighborFinder since you need to find points closest to the POINT (not its buffer).

I think this configuration would fit to your requirement.


I think this configuration would fit to your requirement.

Hi @takashi,

I tried running the script as you recommended but there is still something missing.

I used the NeighborFinder with these parameters:

 

My desired result is to run a script such that I get averaged z values extracted from nearest LiDAR points (nearest to the vector shp file). In the image below I have a screenshot from data inspector and I do not know how to get a column with averaged z values

 


I think this configuration would fit to your requirement.

Take a look at the Feature Information window in the FME Data Inspector. You can see the values of list elements (z{0}.***, z{1}.***, etc.) there. The list has 5 elements (z{0} ... z{4}), so you have successfully found the closest 5 points from the Base point.

However, there is no element called "z{i}.normal_z". This means that the source point cloud didn't have "normal_z" component.

I think you want to extract "z" (elevation) component from the point cloud, rather than "normal_z". Don't you?

Check again this screenshot.


I think this configuration would fit to your requirement.

If you got "<list name>{i}.z" (i = 0-4), you can then calculate the average of them with the ListSummer and the ExpressionEvaluator, for example.


If you got "<list name>{i}.z" (i = 0-4), you can then calculate the average of them with the ListSummer and the ExpressionEvaluator, for example.

I guess you are right but under PointCloudCoercer I do not have the option to select "z" but it has "normal_z" and I guess that's why doing NeighborFinder. Does this mean that there is something missing in my LAS files?doesnt work. I do not know if it is to do with my initial PointCloudSplitter or what else.


I think this configuration would fit to your requirement.

You can enter "z" (and any other component if necessary) into the field in the Point Components To Preserve table directly from the key board.

Alternatively you can extract z-coordinate from the resulting points with the CoordinateExtractor.


I can confirm that this works as @takashi described, thx a lot!


Reply