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[...]/COMPD_CS[...]— extracts an AUTHORITY tag when present, otherwise parses projection parameters - WKT1/WKT2/PROJJSON compound CRS: parses explicit vertical CRS components for equality-checked z preservation and same-reference vertical unit conversion
- WKT output: serializes
proj_core::CrsDefvalues to WKT1-styleGEOGCS[...],PROJCS[...], andCOMPD_CS[...]definitions
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.
Parsed PROJ +nadgrids metadata is applied by
transform_from_crs_strings, transform_from_crs_strings_with_selection_options,
and the Proj facade as explicit custom coordinate operations; plain
parse_crs returns only the CRS definition.
Unsupported axis-order, prime-meridian, geographic angular-unit, and vertical
transformation semantics are rejected.
EPSG-tagged WKT1 definitions with an authority-native axis permutation are
validated and canonicalized to the library’s longitude/latitude or
easting/northing coordinate order.
§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.
- to_
projjson - Serialize a CRS definition as PROJJSON.
- to_wkt
- Serialize a CRS definition as WKT1-style
GEOGCS,PROJCS, orCOMPD_CS. - to_wkt2
- Serialize a CRS definition as WKT2 (ISO 19162)
GEOGCRS,PROJCRS, orCOMPOUNDCRS. - 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.