Showing results for 
Search instead for 
Do you mean 

Encode Height to Vertex Z

by Technical Evangelist on ‎08-23-2018 12:41 PM - edited on ‎02-24-2020 02:05 AM by Community Manager (463 Views)

Encode Height to Vertex Z


Download model





This model takes a 2D vector layer (one with no Z values associated with each vertex) and uses a raster DEM to assign heights to each vertex and thereby outputs a 3D vector layer (assuming the output format supports vertex Z values).


Optionally, the input features can be Densified to insert additional vertices. For example, if the DEM has a 30m pixel size, it may be beneficial to ensure the maximum distance between vertices on any input feature geometries is set to 30m. If you do not want any additional vertices to be added simply leave the Densify Max Distance field blank and no Densification will occur.


The Geometries are Densified using the new Generate Functional Attributes operator. The general expression that would be used inside the Generate Functional Attributes operator would be in the form "DENSIFY(FeaturesIn.Geometry, 30)". However I wanted to enable this model to prompt for the Maximum Distance parameter. So the Generate Functional Attributes operator is fed by a Define Functional Attribute operator which is capable of taking an input string and turning it into the Functional Attribute data type required by Generate Functional Attributes. That string in turn is constructed from the user-defined Densify Max Distance parameter and other strings Concatenated together (using the Cat operator).




Raster DEM heights are in Meters. If your DEM does not have heights measured in meters you should modify the Elevation Units ports on Ground to Image and Image to Ground.


The Raster DEM should be complete (no NoData holes) and cover at least the extent of the feature geometries to be attributed with Z values. Otherwise you will end  up with a mixture of vertices with true heights and those with 0. 


The input DEM and Features need full projection information to ensure that they can be spatially intersected correctly.


Preferably the Raster DEM should also have Elevation Information set on its header. 


Input parameters:

Input 2D Features: Filename of input vector features which lack height information associated to each vertex.

Density Max Distance: The maximum distance between vertices along the sequence of vertices, in meters. This parameter is optional and can be left blank if no Densification is desired.

Input Raster DEM: Name of the raster DEM from which to derive vertex height information. Height values should be in meters.

Output 3D Features: Filename of the output which will have x,y,z vertices. Ensure you use a format, such as Shapefile, which supports x,y,z vertices.