#wgs84 #china #gps #gcj-02 #bd-09

undrift_gps

Convert between various coordinate systems: GCJ-02, WGS-84 and BD-09

4 releases (2 breaking)

0.3.1 Feb 24, 2021
0.2.1 Feb 22, 2021
0.1.1 May 26, 2018
0.1.0 May 26, 2018

#332 in Science

Download history 6/week @ 2024-02-26 4/week @ 2024-03-11 59/week @ 2024-04-01

63 downloads per month

MIT license

13KB
350 lines

Undrift GPS

Traversal between the Earth and the Mars in just 6 functions! Keep it simple and stupid.

Kudos to Zili FENG!

/// Convert a GCJ-02 coordinate into WGS-84
pub fn gcj_to_wgs(lat: f64, lon: f64) -> (f64, f64)

/// Convert a GCJ-02 coordinate into BD-09
pub fn gcj_to_bd(lat: f64, lon: f64) -> (f64, f64)

/// Convert a WGS-84 coordinate into GCJ-02
pub fn wgs_to_gcj(lat: f64, lon: f64) -> (f64, f64)

/// Convert a WGS-84 coordinate into BD-09
pub fn wgs_to_bd(lat: f64, lon: f64) -> (f64, f64)

/// Convert a BD-09 coordinate into GCJ-02
pub fn bd_to_gcj(lat: f64, lon: f64) -> (f64, f64)

/// Convert a BD-09 coordinate into WGS-84
pub fn bd_to_wgs(lat: f64, lon: f64) -> (f64, f64)

Usage

Add this to your Cargo.toml:

[dependencies]
undrift_gps = "0.2.1"

No runtime deps