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.
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.
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.
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.
We use 3 different kinds of cookies. You can choose which cookies you want to accept. We need basic cookies to make this site work, therefore these are the minimum you can select. Learn more about our cookies.