I need to split several polygons (census blocks) that contains numerical attributes (population) into smaller blocks, but assigning that data proportionally.
For example: if the splitting is made by 40/60%, and the population value is 1000, i want QGIS 3.2 to assign 400/600 proportionally to each polygon.
With the Split features function, the data is duplicated (QGIS replicates ALL the original values). I would love if there was a plugin that allows it to be made using the Split Polygon function "by hand", but I know that it is practically impossible.
The calculated field does not work.
1st step: create a calculated field ($area)
2nd step: cut the “one” polygon:
3rd step: create a calculated field (“population” * $area / “old_area”) as Virtual Field:
Result: the first result is OK (on the the polygon that was cut first), the “new_pop” value was calculated fine:
BUT the next split does not work (polygon "two"), the “new_pop” values are: 100 and 40, when should be 60 and 40. The first row is not updated.
Is this a bug?
Answer
You can achieve this with Field Calculator.
- Use Field Calculator to add area of original polygon as an attribute, called "old_area".
- Split all the polygons you want to divide.
- Add a new population attribute, called "pop_new". Use Field Calculator to calculate "pop_new" as old population multiplied by the ratio of the current area to the old area.
"population" * $area / "old_area"
If you use a virtual field or a default field value for "pop_new" it will be automatically calculated anytime you split another polygon.
No comments:
Post a Comment