-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Interpolate to the union of the polygons from two dataframes #192
base: main
Are you sure you want to change the base?
Conversation
sjsrey
commented
Nov 19, 2023
- interpolate to the union of the polygons from two dataframes
- classify spatial relations between target geometries and a buffer
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #192 +/- ##
==========================================
+ Coverage 54.82% 55.83% +1.01%
==========================================
Files 15 17 +2
Lines 839 865 +26
==========================================
+ Hits 460 483 +23
- Misses 379 382 +3 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not convinced by either of these changes (but surely won't block them if you want to go ahead).
area_buffer:
- why it is called area buffer?
- what you are trying to do there is a relate pattern. I think that this should live in geopandas and make use of sindex without a predicate for the first sift and then
shapely.relate
for the second, with a mapping of the resulting he DE-9IM intersection matrix to legible names.
area_faces:
- if the whole code is a call to
overlay
and another toarea_interpolate
, is it something that is needed at all? What is the use case for it? Isn't it better to add an example notebook with that use case calling overlay and than area_interpolate? - if so, the name is not suggesting what it is doing at all :).
I agree with @martinfleis on all points above. |
This is needed in my use case as I will be interpolating to those three different geometries.
More of a helper function as I end up using this often. It comes up in tract harmonization research. Could be other use cases. I'm all ears regarding better names. |
how about on But another common case is when you have a second geometry that doesnt exhaust the study area and you want to understand the allocation of some person/thing/resource inside or outside the second geometry. So like, how much of the population with demographic characteristic X lives inside versus outside the target geometry {tax district, political district, proximity to waterfront, distance from superfund site, etc} where you know the target covers only a portion of the source. Depending on the relationship between their geoms, that can be a tougher to answer than 'select the centroids inside the buffer'. If you haven't thought about it carefully, you might just interpolate source-->target and compare source vs target (forgetting about the double counting)--or, if you haven' thought of the overlay trick, it would be tempting to interpolate source-->target geom with allocate_total=False, then clip out the target from the source, and interpolate source-->clipped source (again remembering to allocate_total=False) and compare target vs clipped source (doing in 3 steps what you could've done in, like, 1) serge's notebook covers this, just without quite the detailed context, so maybe we need another applied example, but i think the convenience function might be worth keeping around |