https://github.com/ciscorn/geocentric-rs
Conversion between geodetic (geographic) coordinates and geocentric (cartesian) coordinates in Rust
https://github.com/ciscorn/geocentric-rs
3d coordinates earth geodesy geography geospatial science
Last synced: 5 months ago
JSON representation
Conversion between geodetic (geographic) coordinates and geocentric (cartesian) coordinates in Rust
- Host: GitHub
- URL: https://github.com/ciscorn/geocentric-rs
- Owner: ciscorn
- License: mit
- Created: 2025-03-08T07:32:56.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2025-03-10T05:45:20.000Z (7 months ago)
- Last Synced: 2025-04-30T19:07:16.388Z (5 months ago)
- Topics: 3d, coordinates, earth, geodesy, geography, geospatial, science
- Language: Rust
- Homepage: https://crates.io/crates/geocentric
- Size: 5.86 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# geocentric-rs
[](https://github.com/MIERUNE/geocentric-rs/actions/workflows/Test.yml)
[](https://codecov.io/gh/MIERUNE/geocentric-rs)Conversion between geodetic (geographic) coordinates and geocentric (cartesian) coordinates in Rust.
Keywords: EPSG:4326, EPSG:4979, EPSG:4978
## Usage
```rust
// WGS 84 Ellipsoid
let a = 6378137.; // Semi-major axis
let inv_f = 298.257223563; // Inverse flattening
let f = 1. / inv_f; // Flattening
let e_sq = f * (2. - f); // Eccentricity squared// Convert from geodetic to geocentric
let (x, y, z) = geodetic_to_geocentric(a, e_sq, 140., 37., 50.);// Convert from geocentric to geodetic
let (lng, lat, height) = geocentric_to_geodetic(a, e_sq, x, y, z);
```## References
The `geocentric_to_geodetic` function implements the algorithm described in:
- Hugues Vermeille, *"An analytical method to transform geocentric into geodetic coordinates"*, Journal of Geodesy (2011) 85, pages 105-117. [DOI:10.1007/s00190-010-0419-x](https://doi.org/10.1007/s00190-010-0419-x)
## License
MIT
## Author
Taku Fukada ([@ciscorn](https://github.com/ciscorn))