Skip to main content
Solved

Removing all intermediate vertices from polylines

  • June 5, 2017
  • 3 replies
  • 179 views

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!

Best answer by takashi

Hi @johannesbloemen, the CoordinateRemover transformer might help you.

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

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

3 replies

takashi
Celebrity
  • Best Answer
  • June 5, 2017

Hi @johannesbloemen, the CoordinateRemover transformer might help you.

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


erik_jan
Contributor
Forum|alt.badge.img+23
  • Contributor
  • June 5, 2017

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.