Skip to main content
Solved

Create multiple Lines out of Points


Hi,

I have a point data set and I want to connect all points that have the same ID to each other. So if four points have the same id, each point should create a line to the other three points. The LineBuilder does not solve my problem because it simply creates an entire line and not just individual ones. I've read a few articles that the VertexCreator could help me, but I haven't found the solution yet.

I would be very happy about your help. Greetings, Bastian

Best answer by oscard

I think I've got it:

 

p1

First use a CoordinateExtractor to get the X, Y and Z of every point. Then use a Counter to give each point a unique number.

 

In the Feature Merger, the Requestor and Supplier take the same input. Join them on your ID. Don't forget to generate a List with the attributes:

 

p2

Explode the list using the ListExploder. The Tester filters the point that has been merged with itself. The condition is:

p3

"_count" is the attribute created by the Counter.

The last step is using a VertexCreator:

p4

Let me know if this works for you.

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

12 replies

oscard
Influencer
Forum|alt.badge.img+21
  • Influencer
  • September 15, 2020

The LineBuilder with the GroupBy by that ID should do the trick.

 

EDIT: I think I misread your question. Do you mean that the first point with one ID has to create a line to each of the rest points with the same ID?

 


david_r
Celebrity
  • September 15, 2020

I'm not quite sure I understand about the LineBuilder, did you remember to set the Group By to the ID attribute? In earlier versions of FME this setting was also called Connection Break Attributes.

This should force a new line for each change in the ID. Just make sure that the points are arriving in the correct order (e.g. use a Sorter).


  • Author
  • September 15, 2020

@oscard​ @david_r​ 

No, unfortunately not. I did that, but The LineBuilder then only creates one line. I put in 4 points with the same ID and only get one line with the ID out. But I need every possible line (with 4 points it would be 12 lines). But maybe i misunderstand something about the LineBuilder...


  • Author
  • September 15, 2020
oscard wrote:

The LineBuilder with the GroupBy by that ID should do the trick.

 

EDIT: I think I misread your question. Do you mean that the first point with one ID has to create a line to each of the rest points with the same ID?

 

Yes, that's what i meant. And the other points with the same ID should do the same.


oscard
Influencer
Forum|alt.badge.img+21
  • Influencer
  • September 15, 2020
bastianr95 wrote:

@oscard​ @david_r​ 

No, unfortunately not. I did that, but The LineBuilder then only creates one line. I put in 4 points with the same ID and only get one line with the ID out. But I need every possible line (with 4 points it would be 12 lines). But maybe i misunderstand something about the LineBuilder...

No. The LineBuilder won't get what you want. Right now I don't know how to solve your issue. I will give it a thought as soon as I have a little time off. Although by that time I bet someone else has posted a great soulution :)


oscard
Influencer
Forum|alt.badge.img+21
  • Influencer
  • Best Answer
  • September 15, 2020

I think I've got it:

 

p1

First use a CoordinateExtractor to get the X, Y and Z of every point. Then use a Counter to give each point a unique number.

 

In the Feature Merger, the Requestor and Supplier take the same input. Join them on your ID. Don't forget to generate a List with the attributes:

 

p2

Explode the list using the ListExploder. The Tester filters the point that has been merged with itself. The condition is:

p3

"_count" is the attribute created by the Counter.

The last step is using a VertexCreator:

p4

Let me know if this works for you.


  • Author
  • September 15, 2020

Hello, thank you in advance. I'm more of an FME beginner and that's why I still have a little problem. For the tester you need both attributes in the ListExploder list, _count and _points__count. However, I only get the _count from the list. How can you get both attributes with the ListExploder in order to then test them in the tester? Thanks

 


oscard
Influencer
Forum|alt.badge.img+21
  • Influencer
  • September 15, 2020
bastianr95 wrote:

Hello, thank you in advance. I'm more of an FME beginner and that's why I still have a little problem. For the tester you need both attributes in the ListExploder list, _count and _points__count. However, I only get the _count from the list. How can you get both attributes with the ListExploder in order to then test them in the tester? Thanks

 

In the FeatureMerger make sure you have the "_count" Attribute in the Selected Attributes of the Generate List section.


  • Author
  • September 16, 2020
oscard wrote:

I think I've got it:

 

p1

First use a CoordinateExtractor to get the X, Y and Z of every point. Then use a Counter to give each point a unique number.

 

In the Feature Merger, the Requestor and Supplier take the same input. Join them on your ID. Don't forget to generate a List with the attributes:

 

p2

Explode the list using the ListExploder. The Tester filters the point that has been merged with itself. The condition is:

p3

"_count" is the attribute created by the Counter.

The last step is using a VertexCreator:

p4

Let me know if this works for you.

That worked perfectly, thanks a lot!


  • February 15, 2023
oscard wrote:

I think I've got it:

 

p1

First use a CoordinateExtractor to get the X, Y and Z of every point. Then use a Counter to give each point a unique number.

 

In the Feature Merger, the Requestor and Supplier take the same input. Join them on your ID. Don't forget to generate a List with the attributes:

 

p2

Explode the list using the ListExploder. The Tester filters the point that has been merged with itself. The condition is:

p3

"_count" is the attribute created by the Counter.

The last step is using a VertexCreator:

p4

Let me know if this works for you.

Hi Oscard

I can't seem to make this work. in the FeatureMerger I only get 1 merged


  • February 15, 2023
tas wrote:

Hi Oscard

I can't seem to make this work. in the FeatureMerger I only get 1 merged

of course the second i reply, I solve it. grouped it by the "ID" also skipped the tester. that worked out for me for some reason :)

 


oscard
Influencer
Forum|alt.badge.img+21
  • Influencer
  • February 16, 2023
tas wrote:

Hi Oscard

I can't seem to make this work. in the FeatureMerger I only get 1 merged

Hi.

Do they have a common ID? If you could share a sample of your data we could take a look.

 

EDIT: Sorry, I didn't see your latest answer. Glad you could make it work :)


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