Skip to main content

Crate proj_wkt

Crate proj_wkt 

Source
Expand description

Parser for WKT and PROJ format CRS strings.

Converts CRS definition strings into proj_core::CrsDef values that can be used with proj_core::Transform::from_crs_defs().

§Supported formats

  • Authority codes: "EPSG:4326" — delegates to proj-core’s registry
  • PROJ strings: "+proj=utm +zone=18 +datum=WGS84" — parsed into CrsDef
  • WKT1: GEOGCS[...] / PROJCS[...] — extracts AUTHORITY tag when present, otherwise parses projection parameters
  • WKT2/PROJJSON compound CRS: parses explicit vertical CRS components for equality-checked z preservation and same-reference vertical unit conversion

Custom CRS definitions are only accepted when their semantics fit the proj_core::CrsDef model: longitude/latitude geographic coordinates in degrees with a Greenwich prime meridian, projected coordinates with easting/northing axis order, and compound vertical components that can be preserved or unit-converted only when source and target vertical CRS definitions use the same vertical reference frame. Unsupported axis-order, prime-meridian, geographic angular-unit, and vertical transformation semantics are rejected.

§Example

use proj_wkt::parse_crs;
use proj_core::Transform;

let from = parse_crs("+proj=longlat +datum=WGS84").unwrap();
let to = parse_crs("EPSG:3857").unwrap();
let t = Transform::from_crs_defs(&from, &to).unwrap();
let (x, y) = t.convert((-74.006, 40.7128)).unwrap();

Structs§

Proj
Lightweight compatibility facade for downstream code that currently expects a proj::Proj-like flow:

Enums§

ParseError
Parse error.

Functions§

parse_crs
Parse a CRS definition string in any supported format.
transform_from_crs_strings
Create a Transform from two CRS strings in any format.
transform_from_crs_strings_horizontal
Create a horizontal-only Transform from two CRS strings in any format.
transform_from_crs_strings_horizontal_with_selection_options
Create a horizontal-only Transform from two CRS strings using explicit selection options.
transform_from_crs_strings_with_selection_options
Create a Transform from two CRS strings using explicit selection options.

Type Aliases§

Result