Monday 25 March 2019

arcgis desktop - Sum of attributes in Spatial join when polygons cross boundaries in ArcMap?


I use ArcMap, where I have two layers:



  • Buildings as polygons. Each polygon has a number of people living in it as an attribute.

  • Polygons dividing the city into "districts". I drew these "districts" myself, so they sometimes cross buildings (which is fine).



I need to calculate the number of people living in each district. I used a spatial join using the buildings as the source and the districts as the target. I set up a merge rule as "Sum" for the number of people.


When I looked at the outcome layer, the total number of people in this layer are higher then in the total number of people in the initial building layer. I think this is because the number of people in buildings that are crossed by "district" boundaries were calculated twice in the summary.


How I can correctly set up the spatial join so that the number of people in the districts are the same as the number of people in the buildings? Ideally, if the majority of a building area fall into polygon, the people should be count as living in this polygon.



Answer



FelixIP's first method is what you need to do if you want to evenly distribute the population of a building that crosses districts.


Start with two feature classes 'Buildings' and 'Districts'



  • Add a field to 'Buildings' and calculate the area.

  • Go to Geoprocessing > Intersect. Select 'Buildings' and 'Regions' as input. Output is 'Proportioned_Buildings'. Join all attributes.


  • Add a field to 'Proportioned_Buildings' and calculate the area. This will be less than for 'Buildings' on those that cross district boundaries.


  • Add a field to 'Proportioned_Buildings' and calculate "population" * ("Proportioned_Buildings Area" / "Buildings Area"). Hopefully you can see that we are multiplying the population of the building by the proportion of that building in that district.




  • Get the centroids 'Proportioned_Buildings' with attributes (none can be on a boundary by definition of the intersect done previously).




  • Select spatial join and set 'Regions' as target and 'Proportioned_Buildings_Centroid' as join. 1:1, Intersect, and remember to set the merge rule to sum on the proportioned population field (not the original population field).




  • The total population in this final layer should match your original total population in the buildings layer (give or take the precision of floating point numbers).


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