FME Version
Files
Introduction
Triangular irregular networks (TIN) represent a continuous surface with a set of non-overlapping triangles. In FME 2022, we've added Solid and Surface clipping, which makes it easier than ever to quickly clip the data to the desired area.
Previously, in FME 2021.2 or prior, TINs could not be clipped directly with the Clipper, if you are using an older version of FME, the workaround to perform this action is still available in this article.
Step-by-Step Instructions
FME 2022 or Newer
In FME 2022, solid clipping was included in Version 14 of the Clipper, which makes it simple to clip any surface. If you are using FME 2021.2 or prior, and are not able to upgrade to FME 2022 or newer at this time, please see the instructions for surface clipping further down in this article.
1. Read in the DEM
Open FME Workbench and in a blank workspace, add a U.S. Geological Survey Digital Elevation Model (USGSDEM) reader and read in the source raster data, RasterDEM-250k.dem, which is available for download in the Files section.
2. Create TIN from the Raster with TINGenerator
To create a TIN from the raster, we need to use a TINGenerator transformer. Add a TINGenerator to the canvas and connect the Points/Lines input port to the USGS_DEM reader feature type.
In the parameters, set the Surface Tolerance parameter to 5, which determines the number of points used as the vertices for the surface model. The larger the value, the more input points will be filtered out.
3. Create an Irregular Boundary for Clipping
We will use a polygon as our clipping boundary. Add a Shapefile reader to the canvas and browse to the ClippingBoundary.zip file. This boundary is just a randomly generated polygon to demonstrate this example.
4. Clip Surface
Add a Clipper to the canvas and connect the ClippingBoundary reader feature type to the Clipper input port, then the TINSurface output port on the TINGenerator to the Candidate input port on the Clipper. Note that clipping surfaces is only available in FME 2022 or newer, please see the next example for how to do this in FME 2021.2 or prior.
To uncross the connection lines, right-click on the Clipper input port and select Move Down.
5. Inspect Output
Connect an Inspector transformer to the Inside output port on the Clipper and then run the workspace. View the output in Visual Preview.
FME 2021 or Prior
In FME 2021.2 or prior, the Clipper does not support clipping of surfaces. To get around that, a mesh is created, then the TIN surface is added post clipping. If performing this process often, it is recommended to upgrade to FME 2022 or newer.
1. Read in the DEM
Open FME Workbench and in a blank workspace, add a U.S. Geological Survey Digital Elevation Model (USGSDEM) reader and read in the source raster data, RasterDEM-250k.dem, which is available for download in the Files section.
2. Create TIN from the Raster with TINGenerator
To create a TIN from the raster, we need to use a TINGenerator transformer. Add a TINGenerator to the canvas and connect the Points/Lines input port to the USGS_DEM reader feature type.
In the parameters, set the Surface Tolerance parameter to 5, which determines the number of points used as the vertices for the surface model. The larger the value, the more input points will be filtered out.
3. Create an Irregular Boundary for Clipping
We will use a polygon as our clipping boundary. Add a Shapefile reader to the canvas and browse to the ClippingBoundary.zip file. This boundary is just a randomly generated polygon to demonstrate this example.
4. Drape the Polygon Boundary to the TINSurface with SurfaceDraper
The SurfaceDraper will be used to drape the polygon over our DEM. Add a SurfaceDraper to the canvas and connect the Shapefile Polygon to the DrapeFeatures input port and the TINSurface output port on the TINGenerator to the Points/Lines input port. In the SurfaceDraper parameters, set the Surface Tolerance to 5. It’s a good idea to have the Surface Tolerance the same as in the TINGenerator.
5. Clip the TIN
Add a Clipper to the canvas and connect the Triangles output port on the TINGenerator to the Clippee input port on the Clipper. Then connect the DrapedFeatures output port on the SurfaceDraper to the Clipper input port on the Clipper. This will clip the triangles created from the TINGenerator with the draped polygon boundary.
6. Regroup the Clipped TIN Triangles into a Multi-Surface
Now we will use a set of transformers to recreate single mesh geometry for the clipped TIN triangles. Add a FaceReplacer to the canvas and connect it to the Inside output port on the Clipper. Then connect an Aggregator to the FaceReplacer. In both transformers, we can use the default settings.
The FaceReplacer will first replace the clipped features with faces, which are the planar areas in 3D space. The faces are then aggregated into a multi-surface geometry, which is suitable for most of the FME 3D writer formats.
7. Convert the Multi-Surface into a Mesh
A mesh is a much more efficient representation than a multi-surface, we will use a Triangulator to convert the multi-surface into meshes, then a MeshMerger to group them into a single mesh. Add a Triangulator to the canvas and connect it to the Aggregator. Then connect a MeshMerger to the TINSurface output port on the Triangulator.
8. Run the Workspace
Add an Inspector to the MeshMerger then run the workspace. View the output in Visual Preview. Use the Orbit tool to move around the polygon mesh to see the changes in elevation.
Alternative
Step 2 and Step 3 for the FME 2021.2 or Prior method, can be combined into one step by replacing the TINGenerator and SurfaceDraper with SurfaceModeller, which will create the triangulation and drape the polygon boundary to the surface model at the same time. Also note when the Output Contours option in the SurfaceModeller parameters is enabled, triangles output from the transformer may have a different set of results, as the input points along contour intervals may be perturbed or removed. See the complete workspace ClipTINSurfaces_SurfaceModeller.fmwt for more details.
Data Attribution
The data used here originates from data made available by the Government of Austin, Texas. It contains information available to the public domain
Comments
0 comments
Please sign in to leave a comment.