Solved

How to generate height lines with the same X, Y only in the third dimension using differences in Z coordinates?

  • 25 October 2022
  • 1 reply
  • 6 views

Badge

I have two polyline features. One which is on the ground surface and one below the ground surface on the exact same location. I want to generate height lines for each Vertex generated by the differences in Z-coordinates of the corresponding vertices of the 2 polyline features.

icon

Best answer by markatsafe 25 October 2022, 20:13

View original

1 reply

Badge +2

@sibe​ For each line, you can use CoordinateConcatenator to generate a comma separated list of the Z values and then use AttributeSplitter to generate a list attribute. Aggregate the two lines. You can the pass the two list attributes into a short PythonCaller script - something along the lines off:

import fme
import fmeobjects
 
def processFeature(feature):
    # initialize the python lists with FME lists
    _Z1 = feature.getAttribute('_Z1{}')
    _Z2 = feature.getAttribute('_Z2{}')
    
    _diffZ = []
    for i in range(len(_Z2)):
        _diff = float(_Z2[i]) - float(_Z1[i])
        _diffZ.append(_diff)
    # output the FME lists
    feature.setAttribute('_diffZ{}', _diffZ)

Force the Geometry to 2D (2DForcer) and then use FMEFunctionCaller to call:

@ZValue(_diffZ{})

as described by @Takashi Iijima​ here. For this to work your vertices have to line up, so you might have to use Intersector or Snapper  before hand

Reply