3

I'm using QGIS 3.6.3. Noosa.

I have 10 polygons, each has a starting time and an end time. Getting Time Manager to run was no problem at all. However, there are two things I would like to add in my dynamic visualization.

  1. With each ongoing time frame I would like the color of the polygon to change, meaning that when in January 2019 the polygon is dark red, it should be less dark in February 2019 and by the end date in December 2019 be a very light red color.
  2. Polygons disappear at the end of the time span, I would like them to be visible (as stated in 1, in a different color than at the beginning of the time span).

Does anyone have any suggestions?

4
  • This post from Anita Graser should get you on track : anitagraser.com/2015/05/08/…
    – J.R
    Commented Sep 25, 2019 at 15:40
  • In the Example point-Data was visualized. I'm not able to run it with polygons. But, I'm sure I'm on the right track!
    – rtaani
    Commented Sep 26, 2019 at 15:26
  • The idea was mostly to use the "animation_datetime()" with some interpolation and color fonction in the data defined override of your feature color so it should work on any geometry type
    – J.R
    Commented Sep 26, 2019 at 16:04
  • Unfortunately, I havent been able to solve my problem. I tried to use the animation_datetime, and as in the example of anitagraser used in the expression of the simple color inorder to have 1) the color fade out and 2) have the polygons be visible at the end of the video. Even If i try point-layer and I use the same exact expression in Anitas example, I always get an expression syntax error (although I made sure I used the fuctions from the directory and not just copy-paste). Is there a different tutorial you can recommend?
    – rtaani
    Commented Oct 1, 2019 at 15:01

2 Answers 2

4
+25

By using this expression :

color_hsv(0, scale_exp( day( age( "END" , animation_datetime() )),0,365,10,100,2),100)

In the data defined override for your polygon fill color you get the effect from red to pale red as the time goes.

  • This work like this color_hsv set the color with H set at 0 (for red), S set as a scale_exp fonction to change over time and V set as 100.

    the scale_exp used to modulate the S value of the HSV color take 6 argument:

    scale_exp(val,domain_min,domain_max,range_min,range_max,exponent)

    • val : the value to be scaled is (set as day(age("END",animation_datetime() )) this calculate the number of day between the datetime set in the "END" field and the current
      animation datetime )
    • domain_min : the minimum value in the input domain, set as 0
    • domain_max : Specifies the maximum value in the input domain (set as 365 : difference between the 1 jan 2019 and 31 dec 2019, adjust if your start and end date are different (if each of your polygon have different start and end time make this an expression to)
    • range_min : Specifies the minimum value in the output range, set at 10 (0 will give you white and not a pale red, adjust if needed)
    • range_max : Specifies the maximum value in the output range, set as 100 for a bright red
    • exponent : A positive value (greater than 0), which dictates the way input values are mapped to the output range, set as 2, adjust as you want to have the progressive change you like the most

Result : enter image description here

For keeping the polygon visible at the end of the time span I think you have to check the "Accumulate features" box in the Time manager setting, if that didn't work another way would be to duplicate the layer and display it below the time managed layer and in another color.

1
  • Thank you so much! Its working!
    – rtaani
    Commented Oct 22, 2019 at 14:23
0

Make a duplicate of each polygon for each month.

Fill the "date" field with the dates for Jan 2019 to Dec 2019, so there's one copy of each polygon for every month.

Style the polygons with a graduated style using the "date" attribute. Use a custom color gradient from dark red for Jan 2019 to light red for Dec 2019.

1
  • This approach is for the my testdata manageable, since i only have 10 polygons, and I'm only regarding one year. I think this might be way to time-consuming if I were to use my real Data. Thank you very much for the idea, I think I still need to structure my approach in order to find a less elaborate way.
    – rtaani
    Commented Sep 26, 2019 at 16:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.