Skip to main content
Question

Change some Z-Values for every Vertex (Line, Area Features)


Hi,

I have a FileGeodatabase and want to change some Z-Values from Line and Area Features (with all kinds of Geometry).

For Example i just want to set all Z-Values which include 99 or 0.153 to 0 and keep all other Vertex Z-Values.

The Elevation Extractor gave me only the first Z-Vertex-Value to manipulate. The 3D- Forcer changes every Z-Value. The Offsetter is not the right one either.

I tried the Coordinateextractor an Coordinatereplacer but i dont know how to put my changes to every list element.

I dont want to destroy the geometry (with Chopper or something else). I just want to add these simple changes for the height.

My further suggestion are maybe some FME-Feature-Functions tricks with Expressionevaluator or a Python Skript?

Can you help me or give me hint?

 

Thank you

Richard

2 replies

ebygomm
Influencer
Forum|alt.badge.img+38
  • Influencer
  • May 20, 2020

No idea if it will work on the more complex geometries but you could potentially do something like this

import fme
import fmeobjects

def shiftz(feature):
    zshift = [0.153,99]
    coords = feature.getAllCoordinates()
    for i in range(len(coords)):
        if coords[i][2] in zshift:
            coords[i] = (coords[i][0],coords[i][1],0)
        else:
            coords[i] = (coords[i][0],coords[i][1],coords[i][2])
        
    feature.resetCoords()
    feature.addCoordinates(coords)

debbiatsafe
Safer
Forum|alt.badge.img+20

A method that doesn't use Python would be to use the GeometryExtractor (extract as GeoJSON), use Regex to replace 0.153] or 99] with 0] in the StringReplacer, and then GeometryReplacer. You would have to check incoming features are 3D, otherwise you may replace a vertex's y-value.


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