Skip to main content
Solved

Calculate azimuth based on other attribute

  • September 21, 2018
  • 3 replies
  • 20 views

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.

Best answer by hollyatsafe

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.

View original
Did this help you find an answer to your question?

3 replies

Forum|alt.badge.img+2
  • Best Answer
  • September 21, 2018

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.


david_r
Celebrity
  • September 24, 2018

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?

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