Skip to main content
Solved

Can I "group" my adjacent feature calculations?


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

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

2 replies

ebygomm
Influencer
Forum|alt.badge.img+39
  • Influencer
  • 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
ebygomm wrote:

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!


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