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

Implement TryFrom<geo_types::Geometry> for GEOS Geometry #155

Merged
merged 3 commits into from
Jan 8, 2025

Conversation

jake-low
Copy link
Contributor

...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 a GeometryCollection, and a GeometryCollection is made up of Geometrys (in order to wrap the heterogeneous members in a uniform type). The unit test I added exercises both conversions.

Feedback is very welcome.

...and also TryFrom<geo_types::GeometryCollection>
src/from_geo.rs Outdated
Comment on lines 241 to 243
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"),
Copy link
Member

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.

Copy link
Contributor Author

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.

@GuillaumeGomez
Copy link
Member

Weird, it seems like building libgeos in the CI is not working anymore...

@jake-low
Copy link
Contributor Author

jake-low commented Jan 8, 2025

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. 🙂

@GuillaumeGomez GuillaumeGomez merged commit 1a5a9e7 into georust:master Jan 8, 2025
8 of 15 checks passed
@GuillaumeGomez
Copy link
Member

Thanks!

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