Skip to content
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

Enable lat/lon coordinates #7

Open
bast opened this issue Jan 28, 2020 · 5 comments
Open

Enable lat/lon coordinates #7

bast opened this issue Jan 28, 2020 · 5 comments

Comments

@bast
Copy link
Owner

bast commented Jan 28, 2020

Collecting some notes/reading material:

@bast bast transferred this issue from bast/polygons-rs May 11, 2020
@bast bast mentioned this issue May 30, 2020
@district10
Copy link

Maybe just use https://github.com/mapbox/cheap-ruler to convert lon/lat to local XYZ (ENU) coordinates reference system. (I did similar thing here)

Did you benchmarked your point-in-polygon.

I used to use point-in-polygon test from GEOS/shapely, but found out that matplotlib version of this is generally faster.

@bast
Copy link
Owner Author

bast commented Mar 7, 2023

About the lat/lon: I think it is not so simple because it's not just about converting coordinates but then the question whether a point is on the one side or the other side of a "line" changes since lines become "curved".

About the benchmarking: I ran benchmarks but did not compare much with other codes. What is the size of the system that you have used to benchmark GEOS/shapely? (how many polygons, how many points)

@district10
Copy link

"line" changes since lines become "curved".

Seems you are right. I thought point-in-polygon is stable before/after converting WGS84 to ENU, because lon: east, lat:north is bilinear in local spatial reference system (under my typical use case of polygon as an area of highway ramp, intersection, crossover).

Yeah, when your use cases involves bigger area (1000km+ maybe), you can't just choose one ENU (or latitude, like cheap-ruler did).

how many polygons, how many points

Benchmarking is tricky, I created some random points (10,000) and random polygons (30% of whole area), tests show that matplotlib version is always 50x times faster (same result).

code here: https://fast-crossing.readthedocs.io/en/latest/point-in-polygon/

@bast
Copy link
Owner Author

bast commented Mar 7, 2023

I agree that for smaller distances your approach is fine but we use this for coastlines and there the distances can be significant.

The benchmarks are interesting. I use polygons for millions of points and typically thousands of polygons.

@district10
Copy link

I tested 1000,000 points:

image

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

No branches or pull requests

2 participants