FME Version
Files
Introduction
Since LiDAR point cloud data contains information about any surface that returns its laser, we can use it to model terrain as well as building shapes. This is exactly what we set out to do in this demo, where a LAS point cloud is used to (1) build a triangular irregular network (TIN) terrain model and (2) extrude building footprints to their actual 3D height. Each of these two steps becomes a layer in our output: a 3D model written to PDF that captures the urban built environment in a Vancouver neighborhood.
There are two tricks to this workflow: (1) extracting and replacing the building footprint geometry (vector data), and (2) clipping the point cloud using the building footprints. In short, we will isolate the point clouds for each individual building footprint, and then extrude these footprints into 3D solids.
CAD Building Outlines:
LAS Point Cloud:
Step-by-step Instructions
1. Read Source Point Cloud and Buildings
The point cloud data for the City of Vancouver is stored in the ASPRS LiDAR Data Exchange Format (LAS), an industry standard for 3D point clouds. Building outlines and base heights are read from a vector ACAD DWG file. Read in both files found in the Files section of the article.
Add a reader to the canvas for the LAS.laz file. Add another reader for the AutoCAD DWG building footprint file building_outlines.dwg. When reading in the CAD file, go into the Parameters and set Group Entities By to Attribute Schema in order to have access to the base heights attributes for extruding later.
2. Store Building Geometry
Add a GeometryExtractor and connect the building footprints to store the current geometry in an attribute on the feature. This can be very useful if a feature’s geometry has to be temporarily altered in order to obtain additional information, as is the case when we combine this data with the point cloud in the next steps. Extracting a feature’s original geometry allows it to be restored at any time. We’ll restore the building footprint geometry once we’re ready to extrude the buildings into three dimensions.
In the GeometryExtractor parameters, make sure that the Geometry Encoding is set to FME Binary and the Destination Geometry Attribute is _geometry. We will not need to remove geometry.
If you would like to run your translation now, adjust feature handling so that the translation doesn’t terminate when it rejects features. You can do this by going to: Navigator > Workspace Parameters > Translation > Reject Feature Handling: Change it to Continue Translation.
3. Filter the Point Cloud for Buildings
Classified point clouds will contain a component that stores the classification, usually as a coded numeric value. This classification is typically used to distinguish between points that belong to the ground, vegetation, buildings, etc. Add a PointCloudFilter to the LAS reader and use the following expressions to filter out points classified as Buildings or Ground.
Output Port: Buildings
Expression: @Component(classification)==6
Output Port: Ground
Expression: @Component(classification)==2
Here’s the workspace up to this point:
4. Clip the Point Cloud by the Buildings
To get height values for every building, clip the point cloud by the building outline features. Add a Clipper and connect the filtered Buildings points to the Candidate port and the building outlines to the Clipper port. To preserve the attributes of the Clipper, in the parameters, enable the Merge Attributes parameter. Then set the Accumulation Mode to Merge Clipper, and Conflict Resolution to Use Candidate. This means that we will keep the point cloud (Candidate) attributes and resolve any conflicts in merging by preserving the point cloud attributes. The result is a point cloud for every building!
5. Get Building Heights
Connect the Inside output port from the Clipper to a PointCloudStatisticsCalculator transformer. Open the PointCloudStatisticsCalculator parameters and enable Median for the z Component. Median is used since the roof provides most of the points in the point cloud. We don't use max point cloud height since this includes things like antennas that are not representative of actual building height.
6. Restore the Geometry
Use the GeometryReplacer to restore the geometry from the attribute _geometry. Now every building has its original vector geometry and has a value for median height derived from the point cloud.
7. Set Building Base Heights
Since the z.median value derived from the PointCloudStatisticsCalculator represents height above sea level and not the true height of the building, we need a logical way to find the height of the building based on the two pieces of elevation data that we have: the elevation of the building footprint (base_height) and the elevation of the building rooftop (z.median).
From the GeometryReplacer output, connect a 3DForcer to set the base heights to the base_height attribute from the source DWG building outlines. Once the base elevation is correct, we can accurately extrude the building height from the building’s base elevation to the median point cloud height using some simple subtraction.
If base_height is not appearing as an option for you, make sure that your reader parameters are set to Group Entries By: Attribute Schema. Replace the reader to access the additional parameters, if needed.
8. Extrude the Buildings
An extrusion is defined as the extension of an object by an additional dimension. In our case, we want to project our 2D building footprints into 3D buildings. To achieve this, we add an Extruder transformer connected to the output port of the 3DForcer to extrude the buildings by the rooftop height derived from the point clouds minus the base elevation. Use the Arithmetic editor in the Extruder and enter the following expression in the Distance field:
@Value(z.median)-@Value(base_height)
The 2D building outline polygons become 3D solids based on the height values of the building.
9. Create surface
A surface will be created with the ground points to fill in the terrain surrounding the buildings. Add a TINGenerator transformer and connect the Ground output port from the PointCloudFilter to the Points/Lines input port of the TINGenerator.
The surface tolerance parameter of the TINGenerator determines which input points are added as vertices to the model. In our case, a value of 1 is suitable. The larger the value, the more input points will be filtered out.
10. Write the Result
The TIN surface and extruded buildings can be written to any format that supports surfaces or meshes such as Sketchup, 3D PDF, AutoDesk FBX, etc. In this example, we will write to an Adobe 3D PDF and create two destination feature types, one for the building and one for the ground. Connect the extruded buildings and the TINSurface output port from the TINGenerator to their respective feature types.
To create a single pdf, you will write out two feature types into a single writer:
- Connect the Extruded output port of the Extruder to a 3D PDF Writer named ‘Buildings’.
- Select the TINSurface output port of the TINGenerator and go to Writers > Add Feature Type on the top menu bar. Name the feature type ‘Ground’ and select the existing writer from the drop-down menu.
Now, when you go to your Navigator to view the writers, notice that there are two Feature Types in the Buildings writer.
Run the workspace to generate a PDF file and view the PDF file with the Adobe PDF Reader. If you decide to make any changes and run the translation again, make sure that you have closed any open PDFs before starting the translation again.
Completed Workspace
Results
3D Model viewed in Adobe PDF Reader:
Alternate Approach
Building Heights from Point Cloud
If you don't have building height/elevation data present in your vector building footprints, you can retrieve the base heights of the buildings from the point cloud data rather than from the existing attribute. Before you extrude, it is best to drape the building outlines on the TIN surface. To create a flat base, there should be only one z value per outline. To achieve this, SurfaceDraper, CoordinateExtractor and StatisticsCalculator are a good place to start!
Conclusion
This workflow highlights the power of the PointCloudFilter for working with LAS files as well as the potential in FME to combine multiple files of different types into a valuable information product. With vector building footprints and a point cloud, we’ve extracted elevation data, merged the geometries, extruded 3D solids, and created a surface and building model that, once written altogether to PDF, can easily be shared and viewed in a PDF reader by colleagues unfamiliar with GIS or without access to FME Form.
Additional Resources
Data Attribution
The data used here originates from open data made available by the City of Vancouver, British Columbia. It contains information licensed under the Open Government License - Vancouver.
Comments
0 comments
Please sign in to leave a comment.