Skip to main content
Solved

Apply measure attributes to a line


geo-x
Contributor
Forum|alt.badge.img+5
  • Contributor

Dear FME Community,

I need to calculate measure PK from an object, modify them and apply to another object for cut it to elements.

I try to explain all steps with this schema :

I’m at the STEP 4 but I’m blocked when I want to apply my Measure PK to another objet.

For that I’ve a FMWT in ZIP join to this subject.

Thank you for your attention and your help.

Geo-x

Best answer by takashi

Got it, but it's a bit complex, since the input order of "elmts" lines isn't regularly aligned from start to end of the entire line, and also some "elmts" lines are polylines i.e. having 3 or more vertices.

Hopefully the attached workspace example resolves those issues and works as expected. 

View original
Did this help you find an answer to your question?
This post is closed to further activity.
It may be a question with a best answer, an implemented idea, or just a post needing no comment.
If you have a follow-up or related question, 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.

15 replies

crutledge
Influencer
Forum|alt.badge.img+32
  • Influencer
  • May 13, 2025

Hi ​@geo-x This is an interesting scenario. In the process are we assured a 1:1 relationship between the two “similar but not exactly the same” lines? Same # of segments and verticies? 
 

 


geo-x
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • May 13, 2025

Hi ​@crutledge and thanks for your comment on my scenario 😄

  • Yes we’re assured for the relation 1:1
  • We can have more or less verticies between first or second line
  • Bu We’ve to split the second line with the same numbers of segment what we’ve in the first line

Ps : Nice paint.net brush 😅


takashi
Influencer
  • May 13, 2025

Hi ​@geo-x ,

In my watch on your sample data, the number of segments in the first line (ol) is 2,215, which is greater than the number of segments in the second line (elmts) - 1,816.

Do you mean that you will have to firstly transform the second line so that it has the same number of segments as the first line - 2,215? 


geo-x
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • May 13, 2025

Dear ​@takashi thank you very much for your reply,

I think I was not clear, and I’m sorry about that. In fact the number of segments is doesn’t matter because I want to use the measure of start and end of each elements used for build the first line to apply them on the second line.

If my first line is build with 1 000 verticies and my second line is build with 1 500 verticies it’s not important at all.


takashi
Influencer
  • May 13, 2025

So, if # vertices of the second line is greater than # vertices of the first line, how do you calculate the measure value of [?] vertices (no associated vertices in the first line) in this screenshot?

 


geo-x
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • May 13, 2025

In my reasoning,

If both lines were built like with this verticies :

The first and End point are ok, and it’s maybe necessary to built intermediate verticies for cut the second line

 


takashi
Influencer
  • May 13, 2025

If I understand your requirement correctly, the attached workspace example could help you.


geo-x
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • May 13, 2025

Dear ​@takashi ,

Thank you very much for your proposition. I just read it, I think that could help me !

To be perfect, I think, I just have to use the MeasureGenerator on the intersection of end and start of each elements and apply the ratio like you did in the job. I say that, because at the end and I need to have 1617 elements and I’ve here, 2215 elements.

Another transformer I’ve to change is the GeometryReplacer because I need to have here the geometry of the ol objet, not the elmts object.

I try all this and I tell you the suits...


takashi
Influencer
  • May 13, 2025

I assumed that "ol" is the first line (pink), "elmts" is the second line (green). Was I wrong?


geo-x
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • May 14, 2025

I’m sorry, my explanation seems to be not very clear I should have given a name to each line.

In fact ol is this line : 

and elmts are this lines :

 


takashi
Influencer
  • Best Answer
  • May 14, 2025

Got it, but it's a bit complex, since the input order of "elmts" lines isn't regularly aligned from start to end of the entire line, and also some "elmts" lines are polylines i.e. having 3 or more vertices.

Hopefully the attached workspace example resolves those issues and works as expected. 


geo-x
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • May 14, 2025

Dear @takashi,

Thank you very muche for your new version.

I’ve two questions :

  1. Do you know it’s possible to conserve attribute from elmts to new cut lines ?
  2. I don’t know why the final length are not exponentially proportional. For example if I watch the second segment length is 1.653… and the second calculate elmts is 4.882…. After, the third segment length is 1.141 and the third calculate elmts is 9.22… etc… In my reasonment, the split of line like to be exponetially proportional because we make the Multiplier: @Value(_length_ol)/@Value(_length_elmts) on the FeatureJoiner do you know why we’ve this comportment ?

Thank you for your help


geo-x
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • May 14, 2025

For the question 1 I tried the SpatialFilter after the PathSplitter with a spatial predicates test : Equals and that works !


takashi
Influencer
  • May 14, 2025
  1. You can save attributes of the input "elmts" line features into a list attribute specified in the LineCombiner, and restore them by setting the list name to the Segment List parameter in the PathSplitter. Merge the attributes to resulting cut lines using segment number (0, 1, ...n) as join key if necessary.
  2. In my verification, [length of any “elmts” line] x [ratio (_length_ol / _length_elmts)] was equal to [length of the corresponding result cut line], if you ignore unavoidable tiny calculation error. Be aware that all the length values have been calculated in 3D, in my workspace example.

 


geo-x
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • May 16, 2025

Thank you very much ​@takashi ,

For the first question, I add the List in the LineCombiner and the SegmentList in the PathFilter and at the end, before de Snipper I add a Sorter (sort by code_ol and _vertex_index) and a Counter to have elements from 0 to n Group by code_ol  and just after the Snipper, I add a ListIndexer base on the List {} and my Counter and that works !

 

For the second question, it’s exactly what yous said, I add two 2dForcer, one for elmts and one for ol and that works too.

One more time, thank you very much for your help ​@takashi 🙏 (historic, because you helped me first time 7 years ago)


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