#maps #calculations

plane-projection

Zero-dependency fact approximate distance on Earth calculation

6 releases

Uses new Rust 2024

0.3.2 Mar 17, 2025
0.3.1 Mar 17, 2025
0.2.1 Mar 8, 2025
0.1.0 Jan 14, 2025

#117 in Geospatial

Download history 60/week @ 2025-01-08 60/week @ 2025-01-15 11/week @ 2025-01-29 15/week @ 2025-02-05 2/week @ 2025-02-12 39/week @ 2025-02-19 12/week @ 2025-02-26 300/week @ 2025-03-05 135/week @ 2025-03-12 55/week @ 2025-03-19

504 downloads per month

MIT/Apache

9KB
103 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.3"

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