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

Updates to bindings and docs #5

Merged
merged 2 commits into from Mar 11, 2018
Merged

Updates to bindings and docs #5

merged 2 commits into from Mar 11, 2018

Conversation

urschrei
Copy link
Member

@urschrei urschrei commented Mar 7, 2018

  • specify proj.4 API version, now that proj.4 v5.0.0 has been released
  • Update dependencies
  • Replace use of tuples (not layout-safe for FFI) with c_void
  • Add rudimentary inline docs
  • Add example from tests to README

- specify proj.4, now that proj.5 has been released
- Update dependencies
- Replace use of tuples (not layout-safe for FFI) with `c_void`
- Add rudimentary inline docs
- Add example from tests to README
@urschrei urschrei requested a review from frewsxcv March 7, 2018 15:26
@urschrei
Copy link
Member Author

urschrei commented Mar 7, 2018

(preliminary steps toward addressing some issues in georust/geo#32)

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.

🎊 🎉

README.md Outdated
Rust bindings for [proj](https://github.com/OSGeo/proj.4)
Rust bindings for [proj.4](https://github.com/OSGeo/proj.4)

# Example
Copy link
Member

Choose a reason for hiding this comment

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

❤️

README.md Outdated
"+proj=sterea +lat_0=46 +lon_0=25 +k=0.99975 +x_0=500000 +y_0=500000 +ellps=krass +units=m +no_defs"
).unwrap();
let rp = stereo70.project(&wgs84, Point::new(500000., 500000.));
# New Point coords are (0.436332, 0.802851)
Copy link
Member

Choose a reason for hiding this comment

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

alternatively, you could do an assert_eq!

README.md Outdated
extern crate geo;
use geo::types::Point;

# reproject coordinates from Stereo70 with custom params into WGS84 lon and lat coordinates
Copy link
Member

Choose a reason for hiding this comment

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

comments in rust start with // 😅

Copy link
Member Author

Choose a reason for hiding this comment

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

🤭

@urschrei urschrei merged commit cd0c49b into georust:master Mar 11, 2018
@frewsxcv
Copy link
Member

looks like i need to give publish permissions, one sec

@frewsxcv
Copy link
Member

done

@urschrei
Copy link
Member Author

<3 I think I've set them up correctly for georust core for proj-sys

@frewsxcv
Copy link
Member

yep, looks good! also gonna close #1

bors bot added a commit that referenced this pull request Mar 12, 2018
6: Move to proj-sys and proj.4 v5 r=frewsxcv a=urschrei

With the surprising release (after about 23 years) of proj.4 v5, and my blowing-the-cobwebs-off PR from yesterday (#5), I thought I'd publish a [`proj-sys`](https://crates.io/crates/proj-sys) crate (generated using `bindgen`), and use it as the basis for this.
Currently, the API contains a very breaking change, because proj.4 performs operations differently now: it distinguishes between _projection_ (conversions from geodetic to projected coordinates) and _conversion_ (conversions between projected coordinate systems, usually within the same datum / reference frame). The latter uses a concept proj.4 calls the [`pipeline`](http://proj4.org/operations/pipeline.html), which allows for multi-step operations to achieve almost any kind of conversion, as opposed to the old system, which only allowed the specification of `from` and `to` projections.
This change is mirrored in the rust-proj API: for simple (inverse) projection from/to geodetic coordinates, there's `project`, and for conversions and transformations there's `convert`.
I'm not 100% sold on the API, because it feels a bit less flexible than the old one: you could specify different destination projections, and re-use the `Proj` struct. Using the new API, you have to specify everything up front, but you have a great deal more flexibility in terms of what you can do with it (see the `conversion` example). The conversion function also returns a `Result` now, and errors are implemented using `Failure`.
<s>Anyway, this is currently WIP until I figure out how to detect errors using the new API.</s>
urschrei added a commit to urschrei/rust-proj that referenced this pull request Sep 28, 2020
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.

None yet

2 participants