Profiling and Slicing Point Clouds

Liz Sanderson
Liz Sanderson
  • Updated

FME Version

  • FME 2022.2

Introduction

Construction surveying requires a variety of measurements and knowledge of the surrounding area. Although using a single shapefile can aid in identifying where certain survey points should be within an area or along a road, it is limited in its ability to describe the natural land features. In the example below, we show how information can be extracted using both a shapefile and LAS point cloud to begin surveying for a mock road upgrade. This process is much more realistic for surveyors and engineers that may require ground data prior to any sort of construction. We will demonstrate how to buffer the road and create cross-sections that are evenly spaced along a highway with the LAS point cloud data.

 

Step-By-Step Instructions

Part 1: Creating Cross-Section Slices

The steps below outline how to use a shapefile with a point cloud to identify cross-sections along a section of highway using the lidar-slices.fmwt workspace available in the Files section of this article. Shapefiles are useful for understanding the geometry of a feature, but the addition of LAS data provides information about both the feature and the surrounding area with elevation data. This means in addition to locating equally spaced cross-sections, you will also have a better idea of the landscape that you are working in, which is extremely important when improving infrastructure.
 
image.png
 
1. Add the Data
Add an Esri Shapefile reader to the workspace to input the road shapefile “Glenville.shp”.

2. Isolate Area of Interest
We are interested in the section of Highway 33 that touches Highway 5. To get this portion of the highway, first, add a TestFilter and connect it to the Glenville reader feature type. Double-click the left cell in the first row (called If) to fill in the Test Conditions. In the Test Conditions dialog, set the Left Value to “ALT1_NAME”, Operator to “=”, and the Right Value to “BURNSVIL GLENVIL GRANTSVIL”, click OK to close the dialog. Name the output port to “STATE HWY 5”. Next, double-click the left cell in the second row (called Else If) and set the Left Value to “HWYNAME”, Operator to “=”, and the Right Value “US HWY 33”. Name the output port to “US HWY 33”.
 
image.png
 
3. Add a SpatialFilter
Now add a SpatialFilter transformer and connect the STATE HWY 5 output port to the Filter input port. Connect the US HWY 33 output port to the Candidate input port. 
 
image.png
 
Uncheck the Merge Attributes box in the SpatialFilter parameters and leave the other parameters as is. The passed sections of road are the parts of Highway 33 that touch Highway 5.
 
image.png
 
4. Add a LineCombiner
Add a LineCombiner and connect the Passed outputs from the SpatialFilter to the input port. Set Accumulation Mode to Drop Incoming Attributes. This creates a single line feature that will simplify further processing.

5. Create and Buffer Cross Sections
Now connect the Line output to the input port of the custom transformer called CrossSectionsCreator. This custom transformer will output lines that are perpendicular to the highway at equal intervals of 500 map units (excluding the last cross-section line, which is drawn at the end of the highway). This value is pre-set in the custom transformer, but can be changed by editing the custom transformer. More information on how to do this in this article: Creating a New FME Transformer.

6. Add a Bufferer
We are now interested in buffering the cross sections. Add a Bufferer and connect the Output cross sections to the input port. Change the parameters so that Buffer Amount is set to 50 and both the End Cap Style and Corner Style are set to Round.

image.png

7. Retrieve LAS Ground Points
We will now add our LAS data set “Glenville_PC.las" to the workspace using an ASPRS Reader with default parameters. 
Add a PointCloudSplitter and connect the LAS reader to it. Set the parameters so that the point cloud is Split By classification, the Split Type is Unique and the Output Attribute Name is _classifcation.

image.png
 
Add a PointCloudLASClassifier custom transformer to the canvas and connect it to the PointCloudSplitter Split output port. 

8. Add Another Bufferer
Before further manipulating the point cloud, first connect the Line output from the LineCombiner to another Bufferer. In the Bufferer_2 parameters, change the Buffer Amount to 200 and set both the End Cap Style and Corner Style to Round.

9. Add a Clipper
Add a Clipper transformer to the workflow. Connect the 2-Ground output from the PointCloudLASClassifier to the Candidate input. Connect the Buffered line from the Bufferer_2 to the Clipper Clipper input port.

10. Clip Point Cloud to Highway
Now add a PointCloudCombiner transformer and connect the Inside Clipper points to the input port. The default parameters can be accepted for the PointCloudCombiner.

11. Clip Point Cloud to Cross Sections
Add a second Clipper and connect the Output combined points to the Candidate input port. Check the Merge Attributes box in the parameters. Connect the Buffered cross sections (from the first Bufferer) to the Clipper_2 Clipper input port.

image.png
 
