epsg-utils
This crate provides three main capabilities:
- EPSG lookup -- look up the WKT2 or PROJJSON representation of a CRS by its EPSG code.
- Parsing -- parse OGC WKT2 strings or PROJJSON strings into structured Rust types.
- Conversion -- convert between WKT2 and PROJJSON.
Examples
Look up EPSG code
// Get WKT2 representation (requires "wkt2-definitions" feature, enabled by default)
let wkt = epsg_to_wkt2.unwrap;
// Get PROJJSON representation (requires "projjson-definitions" feature, enabled by default)
let projjson = epsg_to_projjson.unwrap;
Parse WKT2
let crs = parse_wkt2.unwrap;
assert_eq!;
Parse PROJJSON
let crs = parse_projjson.unwrap;
assert_eq!;
Convert between WKT2 and PROJJSON
let crs = parse_wkt2.unwrap;
// To PROJJSON (serde_json::Value)
let projjson_value = crs.to_projjson;
// Back to WKT2
let wkt2 = crs.to_wkt2;
EPSG Dataset
The definitions in this crate is based on the EPSG Dataset v12.054, and covers 99.5% (7365/7396) of the EPSG codes (engineering CRS and derived projected CRS are not supported).
The EPSG Dataset is owned by the International Association of Oil & Gas Producers (IOGP). The source definitions included in this crate were downloaded from https://epsg.org/download-dataset.html.
References
- OGC WKT2: https://www.ogc.org/standards/wkt-crs/
- PROJJSON: https://proj.org/en/stable/specifications/projjson.html