2

I have a data-spreadsheet containing a value-attribute that changes over time for a number of administrative units. I have a polygon layer as well with features for each of the administrative units. The spreadsheet containing the date looks like this:

enter image description here

I now want to use the built-in temporal control in QGIS 3.16 to visualise the change of the attribute-value for each administrative unit over time. I imported the spreadsheet as attribute data. Now the problem starts: how to join the attributes to the geometry? Each geometry (administrative unit) should contain for every time-stamp a separate value.

Having the Admin. units in the spreadsheet in the top row, I can't make a table-join with the polygon-layer. So I tried to first convert the spreadsheet in this way:

enter image description here

No I can joint these attributes using the Ad.Unit-field to the geometries of the administrative units. That works, however, I only get the first data-set per ad.unit (day 1). All the others are left out. But to be able to animate, I should have a value for each day (timestamp-field).

What I would like to achieve is a time-animated circle-marker whose size depend on the value-field for each day. How to achieve this?

3
  • Your time/date format needs to be correct example: YYYY-MM-DD see more medium.com/@tjukanov/…
    – Mapperz
    Commented Oct 26, 2020 at 1:25
  • Yes, I have that, in principle, the timestamp-field works with the temporal controller. The problem is with joining the two layers: geometry and attributes
    – Babel
    Commented Oct 26, 2020 at 9:20
  • By the way, I spek about the native, built-in time controller (since 3.14), not the timemanager plugin
    – Babel
    Commented Oct 26, 2020 at 12:01

1 Answer 1

1

To create several new attributes for one feature on the layer admin_units from different features (rows) of the data-only layer imp, use field calculator. To get the value attribute for each row from imp to the corresponding new attribute in admin_units (where for each date in timestamp attribute, a separate field should be created), use this expression :

with_variable (
    'name',
    name,
    aggregate( 
        'imp',
        'array_agg',
        value,
        filter:=timestamp= to_date('2022-08-28') and ad_unit=@name
    )[0]
)

Screenshot (be aware that the last field has a wrong fieldname - it should be 28-08-22 (not 29-08-22): enter image description here

2
  • I see what you did here, and it could be useful in many situations! But what is the purpose of changing the imp record #4 timestamp day value from 28 to 29 in the admin_units field name?
    – Stu Smith
    Commented Aug 28, 2022 at 20:57
  • That is an error, it should be 28, not 29, of course. Will add an explanation to the solution, thanks for drawing my attention to it!
    – Babel
    Commented Aug 28, 2022 at 21:03

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.