epsg-utils 0.0.1

Parse/convert EPSG code, WKT2, and PROJJSON
Documentation
  • Coverage
  • 91.7%
    221 out of 241 items documented1 out of 50 items with examples
  • Size
  • Source code size: 1.27 MB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 16.48 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 1m 7s Average build duration of successful builds.
  • all releases: 1m 7s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • yutannihilation/epsg-utils-rs
    1 0 3
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • yutannihilation

epsg-utils

This crate provides three main capabilities:

  1. EPSG lookup -- look up the WKT2 or PROJJSON representation of a CRS by its EPSG code.
  2. Parsing -- parse OGC WKT2 strings or PROJJSON strings into structured Rust types.
  3. Conversion -- convert between WKT2 and PROJJSON.

Examples

Look up EPSG code

// Get WKT2 representation (requires "wkt2-definitions" feature, enabled by default)
let wkt = epsg_utils::epsg_to_wkt2(6678).unwrap();

// Get PROJJSON representation (requires "projjson-definitions" feature, enabled by default)
let projjson = epsg_utils::epsg_to_projjson(6678).unwrap();

Parse WKT2

let crs = epsg_utils::parse_wkt2(r#"PROJCRS["WGS 84 / UTM zone 31N",
    BASEGEOGCRS["WGS 84", DATUM["World Geodetic System 1984",
        ELLIPSOID["WGS 84", 6378137, 298.257223563]]],
    CONVERSION["UTM zone 31N", METHOD["Transverse Mercator"]],
    CS[Cartesian, 2],
    ID["EPSG", 32631]]"#).unwrap();

assert_eq!(crs.to_epsg(), Some(32631));

Parse PROJJSON

let crs = epsg_utils::parse_projjson(projjson).unwrap();
assert_eq!(crs.name, "JGD2011 / Japan Plane Rectangular CS X");

Convert between WKT2 and PROJJSON

let crs = epsg_utils::parse_wkt2(wkt).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

Prior work