Skip to main content
Solved

merge multiple lines into one line

  • August 10, 2022
  • 4 replies
  • 1860 views

arash_hokm
Contributor
Forum|alt.badge.img+8

Hallo FME community,

I have many lines in a shapefile and some lines are connected to each other. I want to bring all lines that are connected together into one feature. I would be grateful if someone could give me an idea.

 

Best answer by dustin

If they are all end node connected, you can use the LineCombiner.

 

If they are not end noded, I would first use the NetworkTopologyCalculator transformer. This should tag each connected set of lines with a common attribute _network_id. From there, you can aggregate those lines into one feature with Aggregator with Group By set to _network_id. You may need to process the lines through an Intersector before the NetworkTopologyCalculator, if the lines are not node connected.

View original
Did this help you find an answer to your question?

4 replies

dustin
Influencer
Forum|alt.badge.img+30
  • Influencer
  • Best Answer
  • August 10, 2022

If they are all end node connected, you can use the LineCombiner.

 

If they are not end noded, I would first use the NetworkTopologyCalculator transformer. This should tag each connected set of lines with a common attribute _network_id. From there, you can aggregate those lines into one feature with Aggregator with Group By set to _network_id. You may need to process the lines through an Intersector before the NetworkTopologyCalculator, if the lines are not node connected.


arash_hokm
Contributor
Forum|alt.badge.img+8
  • Author
  • Contributor
  • August 10, 2022
dustin wrote:

If they are all end node connected, you can use the LineCombiner.

 

If they are not end noded, I would first use the NetworkTopologyCalculator transformer. This should tag each connected set of lines with a common attribute _network_id. From there, you can aggregate those lines into one feature with Aggregator with Group By set to _network_id. You may need to process the lines through an Intersector before the NetworkTopologyCalculator, if the lines are not node connected.

it works. many Thanx. :)


clowncutie
Contributor
Forum|alt.badge.img+7
  • Contributor
  • January 28, 2025
arash_hokm wrote:
dustin wrote:

If they are all end node connected, you can use the LineCombiner.

 

If they are not end noded, I would first use the NetworkTopologyCalculator transformer. This should tag each connected set of lines with a common attribute _network_id. From there, you can aggregate those lines into one feature with Aggregator with Group By set to _network_id. You may need to process the lines through an Intersector before the NetworkTopologyCalculator, if the lines are not node connected.

it works. many Thanx. :)

How would I do if they have a gap between eachother? Snapper will have varied results. Think motorway roads, I want into 1 line but it is messy, see example:  would snapper work? If I have 6 nearby lines:

 

 


crystalatsafe
Safer
Forum|alt.badge.img+18

Hi ​@clowncutie 

From the screenshot it looks like this is not possible, unless there are attributes that can do unique matching. 

However, if the lines are meant to mostly represent the same thing (eg. multiple slightly different representation of the same road), a Matcher with a vector tolerance might help. 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings