FME Version
Files
-
- 600 KB
- Download
Introduction
Converting RGB and numeric raster data into point clouds can be useful if you wish to perform operations that can’t be done natively in a raster format. Point clouds are an efficient way to represent 3D data.
When we convert a raster to a point cloud, the point cloud will have components for each raster band—for example, an RGB raster will result in a point cloud with Red, Green, and Blue components. Since an RGB raster does not include height (z-value) information, it will not have a Z component, so the point cloud will be flat. On the other hand, a numeric Digital Elevation Model (DEM) has height values but no color, so it will create a 3D point cloud with no color components. Combining both types of rasters will result in a point cloud that has both height and color values.
This tutorial demonstrates how numeric and RGB rasters can be rendered into point clouds. In FME, the key transformer for this task is the PointCloudCombiner, which takes input geometries and combines them to output the data as a single point cloud.
Step-by-Step Instructions
In this scenario, we have both a Digital Elevation Model (DEM) and an RGB image representing the same area. We will combine and convert them into a colorized 3D point cloud. We will use the PointCloudCombiner transformer to perform this conversion.
Download the files attached to this tutorial to follow along in the steps below. The workspace template, “Convert Raster to Point Cloud.fmwt”, shows the completed workspace. The source datasets are the .tif and .dem files, which look like this when inspected:
When clipped to the same area, they look like this:
1. Start a new FME Workspace
Open FME Workbench and create a blank workspace.
2. Add a GeoTIFF reader for the RGB raster
The first step is to read in the source data. Drag BeaverLake.tif onto the canvas or click Add Reader, and set the following parameters:
- Format: GeoTIFF (Geo-referenced Tagged Image File Format)
- Dataset: /<Path to data>/BeaverLake.tif
3. Add a CDED reader for the DEM raster
Drag 092g06_0100_deme.dem onto the canvas or click Add Reader, and set the following parameters:
- Format: Canadian Digital Elevation Data (CDED)
- Dataset: /<Path to data>/092g06_0100_deme.dem
4. Prepare the rasters
Now that we have both rasters in the workspace, we have to synchronize them to the same coordinate system, extents, and resolution. Copy this sequence of transformers into your workspace from the attached template file:
a. RasterPropertyExtractor – exposes the GeoTIFF raster’s attributes
b. Reprojector – brings the DEM to the same projection as the RGB, which is UTM83-10
c. Clipper – clips the DEM to the extents of the RGB image
d. RasterBandInterpretationCoercer – changes the DEM interpretation to Real64 for a smoother output
e. RasterResampler – resamples the DEM to the same pixel size as the RGB
5. Add a RasterExpressionEvaluator
Add a RasterExpressionEvaluator to combine the two rasters into one four-band raster with R,G,B, and Z values. Connect the RasterPropertyExtractor output to the A port, and connect the RasterResampler output to the B port.
Open the parameters, and set the following:
- Mode: Two Rasters
- Band Expressions:
Green8 - A[1]
Blue8 - A[2]
Int32 - B[0]
These expressions tell the transformer to take the three RGB bands from the GeoTIFF raster — A[0], A[1], A[2] — and take the first band from the DEM — B[0].
6. Add a PointCloudCombiner
Add a PointCloudCombiner transformer after the RasterExpressionEvaluator. Leave the default parameters. This will space the output points at 1-unit (1-meter) intervals. You can change the Point Interval parameter to a larger number to speed up the processing time or a smaller number for fine-grained interpolation.
7. Add a LAS writer
Click Add Writer and set the following parameters:
- Format: ASPRS Lidar Data Exchange Format (LAS)
- Dataset: <Path to output folder>
- LAS File Definition: Manual…
On the Feature Type dialog that pops up, set the LAS File Name to BeaverLake. Click OK.
The resulting workspace should look as follows:
8. Run the workspace
Run the workspace and view the output. Note how the resulting point cloud is both colorized and elevated, i.e. it has R, G, B, and Z values:
Troubleshooting
If the log window shows:
| WARN |Spacing parameter given for grid creation will produce a very large number of points, consider increasing spacing
This warning is meant to alert you that your machine may take a while to run with your current settings. If you do find it taking too long, try adjusting the PointCloudCombiter’s Point Interval parameter to a larger number.
Additional Resources
[Tutorial] Working with Raster and Imagery Data in FME
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.