Miniproj

This crate implements geographic coordinate projections between projected coordinate systems and their underlying geographic coordinate systems, for projected coordinate reference systems defined by the European Petroleum Survey Group Geodesy. It was originally developped at the GEOMAR Helmholtz Centre for Ocean Research as part of the Digital Earth Project, and continues to provide reprojection functionality to the Digital Earth Viewer.

The projections are implemented according to the Guidance Notes, with all "dynamically uniform" local variables calculated at compile time. The projections are then stored in a static PHFMap for quick access at runtime. Code generation is split out into the miniproj-epsg-registry crate, while the operations themselves are implemented in miniproj-ops.

Miniproj is not related to or derived from Proj.

Scope

Projections

EPSG Code | Operation Method Name | # of Projected CRS covered ----------|---------------------------------------|--------------------------- 9807 | Transverse Mercator | 3591 9802 | Lambert Conic Conformal (2SP) | 949 9801 | Lambert Conic Conformal (1SP) | 215 9822 | Albers Equal Area | 36 9809 | Oblique Stereographic | 20 9820 | Lambert Azimuthal Equal Area | 14 9810 | Polar Stereographic (Variant A) | 10 1024 | Popular Visualisation Pseudo-Mercator | 1

Conversions

EPSG Code | Operation Method Name ----------|---------------------------------- 9602 | Geographic/Geocentric Conversions

Transformations

EPSG Code | Operation Method Name ----------|---------------------- |

Usage example

```rust // Get the WGS84 UTM zone 32N projection use miniproj::{ getprojection, Projection, getellipsoidcode, getellipsoid, Ellipsoid }; let projection = get_projection(32632) .expect("Projection not implemented.");

// Coordinates of the office where this crate was written in UTM: let (easting, northing) = (576935.86f64, 6020593.46f64);

// To get the latitude and longitude, use the Projection::todeg // method. Note that the order of the returned tuple is not // alphabetical, but instead follows the axis order (X for // Longitude, Y for Latitude). let (lon, lat) = projection.projectedto_deg(easting, northing);

assert!((lon - 10.183034).abs() < 0.000001); assert!((lat - 54.327389).abs() < 0.000001);

// To convert this geographic position to a geocentric position // (a position in euclidian space), get the underlying ellipsoid:

let ellipsoid = getellipsoidcode(32632) .andthen(|c| getellipsoid(c)) .expect("No associated ellipsoid.");

// Do the actual conversion. Axis order applies as explained above. // Height as per GPS altitude. let (x, y, z) = ellipsoid.degtogeocentric(lon, lat, 53.7);

assert!((x - 3668985.10).abs() < 0.1); assert!((y - 659033.08).abs() < 0.1); assert!((z - 5158122.64).abs() < 0.1);

```

Limitations

Miniproj is still under development and missing some important functionality. If you are looking for a refined, proven library, check out PROJ.

Changelog

0.9.0

0.8.0

0.7.0

0.6.0

0.5.0

0.4.0

0.3.0

0.2.0

0.1.1

Roadmap

Before 1.0.0

Long-Term

License

As many of the other components of the Digital Earth Viewer, Miniproj is licensed under EUPL v1.2, which is a copyleft license similar and compatible to GPLv2 and available in 23 languages. This license does not apply to the projections themselves. The database files are extracts from the EPSG Geodetic Parameter Registry and redistributed under their own Terms of Use.