Skip to main content

Hi

I am still new to FME and would like to find out the best/easiest/quickest way to calculate lengths of pipe sections. In this case the distance between S01 and F01 (3.8-0.6 = 3.2). The tricky bit is that there are sometimes more than 1 pipe section per Inspec_ID which need calculating, ie S02/F02, S03/F03 etc.

Thanks in advance

J

Would it be possible for you to post a small sample dataset? I'm sure it would be very helpful for those wanting to assist 🙂
Would it be possible for you to post a small sample dataset? I'm sure it would be very helpful for those wanting to assist :-)
Sure, there you go @david_r

 

 

book1.xlsx

So I'm not sure if I understood exactly what you need, but here's a sample workspace that calculates distances between S01-F01, S02-F02, etc. Unfortunately it isn't trivial (if I've understood the requirements correctly), so I ended up with some Python to do the actual list calculations.

The section lengths are output in the list attributes lengths{}.distance and lengths{}.name

Output from the sample dataset:

`lengths{0}.distance' has value `3.1999999999999997'`lengths{0}.name' has value `S01-F01'`lengths{1}.distance' has value `85.3'`lengths{1}.name' has value `S02-F02'`lengths{2}.distance' has value `4.299999999999997'`lengths{2}.name' has value `S03-F03'`lengths{3}.distance' has value `5.200000000000003'`lengths{3}.name' has value `S04-F04'

section-lengths.fmwt

If you need one feature per section, use a ListExploder on lengths{}. You can then also use the AttributeRounder on the distance values, if needed.


Hi @johannhurter

thank you for the data sample. I think the workflow might be


Hi @johannhurter, using global variables for each interval might also be a solution, if it's guaranteed that "Fxx" appears always later than the "Sxx" containing the same xx (01, 02, ...).


Wow, thanks for all the amazingly quick and interesting replies! I've gone for the global variable solution for now and it's working well.

 

 

The next step is to look for areas where 2 pipe sections overlap, e.g. S01/F01 and S02/F02 running on the same section of pipe, and only counting the longest section. If anybody has a quick answer in the meantime feel free to shout ;)

 


I think global variables are still helpful in the next step. The attached workspace adds section ID and overlap count attribute to each row. Here, section ID is equal to the "cd" of starting row (i.e. S01, S02, ...), and if two or more sections overlaps in a row, their section ids will be concatenated into a single comma-separated string.

 

add-section-id-and-overlap-count.fmwt (FME 2017.1)

 

 


@johannhurter

to complete the set of possible solutions......;)


@johannhurter

then again...2 transformers seem enough..


Reply