I'm working with two shapefiles (geometries): Census tract data and middle school attendance zones. While both shapefiles obviously have geometries, the census tract data also has substantial amount of zipcode-level income information (things like median family income).

These middle school attendance zones are completely irregular and do not follow any zipcode boundary lines, which means that each middle school attendance zone can have different portions of multiple zip codes comprising the attendance zone. Looking at a certain county, which has a number of middle schools and many zip codes, I would like to have an idea of the average wealth of any particular middle school family.

I need to use the zipcode-level Census data on family income but will need to approximate the average family income of a middle school family by taking a weighted average of the different zipcodes that feed into that middle school attendance zone.

Thus, I want to overlay the two shapefiles and extract the proportion of the every zipcode that is present in every middle school attendance zone. I have attempted to use the GeoPandas overlay function with intersect but since this is a tricky problem and I'm relatively new to this, I didn't get to the answer I was looking for...or maybe I did but I'm just too confused to understand it.


You will need aerial interpolation, which is implemented in PySAL's tobler module based on geopandas. - https://pysal.org/tobler/

The function area_interpolate is the one you are looking for - https://pysal.org/tobler/generated/tobler.area_weighted.area_interpolate.html#tobler.area_weighted.area_interpolate.


There is actually a really good guide on this already. I won't repeat what is already written, but please read this to answer your question:


Edit: Re-reading the question, since your zip codes don't overlap themselves (i hope), you may just be able to use the Zonal Statistics Tool and not have to iteratively calculate zonal statistics for each zone.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.