Solved

Remove intermediate vertices by converting arcs into true arcs


Badge

My ultimate goal is to remove as many vertices along the polylines while maintaining the shape of the line. My data is coming from a GDB and consists of complex line segments containing straight lines and curves (i.e. one line can have a curve and a straight segment). I've used the generalizer transformer to remove as excess vertices but it is not working well around the curved line segments. I want to turn these curved segments into true arcs to remove all the excess vertices. Please see my workflow below:

The output from this workflow is not working, see below:

 

 

Based on the pre and post coordinate count, vertices are not being removed. I have added my template with the workflow and test data. Any help would be appreciated @nathanatsafe

icon

Best answer by markatsafe 7 June 2019, 20:58

View original

9 replies

Badge +2

@cshir065 Thanks very much for including a small sample dataset and a sample workspace.

Your best bet is the Curvefitter. This does a really excellent job of recovering arcs and making a path of the resulting arcs and lines. Unfortunately it is an extra cost plugin as the technology was developed by TCI Corp. See the FME user documentation.  Contact info@safe.com for more details and a trial.  I've attached an example workspace: arctestwithcurvefitter.fmw

Here's and example of the results from one of the lines in your sample data:

IFMEPath (2 Segments)    Closed    No    Segment 0: IFMELine (2 Coordinates)    (6767153.311706543, 2026024.479309082), (6767196.301086426, 2025991.6279296875)        Closed    No        Coordinates (2)    Coordinate Dimension: 2            0    6767153.311706543, 2026024.479309082            1    6767196.301086426, 2025991.6279296875    Segment 1: IFMEArc    Arc By Bulge        Closed    No        CW/CCW    Counter Clockwise        (Circle) Radius    69.27670817794568        Start Point    6767196.301086426, 2025991.6279296875        End Point    6767235.307922363, 2026119.8516845703        Bulge    0.7716618586085159        Rotation (Degrees CCW)    0        Start Angle (Degrees CCW)    267.7677619793752        Sweep Angle (Degrees CCW)    150.62399731377545

 

0684Q00000ArKLrQAN.png

The ArcEstimator can also be used, but only if you know which parts of the line are the arc - which in your sample data you don't 

Badge

Thank you @markatsafe, for the quick response!

 

Userlevel 2
Badge +17

An interesting challenge. If it's true that continuous segments within an arc section have approximately same length, this experimental workspace could work.

arc-estimater.fmwt (FME 2019.0.1)

Badge +3

@cshir065

 

Hi,

 

You can seperate arcs, lines and (likely) beziers.

 

Chop the lines by 2 vertices.

Arc parts have the same angle difference and same lenght difference for any adjacent line (2 vertice piece).

When you got those, any 2 of the vertices is enough to calculate the circle-part (arc)

 

Bezier has some varying values. You can find them by calculating the probable bezier for 2 parts and extend the calulation to its neighbours. Until it fails, in case which you have reached its "border".

I have not done latter though, as it is quite some math. But i suspect @takashi can.

He had some bezier work on this forum a couple(?) of years ago, is why.

 

Main fme feaure used would be adjacent feature in the attribute creator (@safe: why don't we have adjacents in the tester ???)

 

Here is a piece is without any calculations (takes some work and time)

arctest.fmw

(not an fmwt as it is your testdata used in the script. You got to add it)

 

Badge +3

@cshir065 Thanks very much for including a small sample dataset and a sample workspace.

Your best bet is the Curvefitter. This does a really excellent job of recovering arcs and making a path of the resulting arcs and lines. Unfortunately it is an extra cost plugin as the technology was developed by TCI Corp. See the FME user documentation.  Contact info@safe.com for more details and a trial.  I've attached an example workspace: arctestwithcurvefitter.fmw

Here's and example of the results from one of the lines in your sample data:

IFMEPath (2 Segments)    Closed    No    Segment 0: IFMELine (2 Coordinates)    (6767153.311706543, 2026024.479309082), (6767196.301086426, 2025991.6279296875)        Closed    No        Coordinates (2)    Coordinate Dimension: 2            0    6767153.311706543, 2026024.479309082            1    6767196.301086426, 2025991.6279296875    Segment 1: IFMEArc    Arc By Bulge        Closed    No        CW/CCW    Counter Clockwise        (Circle) Radius    69.27670817794568        Start Point    6767196.301086426, 2025991.6279296875        End Point    6767235.307922363, 2026119.8516845703        Bulge    0.7716618586085159        Rotation (Degrees CCW)    0        Start Angle (Degrees CCW)    267.7677619793752        Sweep Angle (Degrees CCW)    150.62399731377545

 

0684Q00000ArKLrQAN.png

The ArcEstimator can also be used, but only if you know which parts of the line are the arc - which in your sample data you don't 

Perhaps it is possible to combine the answers of @gio and @markatsafe

With the adjacent features you can create groups. Having these groups, you can use the ArcEstimator transformer to replace them with arcs.

Badge +3

@lars_de_vries @cshir065

 

When a group of possible arc is extracted you can get any 2 points of it to claculate the arc.

The section can be determinde by the first and last vertex in the set.

Best done by using a groupbyvalue.

 

For reverse-engineering lines to curves (non arc curves), a bit more math is required.

Badge +3

@cshir065

 

Here is example with arcestimator for any arcs.

arctest.fmw

Only the larger set (more then 2 parts) is arced, the rest seems like a "broken" arc (i assume someone edited the objects)

You can arc the smaller pairs if you want by filtering for 2 part sets and extracting outer 2 vertices and one between.

Badge

@cshir065

 

Here is example with arcestimator for any arcs.

arctest.fmw

Only the larger set (more then 2 parts) is arced, the rest seems like a "broken" arc (i assume someone edited the objects)

You can arc the smaller pairs if you want by filtering for 2 part sets and extracting outer 2 vertices and one between.

Thank you, @gio

I'm going to delve deeper into these solutions next week and I'll post if I have questions/comments. Thanks for all the help :)

I also have a 30-day trial with the Curvefitter transformer so we will see how it goes.

Badge

@gio @takashi @markatsafe

I tried a couple of the workflows provided by everyone and the best answer was to use the CurveFitter transformer. It removes all the unnecessary vertices while maintaining the shape of the line when a low tolerance is set. Thanks again for all the help, I appreciate it.

Cathy

Reply