Skip to main content

I have a feature class. There is a ID field in this
feature class, like below:

101L1

101L2

101L3

101L4

101L5

101L6

101L7

101L8

101L9

101L10

...

102L57

102L58

102L59

102L60

102L61

102L62

102L63

...

I plan to add a new field called AZIMUTH. I need to use
ID field above to find the "next" feature, for example, if current
feature ID is 101L4, I will try use 101L5, and use this "next" feature
and current feature to calculate AZIMUTH.

Can you tell me how to find 101L5 in this case? Better
use transformers. If not possible use python is also OK.

Hi @zhangchuangxin,

In an AttributeManager or Creator, there is an Advanced: Attribute Value Handling section. In here you can enable Adjacent Feature Attributes and set the Number of Subsequent Features to 1. This way you can use both the current and next feature in your Azimuth calculation - that is, if you can put your calculation into the Arithmetic Editor within this transformer.

There is more information about this under the Configuration>Parameters heading of the help doc: http://docs.safe.com/fme/2018.1/html/FME_Desktop_Documentation/FME_Transformers/Transformers/attributemanager.htm

Note: For this to work make sure features are entering the AttributeManager in the correct order, you can use a Sorter before hand if you are not sure.


If the IDs are sequential the solution proposed by @hollyatsafe is very fast and efficient. But in case the IDs aren't sequential, the easiest is probably to split the ID into its two parts, e.g. using use the AttributeSplitter on "L", so that "102L63" becomes "102" and "63".

You can then use the FeatureMerger to match the "current" and "next" features.


Hi david_r and hollyatsafe: Thank you for your input. However, the ID field is way more complicated and looks like below:

D904L1

 


D904L3

 


D904L8

 


D904L8A

 


D904L8B

 


D904L9

 


D904L19

 


D904L19A

 


D904L19B

 


D904L19F

 


D904L19S Wabamun South Side 2nd Bay from East

 



and a very complicated business rule has been defined on how to find previous feature. Can you propose an alternative solution?

Reply