Solved

Removing all intermediate vertices from polylines


Hi,

I have searched everywhere but can't seem to find a solution to a this simple task.

I want to remove all intermediate vertices from my polylines, result should be polylines consisting of just the original start and ending points.

Can anyone point me in the right direction? Thanks!

icon

Best answer by takashi 5 June 2017, 12:28

View original

3 replies

Userlevel 2
Badge +17

Hi @johannesbloemen, the CoordinateRemover transformer might help you.

  • Keep or Remove Coordinates: Remove
  • Coordinate Index: 1
  • Number to Remove: @NumCoords()-2

Userlevel 2
Badge +16

Another way:

Use two CoordinateExtractor transformers (index 0 for start and -1 for end points) to store coordinates in attributes.

Then a VertexCreator (using start coordinates from attributes and setting to replace geometry with point) to create the start point.

And a second VertexCreator (using end coordinates from attributes and setting to add a vertex) to create the line from start to end point.

Hi @johannesbloemen, the CoordinateRemover transformer might help you.

  • Keep or Remove Coordinates: Remove
  • Coordinate Index: 1
  • Number to Remove: @NumCoords()-2

Thank you takashi, that did the trick.

 

 

Reply