-
Notifications
You must be signed in to change notification settings - Fork 42
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
Implement TryFrom<geo_types::Geometry> for GEOS Geometry #155
Conversation
...and also TryFrom<geo_types::GeometryCollection>
src/from_geo.rs
Outdated
Geometry::Triangle(_) => unimplemented!("Cannot convert Triange to GEOS Geometry"), | ||
Geometry::Rect(_) => unimplemented!("Cannot convert Rect to GEOS Geometry"), | ||
Geometry::Line(_) => unimplemented!("Cannot convert Line to GEOS Geometry"), |
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.
Please return an Err
instead of panicking. TryFrom
is meant for that.
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.
Whoops, good point, thanks. Fixed.
Weird, it seems like building libgeos in the CI is not working anymore... |
I had forgotten about this PR but I'm revisiting it now. Just pushed a commit to fix a typo in one of the error messages I added. I thought this might also trigger the CI build to run again but it looks like it needs approval first. However from looking at other more recent PRs it seems like the issue you noted (libgeos failing to build) is still present. Not sure if this is merge-blocking or not? I'm afraid I don't know enough to suggest a solution. Anyway, let me know if there's anything else you need me to do on this PR. If not, it's here for when you have a chance to act on it, but don't feel rushed. 🙂 |
Thanks! |
...and also TryFrom<geo_types::GeometryCollection>
I noticed that these two trait implementations were missing, and they seemed like they'd be useful inclusions. Each is sort of necessary to implement the other: a
Geometry
can wrap aGeometryCollection
, and aGeometryCollection
is made up ofGeometry
s (in order to wrap the heterogeneous members in a uniform type). The unit test I added exercises both conversions.Feedback is very welcome.