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 geo-traits for reading from WKT #123

Merged
merged 8 commits into from
Nov 26, 2024
Merged

Conversation

kylebarron
Copy link
Member

  • I agree to follow the project's code of conduct.
  • I added an entry to CHANGES.md if knowledge of this change could be valuable to users.
  • I ran cargo fmt

Ref georust/geo#1157

@kylebarron kylebarron mentioned this pull request Oct 15, 2024
2 tasks
src/types/coord.rs Outdated Show resolved Hide resolved
type GeometryType<'a> = &'a Wkt<T> where Self: 'a;

fn dim(&self) -> geo_traits::Dimensions {
if self.0.is_empty() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be parsed from the input?

GEOMETRYCOLLECTION ZM EMPTY

That might be a larger change though - requiring explicit tracking of the dimensionality of the geometry.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't recall that empty geometries could also have a dimension. Does simple features allow that?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I'm not sure. I just assumed that this was valid:

GEOMETRYCOLLECTION Z(POLYGON Z EMPTY, POINT Z(1 2 3))

Maybe it's not?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah you're right, it is valid:
image
(I assume shapely/geos implement Simple Features accurately)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say that yes, long-term we should figure out a way to maintain the dimension for empty WKT geometries.

@kylebarron kylebarron marked this pull request as ready for review October 26, 2024 16:25
@kylebarron kylebarron changed the title Implement geo-traits export Implement geo-traits for reading from WKT Oct 26, 2024
Copy link
Member

@michaelkirk michaelkirk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to make a PR into geo-traits with the unchecked/or_panic variants so we can stop having the same conversation in every geo-traits repo 🤣

type RingType<'a> = &'a LineString<T> where Self: 'a;

fn dim(&self) -> geo_traits::Dimensions {
// TODO: infer dimension from empty WKT
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please make an issue describing the work to be done here and any context that we might not remember in a hundred years when someone actually does the work?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made #125

src/types/polygon.rs Outdated Show resolved Hide resolved
@michaelkirk
Copy link
Member

(other than the unchecked stuff, this looks good!)

@michaelkirk
Copy link
Member

michaelkirk commented Nov 5, 2024

Let's release geo-traits-0.2.0 first so we can avoid one sem-ver break.

georust/geo#1263

@kylebarron
Copy link
Member Author

I updated this to geo-traits 0.2. Can I get a ✅ ?

@michaelkirk michaelkirk merged commit cdbff53 into main Nov 26, 2024
1 check passed
@michaelkirk michaelkirk deleted the kyle/geo-traits branch November 26, 2024 05:47
@kylebarron
Copy link
Member Author

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