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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jake-low
Copy link

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

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