Skip to main content
Solved

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

  • October 25, 2022
  • 1 reply
  • 13 views

Forum|alt.badge.img

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.

Best answer by markatsafe

@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

View original
Did this help you find an answer to your question?

1 reply

Forum|alt.badge.img+2
  • Best Answer
  • October 25, 2022

@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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings