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

proj w/o geo #41

Merged
merged 10 commits into from
Oct 8, 2020
Merged

proj w/o geo #41

merged 10 commits into from
Oct 8, 2020

Conversation

michaelkirk
Copy link
Member

It seems like the potential users of proj would include people who don't need/want to opt into the whole geo ecosystem.

What would you think about having the proj interface be trait-based and having the geo-integration be a feature?

If this seems like a reasonable direction, before merging I'd like to update the docs to show:

  1. how you can use this with the greater geo ecosystem
  2. how you can impl your own point type if you're not using geo.
  3. how you can use the built-in (Float, Float) impl

WDYT @urschrei?

@michaelkirk michaelkirk force-pushed the mkirk/trait branch 2 times, most recently from 39c4381 to ae08ea1 Compare September 8, 2020 16:46
src/geo_types.rs Outdated
/// assert_approx_eq!(result.x, 1450880.29f64, 1.0e-2);
/// assert_approx_eq!(result.y, 1141263.01f64, 1.0e-2);
/// ```
impl<T: crate::proj::CoordinateType> crate::Point<T> for geo_types::Coordinate<T> {
Copy link
Member Author

Choose a reason for hiding this comment

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

Note - this PR would also let you do Proj stuff with Coords, not just points.

Copy link
Member Author

@michaelkirk michaelkirk Sep 8, 2020

Choose a reason for hiding this comment

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

Thinking about it a bit more - we could take this even further and have a Projectable trait or somesuch that just required implementing a Iter<Item=proj::Point<T>>, then we could get easy projection of all the geo-type's. 🤔

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'm not going to pursue the Iter scenario in this PR, but would like to do it in some followup work.

@michaelkirk
Copy link
Member Author

We could make the geo-types feature a default feature to make this a non-breaking change.

@urschrei
Copy link
Member

urschrei commented Sep 9, 2020

I'm in favour of this so long as we write clear documentation around it. In general, I find it tricky to present feature interaction in a clear and concise way, but we needn't let that stop us…

@michaelkirk michaelkirk force-pushed the mkirk/trait branch 2 times, most recently from d6cef04 to c0f7f71 Compare September 11, 2020 21:46
Copy link
Member Author

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

Ok, with the caveat of the README (see comment) I think this is ready for review. Can you take a look @urschrei?

@@ -22,10 +22,7 @@ By default, this crate depends on a pre-built `libproj`, so PROJ v7.1.x must be

## Convert from [NAD 83 US Survey Feet](https://epsg.io/2230) to [NAD 83 Meters](https://epsg.io/26946) Using EPSG Codes
```rust
Copy link
Member Author

Choose a reason for hiding this comment

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

The README contains lots of snippets from the primary docs. Since it can be tedious and error prone to copy changes back and forth between them, I was hoping we could review just the primary docs, and once they're in good shape I can update the README before a final review.

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.

This lgtm, let's merge!

@urschrei
Copy link
Member

urschrei commented Oct 8, 2020

I think this probably just needs a rebase now that we've switched to GH Actions?

It more closely corresponds with how we're using the terminology in geo,
and paves the way for interacting with "a bunch of coords" from
geo-types

e.g. if we're projecting a linestring, we'd operate on the linestrings
coords, not it's points.

Not a big deal, but since we're introducing a new thing (the trait), no
reason to inherit the old name if another fits better.
These changes were all made in src/lib.rs

Then I ran:

    cargo readme > README.md

But unfortunately that doesn't capture feature-gated docs, so manually
copied over the geo-types doc
@michaelkirk michaelkirk marked this pull request as ready for review October 8, 2020 17:50
@michaelkirk
Copy link
Member Author

Ok! Rebased and addressed conflicts in the docs.

Note that I'm (almost) wholesale copying the contents of README.md from the doc comments in src/lib.rs - the only divergence is the GH actions badge.

@michaelkirk
Copy link
Member Author

bors try

@@ -14,7 +14,7 @@ edition = "2018"

[dependencies]
proj-sys = { version = "0.18.3", path = "proj-sys" }
geo-types ="0.6.0"
geo-types = { version = "0.6", optional = true }
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 snuck this in - there wasn't a reason for us to peg the patch version of geo-types was there?

@michaelkirk michaelkirk changed the title Draft: proj w/o geo proj w/o geo Oct 8, 2020
@michaelkirk
Copy link
Member Author

bors try

I'm not sure why - but bors crashed... let's try again.

@bors
Copy link
Contributor

bors bot commented Oct 8, 2020

try

Already running a review

@michaelkirk
Copy link
Member Author

bors r=urschrei

@michaelkirk
Copy link
Member Author

bors cancel

@bors
Copy link
Contributor

bors bot commented Oct 8, 2020

Build succeeded:

@bors bors bot merged commit 4b03fcf into georust:master Oct 8, 2020
@michaelkirk
Copy link
Member Author

🤦 booooorrrsss

Oh well, I just wanted to fix a little typo in the README and squash the commits, but bors will do what bors wants.

@michaelkirk
Copy link
Member Author

Oh, actually that was my bad. I should have said bors r- instead of bors cancel. Sorry for doubting you bors 😬.

@urschrei
Copy link
Member

urschrei commented Oct 8, 2020

We have always known bots and people couldn't live in harmony. It's been a good run. (Thank you for doing this!)

@bors
Copy link
Contributor

bors bot commented Jan 6, 2021

try

Merge conflict.

@michaelkirk
Copy link
Member Author

wth bors

@michaelkirk
Copy link
Member Author

image
That eye. So piercing.

@urschrei
Copy link
Member

urschrei commented Jan 6, 2021

I feel judged.

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