I am using QGIS version 3.6 and Time Manager version 3.2.3 to create a temporal map of the US's energy usage over time. I have a polygonal shapefile of the US with each row of the .dbf file containing a state's name, its USPS code, corresponding region (e.g. new england, midwest), land area, etc., which means that there are multiple entries within the shapefile that have the same region (Rhode Island is New England, and so is New Hampshire). My other file is a .csv file that contains energy consumption data for the region of New England annually from 2017 to 2050. Here's the first few rows of the energy data: And here's where one can download the shapefile: cb_2017_us_state_5m
To start off, I joined these two layers by region (both have a region column). After changing the style to graduated and classifying the intervals, the map only showed states in New England, which suggests I joined the layers properly. However, when I checked the resulting attribute table, I noticed that the time column only displayed the last year represented in the data, and that all other values from the csv file were set to their values from that year. Here's what I mean:
I suspect that the other time values were not saved at all, which was confirmed when I added the joined layer to time manager--the only values visible were the values from 2050, and moving the time manager's slider did nothing.
According to this link, Time Manager does not support joined layers, but I don't know if this applies to my situation because I do not get any errors, just a lot of missing years.
I have tried a few things to get around this problem:
- I duplicated the rows for each year in the energy data so that I had the same number of rows for each year as there are states in New England (i.e. I have six rows with identical data from 2017 to match the six states in New England, six for 2018, etc.). This did not solve the problem.
- I opened the .dbf file that accompanied the shapefile and duplicated the data so that there would be one set of states for each year in the energy file. The DBF file thus had many more rows than it originally had, but the number of rows that showed up in the attribute table remained the same. Additionally, the error with Time Manager persisted.
- I tried both of these at the same time, which also did not work.
I feel like I could work around this problem if I could import a new attribute table to use in place of the one that comes with the shapefile, but I am unsure how to do that, and it's very possible it wouldn't solve the problem anyway.
Is there a way to join the two layers in a way that is compatible with Time Manager?