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§
- Parse
Error - Parse error.
Functions§
- parse_
crs - Parse a CRS definition string in any supported format.
- transform_
from_ crs_ strings - Create a
Transformfrom two CRS strings in any format. - transform_
from_ crs_ strings_ horizontal - Create a horizontal-only
Transformfrom two CRS strings in any format. - transform_
from_ crs_ strings_ horizontal_ with_ selection_ options - Create a horizontal-only
Transformfrom two CRS strings using explicit selection options. - transform_
from_ crs_ strings_ with_ selection_ options - Create a
Transformfrom two CRS strings using explicit selection options.