Files
-
- 10 MB
- Download
Introduction
Just like any data source, point clouds may need to be cleaned before they can be accurately analyzed. Occasionally, some point clouds contain noise such as clouds, birds, or other points that can skew your results. We can remove this noise using various transformers that will help identify the noisy areas.
The source data and completed workspace can be downloaded from the Files section.
Step-by-Step Instructions
In this example, we will use a point cloud of a landscape that includes clouds, which represent noise.
1. Read Data in FME Workbench
Open a blank workspace in FME Workbench. Click the Reader button in the Toolbar and set the following parameters in the Add Reader dialog:
- Format: ASPRS Lidar Data Exchange Format (LAS)
-
Dataset: /000782.las
- Click the ellipsis to browse to the downloaded file
Click OK to add the reader to the canvas.
Once the reader has been added, click the reader feature type to open the Mini Toolbar, then click View Source Data to view the dataset in Data Preview.
In Data Preview, use the Toolbar menu to orbit, pan, and zoom around the point cloud until you can see the clouds above the ground. The clouds (shown in red) will be what we remove.
2. Add a CoordinateSwapper Transformer
To remove the clouds, we will create tiles of the point cloud and remove those that are empty or contain clouds. To do that, we will first swap the coordinates.
The Tiler transformer, which we will use in the next step, uses x and y axes, whereas the cloud elevation is stored on the z-axis.
Add a CoordinateSwapper transformer connected to the LAS reader feature type. Open the parameters and set the Swap Type:
- Swap Type: Y <-> Z
This will swap the y and z axis values.
3. Add a Tiler Transformer
Now, we will add a Tiler transformer and connect its Input port to the CoordinateSwapper Output port. In the Tiler parameters, set the following:
- Tiling Type: Number of Tiles
- Columns: 1
- Rows: 25
4. Swap Coordinates Back
Before we can proceed, we need to swap the coordinates back. Right-click the CoordinateSwapper and click Duplicate to make a copy. Connect the duplicated transformer to the Tiler Tiled output port.
5. Run the Workspace
Run the workspace with Feature Caching enabled. Once the translation succeeds, click the green eye icon on the CoordinateSwapper_2 Output port to view the data table in Data Preview.
In the Data Preview table, we can see that we have rows 0 to 4, and 22 to 24. All the rows in between 4 and 22 are the empty space between the ground and the clouds. We will now add null values for the empty space.
6. Create the Null Rows
To create the Null rows, we must first we will use a Creator and a FeatureMerger transformer.
Add a Creator to the canvas, in the parameters set the Number to Create to 25. 25 is the number of tiles we created with the Tiler.
Next, add a FeatureMerger to the canvas. Connect the CoordinateSwapper_2 Output port to the FeatureMerger Requestor input port and the Creator Created output port to the FeatureMerger Supplier input port:
Open the FeatureMerger parameters and set the following:
- Requestor: _row
- Supplier: _creation_instance
-
Feature Merge Type: Merge Attributes and Replace Geometry
- This will ensure the point cloud geometry is preserved
7. Add a Sorter
To ensure that the _row attribute will be in numerical order with the features we created with the Creator, we need to sort it.
Add a Sorter transformer to the canvas. Connect both the FeatureMerger Merged and UnusedSupplier output ports to the Sorter Input port.
In the Sorter parameters, set the following:
- Attribute: _creation_instance
- Alpha/Num: Numeric
- Order: Ascending
- Sorting Exceptions: Output Last
8. Run the Workspace
Run the workspace again and inspect the Sorter Output port. We can see that the _row attribute is in numerical order with rows 5 to 21 having <missing> for the value.
In the next steps we will remove all the <missing> rows and any rows after the <missing>, which contain the clouds.
9. Add an AttributeCreator Transformer
We will use two AttributeCreators to select the rows with <missing> values and any rows after the rows containing <missing>.
Add an AttributeCreator to the canvas and connect its Input port to the Sorter Output port. In the parameters dialog, set the output attribute:
- Output Attribute: Remove
In the Value box, click on the drop-down and select Conditional Value.
In the Conditional Value Definition dialog, double-click the first Test condition box next to If. In the Test Clauses table, set the following:
- Left Value: _row
- Operator: Attribute Is Missing
- Right Value: <Unused>
- Value: Delete
Click OK three times to save the parameters for the AttributeCreator.
Next, add another AttributeCreator and connect it to the first AttributeCreator’s Output port.
Open the parameters for the AttributeCreator_2, expand the Advanced: Attribute Value Handling section, and set the following:
- Enable Adjacent Feature Attributes: Enabled
- Number of Prior Features: 1
- Output Attribute: Remove
Again, open up the Conditional Value dialog under the Value field.
In the Conditional Value Definition dialog, double-click the first Test condition box next to If. In the Test Clauses table, set the following:
- Left Value: feature[-1].Remove
- Operator: =
- Right Value: Delete
- Value: Delete
When we enabled Adjacent Feature Attributes, the feature[-1] became available. This will select all of the rows with a value of Delete.
Click OK three times to complete the second AttributeCreator.
10. Test for Delete
We will now test for rows where the Remove attribute is not equal to Delete. Add a Tester transformer to the canvas and connect the AttributeCreator_2 Output port to the AttributeCreator Input port.
In the Tester parameters set the test:
-
Left Value: Remove
- Use the drop-down arrow to select the attribute under Attribute Value
- Operator: !=
- Right Value: Delete
This will send any of the rows that we have set the Remove field value to Delete to the Failed output port on the Tester. If you run the workspace, five features should pass and the other 20 should fail.
11. Clean Attributes with an AttributeKeeper
Before we can write out the data out, we want to remove any unnecessary attributes with an AttributeKeeper.
Add an AttributeKeeper to the canvas and connect the Tester Passed output port to the AttributeKeeper Input port. Open the parameters and set the attribute to keep:
-
Attributes to Keep: fme_basename
- Click the ellipsis to select from the list of attributes
12. Combine Point Clouds with an PointCloudCombiner
The final step before writing the point cloud is to combine the tiles we created using a PointCloudCombiner transformer.
Add a PointCloudCombiner and connect its Input port to the AttributeKeeper Output port. Since we didn’t modify the point cloud in any way except for removing points, we can leave the parameters as the defaults.
13. Run the Workspace
Lastly, we can add our desired output format writer and connect it to the PointCloudCombiner Output port. Otherwise, run the workspace and inspect the PointCloudCombiner output port. We should have a single point cloud, with no (red) cloud noise.
Additional Resources
Tutorial: Getting Started with Point Clouds
Thinning and Combining Point Clouds
CoordinateSwapper Transformer Documentation
Tiler Transformer Documentation
Data Attribution
The data originates from West Virginia View, a member of AmericaView and the USGS. It contains information provided by the West Virginia GIS Technical Center. Copyright © 2019 West Virginia GIS Technical Center, all rights reserved.