Skip to main content
Question

Get First and Last Vertex of aggregated lines

  • August 22, 2025
  • 2 replies
  • 95 views

katt
Supporter
Forum|alt.badge.img+12

Good day, I have some line segments that I aggregate based on an attribute in common. After the aggregation I would like to extract the coordinates of the first and the last vertex of the aggregated line (in green). I am using the coordinate extractor at coordinate index -1 and 0. The coordinate values I get as the result are not the first and last vertex of the combined line. I think the problem is that the new line is a multi curve. How can I extract these coordinates (in green) ?

2 replies

DanAtSafe
Safer
Forum|alt.badge.img+20
  • Safer
  • August 22, 2025

Hi ​@katt Use a TopologyBuilder where you set a list for the edges, then count the list elements on the nodes.  The end nodes will be where the number of elements in the list = 1.

 


takashi
Celebrity
  • August 23, 2025

Hi ​@katt ,

Alternatively, if the individual segments (parts) in a MultiLine geometry (aggregated lines) are connected at their end nodes each other, you can convert it to a Line or a Path geometry with LineCombiner and then extract the coordinates of the first ad the last vertices with CoordinateExtractor. To restore the original MultiLine geometry, you can use a pair of GeometryExtrator and GeometryReplacer.

See also the screenshot below.