Using Terrain Extractor (Trex)

  Applies To 
  Product(s): WaterGEMS, WaterCAD, HAMMER, SewerGEMS,  SewerCAD, StormCAD, CivilStorm
  Version(s): CONNECT Edition
  Area:  Layout and Data Input

How to

Automatically assign ground elevation data to nodes using the TRex Terrain Extractor tool.


The Terrain Extractor (TRex) tool can automatically assign elevations to any nodes based on the nearest elevations from a contour DXF, shapefile, LandXML file, or spot elevations. If you are working in WaterGEMS, SewerGEMS, or HAMMER in the ArcGIS environment, there is the additional ability to assign elevation data based on TIN, DEM or Raster (such as TIF / TIFF) files. Nodes can include junction, hydrants, pumps, tanks, reservoirs, and valves. NOTE: Tank elevation or level range will not be included with TRex, only the ground elevation.

You can access TRex from the Tools menu. Most options are self explanatory, but the most important thing is that the contour must line up with the elements in the model. Meaning, the contour must spatially overlap the model, with both the model elements and the contours in the correct X:Y coordinates.

The "Select Elevation Field" is where you choose the field in your data source that contains the elevation values (at the specified "Z Units"). The "z coordinate" option will pick up on the built-in elevation associated with the data source (for example Shapefiles, where the spatial data is built-in). Other fields may show up in this dropdown if you have metadata (attributes/fields) in your data source that contains numeric values. For example you may have a field in a Shapefile to store an elevation, and this field may appear. If you unsure of what to select, you may need to first examine the data source in an external application (for example ArcGIS or QGIS for a Shapefile), consult with the person who provided the file to you, or use the "preview" option in ModelBuilder (for example start a new ModelBuilder run, select the same data source and look at the preview section to see the values in the fields).

If you want to apply elevation data for a selection of nodes instead of the whole system, choose the Selection or Selection Set radials in the section "Nodes to Update". For Selection, it will apply data to elements you have already selected in the drawing. For Selection Set, you can choose a selection set of elements to apply the data.



ESRI ArcMap integrated mode:

Note: When using TRex, it is necessary that the model and the DEM be in the same coordinate system. Usually the USGS DEMs are in the UTM (Universal Transverse Mercator) with North American Datum 1983 (NAD83) in meters, although some may use NAD27. Models are often constructed using a state plane coordinate system in feet. Either the model or DEM must be converted so that the two are in the same coordinate system for TRex to work. Similarly, the vertical datum for USGS is based on national Vertical Geodetic Datum of 1929. If the utility has used some other datum for vertical control, then these differences need to be reconciled.

Protecting Elements with Existing GPS Survey Elevations

In some cases you may have survey elevation readings with higher accuracy, which should be protected from Trex updates. Here are two approaches to consider:

1) Use ModelBuilder. Maintain a spreadsheet for your survey GPS elevations, linked to the element name and set up a ModelBuilder run for it. After doing a Trex update, click the "build model" button in ModelBuilder for the run you created, to update the Elevation field with the survey GPS elevations (that override the Trex imported ones). You can also create a User Data Extension to flag a node as having a survey-based Elevation, for reference. (see Help topic on User Data Extensions / UDX)

2) Maintain a selection set of elements that exclude the ones that have their elevations from GPS, and use that in the Trex Wizard. One option is to create a query-based selection set, based on a UDX flag field (for example a true/false "From GPS?" field, to only list elements that do NOT have higher-accuracy survey elevations.) Then, select that selection set in the Trex Wizard, so that Trex only updates elevations that do not have the more accurate survey elevations. As you get new survey/GPS elevations, you would update the elevation and toggle the "flag" UDX field, then re-run the query and re-open the selection set to refresh it, so that the Trex Wizard picks up on that change - see related article here.

If you're using the Terrain Model feature instead of Trex (see more on Terrain model below), then you would instead set the node field "Update Ground Elevation from Terrain Model?" to "false" for nodes that have higher accuracy survey/GPS elevations. That way, the elevations for those nodes will keep the higher accuracy values and the terrain model contour will not override.

What if I Have an Image From Google Earth?

The Bentley Civil products can create a terrain model from Google Earth data. If you have access to InRoads or Power Civil for example, you can create the terrain model using that product, as detailed here:

Create an InRoads DTM from Google Earth

This will create a .dtm file, which the Terrain Extractor tool can read, if you choose the Bentley DTM File option as the source data.

Can I Infer Elevations from Surrounding Elements, without a Terrain File?

If you do not have access to terrain data but want to populate missing elevations from surrounding nodes that do have elevations, see the following article: 

Inferring ground elevation from surrounding elements

Terrain Model Tool

Starting with the SELECTseries 5 release of the Storm and Sewer products, a new Terrain Model feature has been added, which allows you to activate a terrain model file in the model at all times. Elevations of nodes will then update automatically per the active terrain model, when the nodes are added or moved. For more on this, see the Help topic or the following articles:

What's new in SewerGEMS V8i SELECTseries 5?

What's new in SewerCAD V8i SELECTseries 5?

What's new in StormCAD V8i SELECTseries 5?

What's new in CivilStorm V8i SELECTseries 5?

What Method of Interpolation is used by Trex and the Terrain Model Tool?

Please refer to this article:

Interpolation Method Used by Terrain Extractor (Trex)

How can I use data from ContextCapture?

See article:

Consuming ContextCapture production files within your hydraulic model

How can I use LiDAR data?

If your LiDAR data is not already in one of the supported formats (see above - note the additional formats supported in the ArcMap integrated mode), it may need to be processed externally first. For example if it is raw LiDAR data, it may need to be processed into a TIN/DEM, which Trex can then use to assign node elevations. If it is available in raster/image format (for example see here or here), you should be able to use the "ArcGIS Raster" data source type when integrating with ArcMap (available with WaterGEMS, SewerGEMS and HAMMER).

If unsure, contact Technical Support with an example of the data you have, or the file type(s) or any other information about what you have.


Wrong elevations with Shapefile source: If you see wrong elevations extracted in the range of 1000 m, e.g. out of a shapefile, then please check if decimal separator symbol set to comma in your windows regional settings, if yes please change it to decimal points and then re-run TRex, it should import elevations correctly then. We have filed a defect for this as of version 10.03.xx.xx, reference number is #1088269, which shall be resolved in future releases of the product.

Nodes get assigned an elevation of zero: first, confirm that the data source aligns with the model. For example if it is a DXF or shapefile, try adding it as a background to see if it overlaps with the model elements. Next check the Elevation field that you selected in the Trex wizard to ensure it contains elevation data. Open the source file in its native application to check if the contours/points near your model node elements do indeed have elevation values for the selected elevation field. For example if you choose a DXF contour file that contains contour polylines in addition to polylines representing the model network, then Trex may try to assign elevations from those polylines since they are closest (if those lines were the source of the model network, imported with ModelBuilder). If this is the case, remove that layer in the DXF first or delete the polylines from the source file before importing with Trex. 

Memory-related errors: consider breaking the contour file into smaller chunks. See also: Memory error when using Terrain Extractor

Other troubleshooting: see links below or use the search bar above to find other articles in our Wiki

See Also

Trex error: "The data source file must contain at least three unclipped points in order to create an elevation map"

Error when using TRex: No Matching Data: All elements in the model fall outside the scope of the DEM.

Error using TRex - Circular list error clockwise

Error using TREX with LandXML file: "Object reference not set to an instance of an object."