#[non_exhaustive]pub enum Crs {
Unknown,
Epsg(u32),
Wkt(String),
Projjson(String),
}Expand description
Coordinate reference system. Marked #[non_exhaustive] because future
versions may add Wkt2(String), a structured Authority { name, code },
or pre-parsed PROJJSON without that counting as a SemVer-breaking change.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Unknown
CRS unknown or unspecified.
Epsg(u32)
An EPSG authority code (e.g. 4326, 7844).
Wkt(String)
Well-Known Text (ESRI-WKT or OGC-WKT). Stored verbatim.
Projjson(String)
PROJJSON. Stored verbatim (GeoParquet’s preferred form).
Implementations§
Source§impl Crs
impl Crs
pub fn is_unknown(&self) -> bool
Sourcepub fn epsg_code(&self) -> Option<u32>
pub fn epsg_code(&self) -> Option<u32>
Return the CRS as an EPSG authority code, if it can be cheaply determined. Resolution order:
Crs::Epsgreturns directly.Crs::Wktlooks forAUTHORITY["EPSG","NNNN"](WKT1) orID["EPSG",NNNN](WKT2) on the outermost CRS node.- If no authority is present, fall back to a small inline lookup of common datum/CRS names (“GDA2020”, “WGS 84”, “NAD83”, “Web Mercator”, etc.) — handles the ESRI File-Geodatabase case where the WKT has just a name and a datum, no AUTHORITY.
Returns None for Crs::Unknown, Crs::Projjson, or WKT we
can’t resolve. Full WKT → EPSG resolution (every CRS) requires PROJ
and is the job of the future geonative-proj crate.
Sourcepub fn to_projjson(&self) -> Option<String>
pub fn to_projjson(&self) -> Option<String>
Render the CRS as PROJJSON — the form GeoParquet stores in its geo
metadata. v0.1 produces a minimal PROJJSON that just references an
EPSG code when one is detectable:
{ "$schema": "...", "type": "GeographicCRS", "id": { "authority": "EPSG", "code": 4326 } }Returns None if no EPSG code is detectable. Full WKT → PROJJSON
conversion (preserving every parameter) requires PROJ and is deferred
to the optional geonative-proj crate; until then, the GeoParquet
spec also accepts WKT in the crs field as a string fallback.