Skip to main content

So, our organisation has a maintenance management system for our roads, which now for some reason, no longer works with geometry which has duplicate nodes within the same polyline. I’ve been able to narrow this down to two cases where our road polylines layer violates this rule:

  • Some roads have duplicate consecutive nodes due to mapping mistakes, which I’ve fixed with GeometryValidator.
  • Some roads (such as roundabouts and parking area outlines) have the same start and end node. This is where I’m getting stuck.

The potential solution that I’m looking for is something that can determine the polylines with the same start and end point with a small tolerance (0.1m would do the trick) as I could only get GeometryValidator to work as expected with this tolerance, then offset the end node by a small figure (perhaps 0.5m) back toward the penultimate node. This way, the polyline still keeps enough of the line to be usable, but will work with the management system. But, I’m happy to note any other more do-able ideas if there’s any. Is there a transformer(s) that will be able to accomplish this?

I’m running FME Form 2024.0.1.0.

Thanks :)

The workflow depends a bit on your coordinate system and how resilient you need the workspace to be.  But, one approach is:

  1. Use the “coordinate extractor” to extract the 1st and last points.  Note, -1 gives you the last point.
  2. If you have cartesian coordinates, then use pythagorus theorem to calculate the distance between the points.  Other options to achieve the same outcome are using a bounding box for the 2 points or creating a line and calculating the length.
  3. Test the distance, if the end points are too close, then use the “Snipper

GeometryCoercer with Geometry Type fme_polygon will identify lines that are closed. After you restore the geometry, you can shorten both ends of the line by 0.05m using the LineExtender (use the feature exiting the Stretched port).

 


And a third approach:

I'm using the ClosedCurveFilter to see if there's closed lines (first vertex equals last vertex). If found, I grab the coordinates of the first vertex and create a point there with the VertexCreator, which I then buffer slightly. That buffer is then used to clip the original line.


And a third approach:

I'm using the ClosedCurveFilter 

Interesting, I learned something new today!

Combining these ideas leads to a very compact workflow:

 


Fantastic responses all. Consider this resolved with the help of ClosedCurveFilter and LineExtender. Unfortunately, the pythagoras method didn’t work as FME couldn’t calculate the expression for some strange reason, resulting in the field defaulting to null (all input and output fields were real number fields). This should work in theory, provided I’m using a GDA projection system (and it worked as expected when calculated in Excel using a couple of samples).

Thanks all!


Reply