Saturday 26 August 2017

splitting - Dividing polygon and assigning values ​proportionally (population) using QGIS?


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.


enter image description here


The calculated field does not work.


1st step: create a calculated field ($area)


enter image description here


2nd step: cut the “one” polygon:


enter image description here



3rd step: create a calculated field (“population” * $area / “old_area”) as Virtual Field:


enter image description here


Result: the first result is OK (on the the polygon that was cut first), the “new_pop” value was calculated fine:


enter image description here


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.


enter image description here


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

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...