georust / geo

Rust geospatial primitives & algorithms
https://crates.io/crates/geo
Other
1.57k stars 199 forks source link

`Polygon` doesn't implement `PointDistance` (but `LineString` does) #1267

Open lnicola opened 6 days ago

lnicola commented 6 days ago

I guess this explains why I never understood how to use rstar...

urschrei commented 6 days ago

This needs point-in-polygon. See https://github.com/georust/geo/pull/984#issuecomment-1432928362 for why this isn't easy: in short, a robust point-in-polygon implementation requires quite a lot of supporting code. We (obviously) have all of that in geo, and can't use it for geo-types because that would create a circular dependency. The alternative is copy-and-pasting everything that's required into private_utils.rs, which is not maintainable.

In short: https://github.com/georust/geo/pull/984#issuecomment-1747378040 is still the most sensible approach, except that it causes a lot of other problems.

lnicola commented 5 days ago

I guess a future rewrite of geo based on geo-traits will solve this?

That said, maybe geo should lose the geo-types dependency? I think it's used in a couple of different ways:

So should geo even use Polygon or expose Polygon in its implementation or public API?