I am trying to figure out how to allocate the values I have in a lines layer to polygons based on how much of each line segment falls within each polygon.
I have a roads lines layer that has a different "traffic activity" value for each segment similar to the map shown here (for illustrative purposes):
Now, I have an underlying county block groups polygons layer. I want to find the sum of traffic activity for each block group, based on 1) the traffic activity value assigned to each road segment, and 2) how much of each road segment falls within each polygon.
To summarize, I want the total traffic activity for each block group by summing the traffic activity values of the road segments that fall within each block group polygon, proportional to how much of a road segment falls within each polygon.
I am thinking of using the "Intersection" tool in QGIS to intersect the roads lines layer and the block group polygons layer to delineate the roads layer by the brock groups, and then counting the traffic activity values in each block group, though I am not sure how the traffic activity values from the roads lines will get distributed between the block groups they fall within. If the values of a road segment are evenly divided between the polygons they fall within, that is not what I want. I want the values to be allocated to the block groups based on the portion of the lines each block group contains.
For example: A line segment of 10 miles contains a traffic activity value of 100 and falls within block groups A, B, and C. Block group A contains 2 of those miles of road, Block group B contains 3 of those miles of road, and block group C contains 5 of those miles of road. Accordingly, after the intersection, Block group A should have a traffic activity value of 20, Block group B should have a traffic activity value of 30, and block group C should have a traffic activity value of 50.
How this might be accomplished in QGIS?