proj_core/lib.rs
1#![forbid(unsafe_code)]
2
3//! Pure-Rust coordinate transformation library.
4//!
5//! No C dependencies, no unsafe, WASM-compatible.
6//!
7//! The primary type is [`Transform`], which provides CRS-to-CRS coordinate
8//! transformation using authority codes (e.g., `"EPSG:4326"`).
9//!
10//! # Example
11//!
12//! ```
13//! use proj_core::Transform;
14//!
15//! // Create a transform from WGS84 geographic to Web Mercator
16//! let t = Transform::new("EPSG:4326", "EPSG:3857").unwrap();
17//!
18//! // Transform NYC coordinates (lon, lat in degrees) → (x, y in meters)
19//! let (x, y) = t.convert((-74.006, 40.7128)).unwrap();
20//! assert!((x - (-8238310.0)).abs() < 100.0);
21//!
22//! // Inverse: Web Mercator → WGS84
23//! let inv = Transform::new("EPSG:3857", "EPSG:4326").unwrap();
24//! let (lon, lat) = inv.convert((x, y)).unwrap();
25//! assert!((lon - (-74.006)).abs() < 1e-6);
26//! ```
27
28pub mod coord;
29pub mod crs;
30pub mod datum;
31pub mod ellipsoid;
32mod epsg_db;
33pub mod error;
34mod geocentric;
35mod helmert;
36mod projection;
37pub mod registry;
38pub mod transform;
39
40pub use coord::{Bounds, Coord, Coord3D, Transformable, Transformable3D};
41pub use crs::{CrsDef, GeographicCrsDef, ProjectedCrsDef, ProjectionMethod};
42pub use datum::{Datum, HelmertParams};
43pub use ellipsoid::Ellipsoid;
44pub use error::{Error, Result};
45pub use registry::{lookup_authority_code, lookup_epsg};
46pub use transform::Transform;