12. Add a Counter
Connect the Inside outputs from the Clipper_2 to a Counter transformer.
The output of the Counter is the final product and can be viewed using an Inspector transformer and viewed in Visual Preview. Alternatively, the output can be written using an ASPRS Writer, Pointools POD, or Bentley MicroStation Design (V8) for viewing in MicroStation.

13. Visual Preview the Results
The images below show the resulting output point cloud cross sections in 2D and 3D along the section of highway that we were interested in. In image (a) you can see that the cross sections were accurately drawn to be perpendicular at each 500 unit interval so each cross-section is on a slightly different angle than the others.
(a) 

<>slices1.jpg

In image (b) you can see that by using a 3D point cloud to represent each cross-section we get a better sense of what the highway and surrounding area look like in reality versus using 2D shapefiles.
(b) 

slices2.jpg

 

Part 2: Creating Cross-Section Profiles

Two-dimensional profiles of cross-sections can help to emphasize the natural landscape in the area that you will be working in using the lidar-profiles.fmwt workspace available in the Files section. With a highway improvement, this can help with understanding what kind of work will be required for widening a highway or which locations will require more or less analysis prior to construction. For example, if you can see in a profile that the cross-section is quite steep, you will know that this location may require further analysis to ensure that the ground is stable. The steps below use the previously created cross-section slices to create profiles. This example will work off the previous workspace by adding more transformers following the end of Part 1, which ended with a Counter transformer.
 
image.png
 
1.  Add a BoundsExtractor
Connect the Counter Output to a BoundsExtractor. The parameters can remain as the defaults. This transformer will add minimum and maximum x, y, and z coordinate attributes to the point cloud slices.

2. Rotate Slices
Now we will connect the BoundsExtractor outputs to a Rotator transformer. Use the drop-down arrows to the right of the parameters to set each to an Attribute Value. Set Rotation Angle (degrees) to “acAzimuth”, X Origin (Vector Only) to “_xmin” and Y Origin (Vector Only) to “_ymin”. This will rotate each slice so that they are all parallel to each other.

3. Add two ExpressionEvaluators
Add an ExpressionEvaluator and connect the Rotated outputs to the input port. In the parameters, set New Attribute to _offset_x. Fill in the Arithmetic Expression box with:
 -@Value(_xmin)

image.png
 
Add another ExpressionEvaluator connected to the previous ExpressionEvaluator. This transformer will focus on the y coordinates. Set the New Attribute to _offset_y and fill the Arithmetic Expression box with: -@Value(_ymin)

4. Align the Slice Around the Same Origin
Connect an Offsetter transformer to the ExpressionEvaluator_2. Change the parameters so that X Offset is set to _offset_x and Y Offset is set to _offset_y. The Z Offset should remain as 0. This transformer will move each slice so that the bottom left point of the original bounds around each slice (not the bottom left point of the actual point cloud slice) align at point 0,0. The slices themselves will now overlap in the same general area.

5. Create Points from Point Cloud
To create the profiles, we will need the points in the point cloud to be read as feature points instead. Add a PointCloudToPointCoercer and connect the Offseter to the input port. Set the Output Geometry in the Parameters to Individual Points.

6. Create Profiles
Now, we will use a CoordinateSwapper transformer. After connecting the PointCloudToPointCoercer output to the input port of the CoordinateSwapper, change the Swap Type in the parameters to Y< - >Z. Because we are moving from a 3D X, Y, Z coordinate system to a 2D X, Y coordinate system to display the profiles, we want to essentially flip the viewing angle of the slice so that we are looking at the curve of the profile. This is what this transformer will do.


image.png
 
7. Add a 2DForcer
Connect a 2DForcer transformer to the output of the CoordinateSwapper to remove the Z values of each feature.

8. Add a Scaler
Add a Scaler. Change the Y Scale Factor in the parameters to 3. This will exaggerate the profile, which will help distinguish differences between the various profiles.

9. Extract Coordinates
Connect a CoordinateExtractor and change the mode to Specify Coordinate. Set the Default Z Value to -9999 and keep the other parameters set to their defaults.

10. Sort the Points
We will now use a Sorter transformer to sort the points by count (each count represents one cross section) and x value. This will aid in drawing the profiles neatly. In the first row, set Attribute to _count, Alpha/Num to Numeric and Order to Ascending. In a second row, set Attribute to _x, Alpha/Num to Numeric and Order to Ascending.

image.png

11. Finalize Profiles
Finally, add a LineBuilder connected to the Sorted outputs. In the parameters, enable Group Processing, then set Group By to _count.
 
image.png
 
Add an Inspector connected to the Line output of the LineBuilder. Also, connect the Sorted points from the Sorter. By connecting both transformers to an Inspector we will be able to see both the points and the newly built lines. The result should look like the image below.

 

Additional Resources

 

Data Attribution

The data used here originates from open data made available by the West Virginia GIS Technical Center.

 

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.