[][src]Crate proj

proj provides bindings to the PROJ v7.0.x API

Two coordinate operations are currently provided: projection (and inverse projection) and conversion. Projection is intended for transformations between geodetic and projected coordinates, and vice versa (inverse projection), while conversion is intended for transformations between projected coordinate systems. The PROJ documentation explains the distinction between these operations.

Anything that can be converted into a geo-types Point via the Into trait can be used as input for the projection and conversion functions, and methods for conversion and projection of slices of Points are available.

Requirements

By default, this crate depends on a pre-built library, so PROJ v7.0.x must be present on your system. While this crate may be backwards-compatible with older PROJ 6 versions, this is neither tested nor supported.

Two features are available:

proj = { version = "0.16.1", features = ["pkg_config"] }
proj = = { version = "0.16.1", features = ["bundled_proj"] }

The pkg_config feature enables the use of pkg-config when linking against libproj – note that pkg-config must be available on your system.

The bundled_proj feature allows you to link against a PROJ included with (and built from source by) the proj-sys crate, upon which this crate is built. To do so, enable the bundled_proj Cargo feature. Currently this feature only supports Linux. Note that this feature requires sqlite3 to be available on your system.

Example

use assert_approx_eq::assert_approx_eq;
extern crate proj;
use proj::Proj;

extern crate geo_types;
use geo_types::Point;

let from = "EPSG:2230";
let to = "EPSG:26946";
let nad_ft_to_m = Proj::new_known_crs(&from, &to, None).unwrap();
let result = nad_ft_to_m
    .convert(Point::new(4760096.421921f64, 3744293.729449f64))
    .unwrap();
assert_approx_eq!(result.x(), 1450880.29f64, 1.0e-2);
assert_approx_eq!(result.y(), 1141263.01f64, 1.0e-2);

Structs

Area

The bounding box of an area of use

Proj

A PROJ instance