Monday, 29 July 2019

attribute table - Color in QGIS based on record of events in CSV file?


I have a shapefile with the following attributes:


ID    Region
1 Region1
2 Region2
3 Region3

Also I have the following record of events in a CSV file



EventID     Year     Month     RegionID     Quantity
001 2015 12 1 6
002 2015 12 2 7
003 2015 12 3 3
004 2015 11 1 4
005 2015 11 3 3
006 2015 10 2 6
007 2014 12 3 3
008 2014 11 2 2
009 2014 10 1 7

... ... ... ... ...

I would like to color my map acording to a filtered record. For instance, say I want to display all the events of November 2015. Then I would have:


ID    Region    Quantity
1 Region1 4
2 Region2 0
3 Region3 3

Or say I would like to display all the events of 2015. Then I would have the sum of the events:


ID    Region    Quantity

1 Region1 10
2 Region2 13
3 Region3 6

Is there a way to solve this problem dynamically, without rewriting the attribute table of the shp every time?


Consider that the CSV file is updated frequently.




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...