Skip to main content
Solved

Can I "group" my adjacent feature calculations?

  • October 30, 2019
  • 2 replies
  • 51 views

Forum|alt.badge.img

Hi there,

I've been using the adjacent feature functionality and I'm really impressed with how useful it is once I wrapped my head around it. However, I'm a little stuck now.

Here's an example of what my data looks like:

WeekPlaceLength% Difference1Village1298938.438-2Village1299198.1190.023Village130032.0970.091Forest11038.854-99.152Forest11036.975-0.023Forest11140.5470.94

 

So the "% Difference" I'm calculating via adjacent features in an AttributeCreator (Just to get the % difference of length based on the length of the previous entry:

New AttributeAttribute Value% Difference@round(@mult(@div(@sub(@Value(Length),@Value(feature[-1].Length)),@Value(feature[-1].Length)),100),2)

 

 

This all works perfectly and exactly as I hoped for, except the issue of having "99.15 % Difference" when going from Village to Forest. That number is huge and not actually something I'm interested in, as I want it to "Start over" once it gets to a new "Place".

I.e. I'm only interested in the weekly % change that occurs for each "Place" independently. Meaning, the first week of "Forest" should also have no value (or technically "inf" as it currently outputs it in my workbench) and not compare itself with the last value of "Village".

 

Any way I can achieve this?

Best answer by ebygomm

You can use a conditional statement to only apply the %difference calculation if feature.Place = feature[-1].Place

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

2 replies

ebygomm
Influencer
Forum|alt.badge.img+44
  • Influencer
  • 3427 replies
  • Best Answer
  • October 30, 2019

You can use a conditional statement to only apply the %difference calculation if feature.Place = feature[-1].Place


Forum|alt.badge.img
  • Author
  • 70 replies
  • October 30, 2019

You can use a conditional statement to only apply the %difference calculation if feature.Place = feature[-1].Place

I've had little prior experience with conditional values but it works perfectly, thanks!