#earth #maps #calculations #plane #projection #distance

plane-projection

Zero-dependency fact approximate distance on Earth calculation

1 unstable release

new 0.1.0 Jan 14, 2025

#122 in Geospatial

Download history 94/week @ 2025-01-11

95 downloads per month

MIT/Apache

7KB
63 lines

About

A plane projection, useful for blazingly fast approximate distance calculations. Based on WGS84 ellipsoid model of the Earth, plane projection provides 0.1% precision on distances under 500km at latitudes up to the 65°. See the article about Cheap Ruler for more details about the principle and formulas behind.

Comparing to another Rust crates that provide the same functionality, cheap-ruler-rs and flat-projection, this crate has zero dependencies and minimalistic API.

Usage

Add this to your Cargo.toml:

[dependencies]
plane-projection = "0.1"

Example

use plane_projection::PlaneProjection;

let proj = PlaneProjection::new(55.65);
let distance = proj.distance(&(55.704141722528554, 13.191304107330561), &(55.60330902847681, 13.001973666557435));
assert_eq!(distance as u32, 16373);

License

All code in this project is dual-licensed under either:

at your option.

No runtime deps