Solved

Generate sequence attributes along lines

  • 16 August 2016
  • 6 replies
  • 3 views

Userlevel 4
Badge +30

Hello Users,

My situation: I have connected lines with a attribute lengh each lines: _length.

I need to get this attribute _length and break in two anothers one: att_begin and att_end for each lines.

For example line 1: has the attribute _length = 39.7. I would like to take this and generate att_begin=0 and att_end = 39.7.

The line 2 has the attribute _length = 84. Is necessary to generate att_begin=39.8 ( in sequence number before ) and att_end=123.8 ( 39.8 + 84 ).

Attached my Source data.

Thanks :)

icon

Best answer by takashi 16 August 2016, 18:15

View original

6 replies

Userlevel 2
Badge +17

Hi @danilo_inovacao, if you are looking for a way to sort the line features based on their connecting order, the LineJoiner and PathSplitter might help you.

  • LineJoiner: Set 'Yes' to the 'Preserve Lines as Path Segments' parameter, and specify a list name to store attributes of the input features.
  • PathSplitter: Specify the list name to the 'List Attribute' parameter.

The lines will be output from the PathSplitter in their connecting order. I think you can then calculate desired values with the StatisticsCalculator (use Cumulative port) or the AttributeCreator (Enable Adjacent Feature Attributes option).

Userlevel 4
Badge +25

Hi @danilo_inovacao, if you are looking for a way to sort the line features based on their connecting order, the LineJoiner and PathSplitter might help you.

  • LineJoiner: Set 'Yes' to the 'Preserve Lines as Path Segments' parameter, and specify a list name to store attributes of the input features.
  • PathSplitter: Specify the list name to the 'List Attribute' parameter.

The lines will be output from the PathSplitter in their connecting order. I think you can then calculate desired values with the StatisticsCalculator (use Cumulative port) or the AttributeCreator (Enable Adjacent Feature Attributes option).

+1 for the use of the StatisticsCalculator cumulative port. I would never have thought of that!

 

 

Userlevel 4
Badge +30

Hello @takahi and @Mark2AtSafe thanks yours answer.

I did put the these transformers on workspace and in the Transformer StatisticsCalculator the Attribute to Analyse is _length, correct?

Thanks

Userlevel 4
Badge +25

Hello @takahi and @Mark2AtSafe thanks yours answer.

I did put the these transformers on workspace and in the Transformer StatisticsCalculator the Attribute to Analyse is _length, correct?

Thanks

I think so. Then the _sum value in the features output through the Cumulative port will return the accumulated distance up to that point. That will be the final length and (_sum - length) will be the start point.

 

 

ps - hope you're enjoying the Olympics! Pity the soccer semis went the wrong way and the final couldn't be Brazil vs Canada. But I suppose there are plenty of Germans and Swedes here who would disagree!

 

 

Userlevel 2
Badge +17

Hello @takahi and @Mark2AtSafe thanks yours answer.

I did put the these transformers on workspace and in the Transformer StatisticsCalculator the Attribute to Analyse is _length, correct?

Thanks

Yes, but I intend to use only features from the Cumulative port. See also the attached example (FME 2016.1.1): cumulative-sum.fmwt

 

Badge +3

if the lines are ordered (or can be ordered) you can also just take their lengths and use a attribute creator with lead or lag.

Reply