# AttributeCreator: How TRC Solutions Calculates Cumulative Length of Pipe

*Peter Veenstra of TRC Solutions is using the AttributeCreator transformer to automate linear referencing tasks including the calculation of cumulative values to increase the accuracy of measurements in his pipeline dataset.*

“The AttributeCreator transformer allows a user to create new attributes using values obtained from previous or subsequent rows in an ordered input table,” explains Peter Veenstra.

An avid FME user, Peter works for TRC Solutions, an engineering, environmental consulting and construction management firm that provides services to the power, environmental, infrastructure and oil and gas markets.

“In a call with Safer Mark Stoakes, I asked ‘I have all my points ordered. Do you have a transformer that can go to my previous point?’ He showed me the AttributeCreator and my jaw hit the floor,” Peter recalls. “This solves a lot of common tasks we have when preparing pipeline route data and inline inspection or other inspection data.”

## Automating Cumulative Values

“With the ability to access N or more previous and subsequent attributes you can perform calculations including vector direction, bend direction and amount, total cumulative footage, 3D distance between previous and subsequent points… this is crunchy magical goodness.”

For example, Peter regularly needs to calculate the cumulative length of pipe between two welds. He has created an FME workspace to create measure or station values, so that when maintenance is needed, field crews can be confident that the location identified for the work is accurate.

In ArcGIS, Peter can build the pipeline and create measure values for it, but when it comes to cumulative values, he would need to use Python.

Instead, he created an FME workspace that takes the CSV file, creates vertex point features using XYZ, sorts them according to the ID, and performs some statistics calculations to acquire cumulative distances.

“I just did in three steps what I would have otherwise had to code,” he describes.

His workspace then creates an attribute called begin distance and end distance.

“I can get all of the attributes from the previous point in the list. As a result, I can calculate the distance between the two points.”

He uses another StatisticsCalculator to identify the cumulative distance and assign it to every single point. In the AttributeCreator he rounds the numbers, finds the maximum cumulative distance he needs, and sets the measure value of every point.

The coordinate has now been set to xyz, and the actual coordinate now adds an M (measure) value as an m-aware point feature. The workspace creates a polyline, and all of those point features comprises the m-aware vertices of the polyline. The cumulative maximum distance attribute is now assigned to an attribute of the polyline.

The following images provide a step by step explanation of each stage of Peter’s cumulative length calculating workspace.

## This Is When the Fun Begins

With FME, Peter can then perform complex calculations.

“Now I can deal with much more complicated stuff,” Peter emphasized. “I can calculate the true 3D distance when Z values are available; tell how this vector deviates to the next one based on the angle of the turn; QA/QC to evaluate if field measured distance is equal to the calculated distance between two points; and calculate rhumb distance compared to measured distance, for just a few examples.

“Knowing the true length of installed pipe is huge for transmission pipeline companies.

“I can now solve a whole bunch of problems that I couldn’t before because it took too much time,” Peter observed. “There is a lot of functionality in this one transformer that would otherwise take a lot of Python to resolve.”

To discover more ways you can use the AttributeCreator to meet your needs, visit the AttributeCreator page in the Transformer Gallery. To find custom transformers that have been created for linear referencing projects, visit the FME Hub.