Expand description
§wbprojection
A map projection library for Rust, inspired by the PROJ library.
§Overview
wbprojection provides forward and inverse transformations between geographic
coordinates (longitude/latitude) and projected coordinates (easting/northing)
for a wide range of map projections and datums.
§Quick Start
use wbprojection::{Projection, ProjectionParams, Ellipsoid};
// Create a UTM Zone 32N projection
let params = ProjectionParams::utm(32, false);
let proj = Projection::new(params).unwrap();
// Forward: lon/lat (degrees) → easting/northing (meters)
let (easting, northing) = proj.forward(9.0, 48.0).unwrap();
println!("Easting: {:.2}, Northing: {:.2}", easting, northing);
// Inverse: easting/northing → lon/lat
let (lon, lat) = proj.inverse(easting, northing).unwrap();
println!("Lon: {:.6}, Lat: {:.6}", lon, lat);§Supported Projections
- Mercator – Standard and Web Mercator (EPSG:3857)
- Transverse Mercator – Foundation for UTM
- UTM – Universal Transverse Mercator (all zones)
- Lambert Conformal Conic – One and two standard parallels
- Albers Equal-Area Conic – Equal-area conic
- Azimuthal Equidistant – Distances true from center point
- Lambert Azimuthal Equal-Area – Equal-area azimuthal
- Krovak – Oblique conformal conic (Czech/Slovak systems)
- Central Conic – Conic projection with one standard parallel
- Lagrange – Conformal spherical projection
- Loximuthal – Rhumb-line based pseudocylindrical projection
- Euler – Conic projection with two standard parallels
- Tissot – Conic projection with two standard parallels
- Murdoch I – Conic projection with two standard parallels
- Murdoch II – Conic projection with two standard parallels
- Murdoch III – Conic projection with two standard parallels
- Perspective Conic – Conic projection with two standard parallels
- Vitkovsky I – Conic projection with two standard parallels
- Tobler-Mercator – Equal-area cylindrical projection
- Winkel II – Compromise pseudocylindrical world projection
- Kavrayskiy V – Pseudocylindrical world projection
- Stereographic – Polar and oblique variants
- Orthographic – Globe-view projection
- Sinusoidal – Equal-area pseudocylindrical
- Mollweide – Equal-area pseudocylindrical
- McBryde-Thomas Flat-Pole Sine (No. 2) – Pseudocylindrical projection
- McBryde-Thomas Flat-Polar Sine (No. 1) – Pseudocylindrical projection
- McBryde-Thomas Flat-Polar Parabolic – Pseudocylindrical projection
- McBryde-Thomas Flat-Polar Quartic – Pseudocylindrical projection
- Nell – Pseudocylindrical projection
- Equal Earth – Equal-area compromise world projection
- Cylindrical Equal-Area – Equal-area cylindrical
- Equirectangular (Plate Carrée) – Simple cylindrical
- Robinson – Compromise pseudocylindrical
- Gnomonic – Great circles map to straight lines
- Aitoff – Compromise world projection
- Van der Grinten – Circular world projection
- Winkel Tripel – National Geographic world projection
- Hammer – Equal-area world projection
- Hatano – Asymmetrical equal-area pseudocylindrical projection
- Eckert I – Pseudocylindrical world projection
- Eckert II – Pseudocylindrical world projection
- Eckert III – Pseudocylindrical world projection
- Eckert IV – Equal-area pseudocylindrical world projection
- Eckert V – Pseudocylindrical world projection
- Miller Cylindrical – Modified Mercator world projection
- Gall Stereographic – Cylindrical stereographic world projection
- Gall-Peters – Equal-area cylindrical world projection
- Behrmann – Equal-area cylindrical projection (30° standard parallel)
- Hobo-Dyer – Equal-area cylindrical projection (37.5° standard parallel)
- Wagner I – Pseudocylindrical world projection
- Wagner II – Pseudocylindrical world projection
- Wagner III – Pseudocylindrical world projection
- Wagner IV – Equal-area pseudocylindrical world projection
- Wagner V – Equal-area pseudocylindrical world projection
- Natural Earth – Compromise pseudocylindrical world projection
- Natural Earth II – Compromise pseudocylindrical world projection
- Wagner VI – Compromise pseudocylindrical world projection
- Eckert VI – Equal-area pseudocylindrical world projection
- Transverse Cylindrical Equal Area – Spherical equal-area cylindrical projection
- Polyconic – American polyconic projection
- Bonne – Equal-area pseudoconical projection
- Craster – Craster Parabolic (Putnins P4) projection
- Putnins P4’ – Pseudocylindrical compromise projection
- Fahey – Pseudocylindrical projection
- Times – Cylindrical compromise projection
- Patterson – Cylindrical compromise projection
- Putnins P3 – Pseudocylindrical compromise projection
- Putnins P3’ – Modified pseudocylindrical compromise projection
- Putnins P5 – Pseudocylindrical compromise projection
- Putnins P5’ – Modified pseudocylindrical compromise projection
- Putnins P1 – Pseudocylindrical projection
- Putnins P2 – Pseudocylindrical projection
- Putnins P6 – Pseudocylindrical projection
- Putnins P6’ – Pseudocylindrical projection
- Quartic Authalic – Equal-area pseudocylindrical projection
- Foucaut – Pseudocylindrical projection
- Winkel I – Compromise pseudocylindrical world projection
- Werenskiold I – Pseudocylindrical projection
- Collignon – Equal-area pseudocylindrical projection
- Nell-Hammer – Pseudocylindrical projection
- Kavrayskiy VII – Pseudocylindrical world projection
§Coordinate Reference Systems
Use the Crs type to perform datum transformations between common
coordinate reference systems including WGS84, NAD83, NAD27, and ETRS89.
Grid-shift workflows are also supported via datum::DatumTransform::GridShift
with loaders in grid_formats and runtime registration in grid_shift.
§3D CRS workflows
wbprojection now supports geocentric (ECEF XYZ) and minimal vertical CRS workflows.
- Use
Crs::transform_to_3dfor strict 3D transforms.- Geographic/Projected <-> Geocentric is supported.
- Vertical <-> Vertical is supported as passthrough.
- Mixed Vertical <-> Geographic/Projected is rejected in strict mode.
- Use
Crs::transform_to_3d_preserve_horizontalfor explicit mixed-mode Vertical <-> Geographic/Projected workflows where horizontal context should be preserved unchanged. - Use
Crs::transform_to_3d_preserve_horizontal_with_vertical_offsets(or its policy-aware variant) when vertical offsets are available from external models. - Use
Crs::transform_to_3d_preserve_horizontal_with_providerwhen offsets should be resolved dynamically from coordinate/CRS context. - Use
ConstantVerticalOffsetProviderfor simple fixed-offset workflows. - Use
GridVerticalOffsetProviderwith registeredVerticalOffsetGridmodels for native bilinear-sampled vertical offsets.
use wbprojection::Crs;
// Geographic <-> Geocentric
let geog = Crs::from_epsg(7843).unwrap();
let geoc = Crs::from_epsg(7842).unwrap();
let (x, y, z) = geog.transform_to_3d(147.0, -35.0, 120.0, &geoc).unwrap();
let (_lon, _lat, _h) = geoc.transform_to_3d(x, y, z, &geog).unwrap();
// Explicit mixed vertical workflow (preserve horizontal context)
let vertical = Crs::from_epsg(7841).unwrap();
let utm = Crs::from_epsg(7846).unwrap();
let (_x2, _y2, _z2) = utm
.transform_to_3d_preserve_horizontal(500_000.0, 6_120_000.0, 42.0, &vertical)
.unwrap();Re-exports§
pub use compound_crs::CompoundCrs;pub use crs::ConstantVerticalOffsetProvider;pub use crs::Crs;pub use crs::CrsTransformPolicy;pub use crs::CrsTransformTrace;pub use crs::GridVerticalOffsetProvider;pub use crs::VerticalOffsetProvider;pub use datum::Datum;pub use ellipsoid::Ellipsoid;pub use epsg::EpsgAliasEntry;pub use epsg::EpsgIdentifyCandidate;pub use epsg::EpsgIdentifyPolicy;pub use epsg::EpsgIdentifyReport;pub use epsg::EpsgResolution;pub use epsg::EpsgResolutionPolicy;pub use epsg::clear_runtime_epsg_aliases;pub use epsg::epsg_alias_catalog;pub use epsg::epsg_from_srs_reference;pub use epsg::epsg_from_wkt;pub use epsg::compound_from_wkt;pub use epsg::from_epsg;pub use epsg::from_epsg_with_catalog;pub use epsg::from_epsg_with_policy;pub use epsg::identify_epsg_from_crs;pub use epsg::identify_epsg_from_crs_report;pub use epsg::identify_epsg_from_crs_with_policy;pub use epsg::identify_epsg_from_wkt;pub use epsg::identify_epsg_from_wkt_report;pub use epsg::identify_epsg_from_wkt_with_policy;pub use epsg::from_wkt;pub use epsg::register_epsg_alias;pub use epsg::resolve_epsg_with_catalog;pub use epsg::resolve_epsg_with_policy;pub use epsg::runtime_epsg_aliases;pub use epsg::to_esri_wkt;pub use epsg::to_geotiff_info;pub use epsg::to_ogc_wkt;pub use epsg::unregister_epsg_alias;pub use epsg::vertical_offset_grid_name;pub use error::ProjectionError;pub use error::Result;pub use grid_formats::list_ntv2_subgrids;pub use grid_formats::load_nadcon_ascii_pair;pub use grid_formats::load_ntv2_gsb;pub use grid_formats::load_ntv2_gsb_subgrid;pub use grid_formats::register_nadcon_ascii_pair;pub use grid_formats::register_ntv2_gsb;pub use grid_formats::register_ntv2_gsb_hierarchy;pub use grid_formats::register_ntv2_gsb_subgrid;pub use grid_formats::resolve_ntv2_hierarchy_grid_name;pub use grid_formats::resolve_ntv2_hierarchy_subgrid;pub use grid_shift::GridShiftGrid;pub use grid_shift::GridShiftSample;pub use grid_shift::get_grid;pub use grid_shift::has_grid;pub use grid_shift::register_grid;pub use grid_shift::unregister_grid;pub use projections::Projection;pub use projections::ProjectionKind;pub use projections::ProjectionParams;pub use transform::CoordTransform;pub use transform::Point2D;pub use transform::Point3D;pub use vertical_grid::VerticalOffsetGrid;pub use vertical_grid::get_vertical_offset_grid;pub use vertical_grid::has_vertical_offset_grid;pub use vertical_grid::load_vertical_grid_from_gtx;pub use vertical_grid::load_vertical_grid_from_isg;pub use vertical_grid::load_vertical_grid_from_simple_header_grid;pub use vertical_grid::register_vertical_offset_grid;pub use vertical_grid::unregister_vertical_offset_grid;
Modules§
- compound_
crs - Compound CRS support (horizontal + vertical).
- crs
- Coordinate Reference System definitions and transformations.
- datum
- Geodetic datum definitions and datum transformations.
- ellipsoid
- Reference ellipsoid definitions.
- epsg
- EPSG coordinate reference system registry.
- error
- Error types for the geoproject library.
- grid_
formats - Grid file format loaders for datum transformations.
- grid_
shift - Grid-shift support for datum transformations.
- projections
- Map projection implementations.
- transform
- Core coordinate types and transformation traits.
- vertical_
grid - Vertical offset grid support for height-reference conversions.
Functions§
- normalize_
longitude - Normalize a longitude value to the range [-180, 180).
- to_
degrees - Convert radians to degrees.
- to_
radians - Convert degrees to radians.