Skip to main content
So, I have .dgn data with waters of certain area. The problem lies in rivers since I want them to have descending elevation as river aproaches ocean or sea or other water body. Basically I'd like to test elevation of vertices of polyline of river so that it marks me those that are ascending in descending order. Any ideas?
Chopper (lines to vertices) & attributecreator (advanced / prior) should do the job.
Chopper, max 2 verts.

 

 

Aquire angle of lines. Check if agles are in same relevant quadrant.
NielsGerrits, that was my idea: explode everything on vertices and calculate test if difference of neighbouring vertices A-(A+1)>0. The problem is that I don't know how to say that in AttributeCreator or Tester. The other problem is that based on start point of polyline the statement might be <0.

 

 

Gio, I didn't think of that but it works: Of course, first you need to do is CoordinateSwapper and then see if the Azimuth goes to different quadrant. Still, there lies a problem where is the start point of polyline. So the trick is to construct a conditional statement for findning different quadrant in one that most of polyline is.
Hi,

 

 

try the following code in a PythonCaller, it will output one point feature at each vertex of a polyline that has a higher z-value than the previous vertex:

 

 

---

 

import fme

 

import fmeobjects

 

 

class ZDirectionTester(object):

 

    def __init__(self):

 

        pass

 

        

 

    def input(self, feature):

 

        # For each feature, test that Z coordinate values are in

 

        # descending order. If not, output point features on the

 

        # offending vertex

 

        coords = feature.getAllCoordinates()

 

        z_values = ecA2] for c in coords]

 

        for n, z in enumerate(z_values):

 

            if n == 0:

 

                prev_z = z

 

            else:

 

                if z > prev_z:

 

                    point_feature = feature.cloneAttributes()

 

                    point_feature.addCoordinate(*coordsfn])

 

                    point_feature.setGeometryType(fmeobjects.FME_GEOM_POINT)

 

                    self.pyoutput(point_feature)

 

                prev_z = z

 

                    

 

    def close(self):

 

        pass

 

---

 

 

David
Hi,

 

 

If you chop the polyline into individual line segments (use a Chopper with Maximum Vertices = 2), you can determine whether each segment is z-ascending or z-descending by comparing z-values of its start and end nodes.

 

You can use two CoordinateExtractors to extract z-values of start and end nodes.

 

 

But I think it would also be enought to compare z-values of start and end nodes of the original polyline, if your purpose is just to determine whether each polyline is z-ascending or z-descending. Because the vertices of a river line basically should be lined in the order of going gradually to either higher or lower.

 

 

Takashi

Reply