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

Add line segmentize trait #1055

Merged
merged 15 commits into from
Sep 26, 2023
Merged

Add line segmentize trait #1055

merged 15 commits into from
Sep 26, 2023

Conversation

JosiahParry
Copy link
Contributor

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

This PR adds a new trait LineStringSegmentize which provides a method line_segmentize(n: usize) to split LineStrings inton equal length LineStrings which are returned as an Option<MultiLineString> . This is inspired by the lwgeom R package which wraps liblwgeom from PostGIS.

@JosiahParry

This comment was marked as outdated.

@urschrei
Copy link
Member

Looks like Clippy still isn't happy. Do you see those failures when you run it locally?

@JosiahParry

This comment was marked as outdated.

@JosiahParry
Copy link
Contributor Author

I pulled the most recent changes from main and CI is failing unrelated to my changes.

  failed to query replaced source registry `crates-io`

@michaelkirk
Copy link
Member

A couple lines further up in the failed action output shows:

   Updating crates.io index
warning: spurious network error (3 tries remaining): [28] Timeout was reached (Operation too slow. Less than 10 bytes/sec transferred the last 30 seconds)
warning: spurious network error (2 tries remaining): [28] Timeout was reached (Operation too slow. Less than 10 bytes/sec transferred the last 30 seconds)
warning: spurious network error (1 tries remaining): [28] Timeout was reached (Operation too slow. Less than 10 bytes/sec transferred the last 30 seconds)

So, presumably this is some kind of transient network failure. I've restarted the jobs. 🤞

@JosiahParry
Copy link
Contributor Author

thanks @michaelkirk! Looks good now.

@michaelkirk
Copy link
Member

BTW have you seen #1050?

It's not quite the same thing, but it seems like maybe you could leverage the functionality within. Though, I'm not sure if you'd want to, I haven't thought about it very hard.

@JosiahParry
Copy link
Contributor Author

#1050 is interesting and likely a bit more challenging than what i endeavored for here! I could give it a further look after this.

@JosiahParry
Copy link
Contributor Author

Recent commits allow for n to be greater than the number of Lines that compose a LineString which is done using the Densify trait to ensure that the distance between Coords is x.euclidean_length() / n.

@JosiahParry
Copy link
Contributor Author

I've updated the branch with main. Please let me know what more is needed for this PR. Thanks!

@JosiahParry
Copy link
Contributor Author

Just following up here. Please let me know what more is needed on this PR. Thanks!

@JosiahParry
Copy link
Contributor Author

@michaelkirk / @urschrei, please let me know what tasks are remaining for this PR. Thanks! R bindings to geo are based on my fork with this functionality so a downstream package can improve their peformance by 4 orders of magnitude. I'd love to be able to point to main and keep up with new PRs :)

Copy link
Member

@urschrei urschrei left a comment

Choose a reason for hiding this comment

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

Some minor comments and questions from me.

geo/src/algorithm/linestring_segment.rs Outdated Show resolved Hide resolved
geo/src/algorithm/linestring_segment.rs Outdated Show resolved Hide resolved
geo/src/algorithm/linestring_segment.rs Show resolved Hide resolved
geo/src/lib.rs Outdated Show resolved Hide resolved
geo/src/algorithm/linestring_segment.rs Show resolved Hide resolved
@JosiahParry
Copy link
Contributor Author

All comments are resolved. Praying to the CI overlords 🙏🏼

@urschrei urschrei reopened this Sep 22, 2023
@urschrei
Copy link
Member

Guessing that was an inadvertent close.

@JosiahParry
Copy link
Contributor Author

oops! Correct. Thank you @urschrei. CI caught an example issue.

@JosiahParry
Copy link
Contributor Author

Changes should be resolved and CI is satisfied. @urschrei when you get a chance, let me know if I've missed anything! Thanks again for the feedback

Copy link
Member

@urschrei urschrei left a comment

Choose a reason for hiding this comment

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

LGTM. I'll leave it open for another couple of days in case anyone else wants to take a look.

@JosiahParry
Copy link
Contributor Author

Sounds good! Enjoy you're weekend

@urschrei
Copy link
Member

[tolling bell]
Last call!

@urschrei urschrei added this pull request to the merge queue Sep 26, 2023
Merged via the queue into georust:main with commit eac90b2 Sep 26, 2023
14 checks passed
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.

3 participants