Skip to content

Added the point in polygon to the iterator #245

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

shaungehring-RV
Copy link

Added the ability to iterate through shape records and only return records where a lat/lon point is in the polygon. This can be used to pinpoint a block someone is in just from their current point

@JamesParrott
Copy link
Collaborator

JamesParrott commented Jul 25, 2025

Hi Shaun, sorry nobody's replied to your PR in 3 years!

This is a nice feature, but it needs shapely, where as currently PyShp is a pure Python library. Is it possible to find a pure Python implementation for this test:? if pnt is not None and not (Polygon(record.points).contains(Point(pnt))):

It's great you've added a test too, but the condition inside it is the same as above: if Polygon(shape.points).contains(Point(pnt)):
Is there an alternative source of truth to test the implementation against (i.e. instead of essentially running the same code twice)?

I'll think about adding an optional dependency on Shapely if there's (still) interest.

Thanks,

James.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants