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 GeodesicIntermediate algorithm #608

Merged
merged 5 commits into from
Jan 24, 2021
Merged

Add GeodesicIntermediate algorithm #608

merged 5 commits into from
Jan 24, 2021

Conversation

profil
Copy link
Contributor

@profil profil commented Jan 19, 2021

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

Hello!
I was in the need of generating accurate points on a line (just like https://pyproj4.github.io/pyproj/stable/api/geod.html#pyproj.Geod.npts), so I might as well submit a PR with my implementation.
Borrowing heavily from the haversine intermediate module.

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.

A couple minor cleanups requested, but the functionality looks great!

geo/src/algorithm/geodesic_intermediate.rs Outdated Show resolved Hide resolved
geo/src/algorithm/geodesic_intermediate.rs Outdated Show resolved Hide resolved
@profil
Copy link
Contributor Author

profil commented Jan 19, 2021

Thanks for the comments, just pushed some updates.

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.

This looks good - thank you @profil!

I'm going to wait a couple days before merging in case anyone else wants to review.

In the meanwhile, could you push up a commit to advertise this new feature in geo/CHANGES.md?

@profil
Copy link
Contributor Author

profil commented Jan 19, 2021

Alright, cool! Thanks for quick feedback 😃

@martinfrances107
Copy link
Contributor

I have had a superficial look at this .. and it looks good.

I am busy at the moment...I won't have time until the weekend to do a proper review.

If it helps, I will sit down first thing sat morning (uk time [ utc + 0] ) . with a pot of coffee and do something better.

@martinfrances107
Copy link
Contributor

sorry by 'do something better' I mean in terms of review... the code quality looks good.

Copy link
Contributor

@martinfrances107 martinfrances107 left a comment

Choose a reason for hiding this comment

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

I have looked over the algorithm carefully and could find only minor nits
Otherwise this looks really good.

g.direct(self.lat(), self.lng(), azi1, total_distance * current_step);
let point = Point::new(lon2, lat2);
points.push(point);
current_step = current_step + interval;
Copy link
Contributor

Choose a reason for hiding this comment

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

We have recently removed all warnings generated by running 'cargo clippy' on the project.

Its a really minor point but this PR introduced a single clippy warning. The solution is the change this line : -
current_step = current_step + interval;

into

current_step+=interval

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Of course! TIL about clippy

/// # Examples
///
/// ```
/// # #[macro_use] extern crate approx;
Copy link
Contributor

Choose a reason for hiding this comment

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

I could not justify these line

  • /// # #[macro_use] extern crate approx;
  • /// #

when I ran cargo doc and looked at the generated HTML

geo/target/doc/geo/algorithm/geodesic_intermediate/trait.GeodesicIntermediate.html

It did not appear in the output... perhaps we can just simplify by removing them.

Copy link
Member

@michaelkirk michaelkirk Jan 22, 2021

Choose a reason for hiding this comment

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

Within a doc comment code block, lines starting with a # denote that the line should not be output into the docs, but they are executed (and necessary) when running the doc-test.

It's commonly used to keep the rendered docs concise and focused on the usage, rather than implementation details like what testing library we use.

@michaelkirk
Copy link
Member

michaelkirk commented Jan 22, 2021

Thanks for looking @martinfrances107 - once the one nit is addressed, I'll merge posthaste.

@profil
Copy link
Contributor Author

profil commented Jan 23, 2021

Just had my evening coffee and fixed the nit. Thanks for reviewing!

Copy link
Member

@frewsxcv frewsxcv left a comment

Choose a reason for hiding this comment

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

thanks!

@michaelkirk
Copy link
Member

bors r+

@bors
Copy link
Contributor

bors bot commented Jan 24, 2021

Build succeeded:

@bors bors bot merged commit fd18ab9 into georust:master Jan 24, 2021
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.

4 participants