Solved

PointOnLineOverlayer - Apply Attributes from points to line segments

  • 26 January 2022
  • 6 replies
  • 9 views

Hello,

 

I have a single line, and also a set of 16 points that lie along that line.

 

I need to split the line into 16 different segments that start/end at these points. I found PointOnLineOverlayer that does this, and even mentions being able to apply attributes to the segments.

 

Its working perfectly to split the line up into segments, the problem I'm having is that those segments don't seem to be taking their attributes from the points that split them, but instead are taking them from the original line, and so the attributes for each segment are identical.

 

How can I apply an attribute from the points to each corresponding segment of the line?

icon

Best answer by chrisatsafe 26 January 2022, 19:43

View original

6 replies

Badge +2

What do you have set for the Conflict Resolution parameter in the Attribute Accumulation section? By default, this is set to Use Original which maintains the original values. If you set this to Use Incoming it should transfer the incoming values for conflicting features (ref).

 

If that doesn't fix it could you share a screenshot of your PointOnLineOverlayer parameters?

Badge +2

What do you have set for the Conflict Resolution parameter in the Attribute Accumulation section? By default, this is set to Use Original which maintains the original values. If you set this to Use Incoming it should transfer the incoming values for conflicting features (ref).

 

If that doesn't fix it could you share a screenshot of your PointOnLineOverlayer parameters?

Had a second thought about this... I see where you are running into issues with this.

 

Since you are starting with a single line and all of the points fall on the single line, all of the attributes are being set from a single point (likely the last point to arrive).

image 

If you run it through a second PointOnLineOverlayer, the point values will be transferred over to the corresponding line segments. You only need to set merge incoming attributes on the second one.

image

Had a second thought about this... I see where you are running into issues with this.

 

Since you are starting with a single line and all of the points fall on the single line, all of the attributes are being set from a single point (likely the last point to arrive).

image 

If you run it through a second PointOnLineOverlayer, the point values will be transferred over to the corresponding line segments. You only need to set merge incoming attributes on the second one.

image

Hmm, your solution definitely seems to do what I want in your example. But it doesn't quite seem to be working for me.

 

When I inspect the lines that result from my first PointOnLineOverlayer, they all have the attributes of that original first line. However the resulting lines from the second one all have ithe same attributes from the last point to arrive, like you mentioned. I even tried adding a third one but that just resulted in the same output.

 

I essentially have the FME default parameters on both, except for the second one I have Merge Attributes checked and set to 'Use Incoming'. Is there any other settings I may need to change?

Had a second thought about this... I see where you are running into issues with this.

 

Since you are starting with a single line and all of the points fall on the single line, all of the attributes are being set from a single point (likely the last point to arrive).

image 

If you run it through a second PointOnLineOverlayer, the point values will be transferred over to the corresponding line segments. You only need to set merge incoming attributes on the second one.

image

aha! I think I've worked it out. It was an issue with my point tolerance. I had set it to 1, thinking that was just 1 meter. But I noticed that the overlaps counter was actually at 16, and so realised that it was counting every point, and that the 1 wasn't actually metres. I'm guessing its based on my lat/long in which a buffer of 1 would definitely include every point.

 

I did still need to use the 2nd transformer, so your tip helped. Thanks very much!

Had a second thought about this... I see where you are running into issues with this.

 

Since you are starting with a single line and all of the points fall on the single line, all of the attributes are being set from a single point (likely the last point to arrive).

image 

If you run it through a second PointOnLineOverlayer, the point values will be transferred over to the corresponding line segments. You only need to set merge incoming attributes on the second one.

image

I'm actually having a follow on issue from this that I'm wondering if you might be able to help with?

 

There seems to be a slight randomness over whether the line segments takes its attribute from the point at the start or the point at the end, as it overlaps with both. So some consecutive lines end up actually sharing the same attributes, as they both take the attributes form the point between them.

 

I tried to fudge it a bit, by offsetting each of the points slightly before they go into the second translator so they would only with one line, but then of course these new points cut the lines again, resulting in additional tiny line segments between where the point originally was and the new slightly offset location.

 

I'm assuming theres a much neater way of achieving this, but I cant work out how.

 

Thanks!

Userlevel 4
Badge +36

Had a second thought about this... I see where you are running into issues with this.

 

Since you are starting with a single line and all of the points fall on the single line, all of the attributes are being set from a single point (likely the last point to arrive).

image 

If you run it through a second PointOnLineOverlayer, the point values will be transferred over to the corresponding line segments. You only need to set merge incoming attributes on the second one.

image

You can store the geometry of the lines in an attribute with the GeometryExtractor, shorten the end of the lines with the Snipper, perform your second PointOnLineOverlayer, and finally restore the original geometry of the lines with the GeometryReplacer.

PointOnLineOverlayer

Reply