Function geodesy::parse_proj

source ·
pub fn parse_proj(definition: &str) -> Result<String, Error>
Expand description

Translate a PROJ string into Rust Geodesy format. Since PROJ is syntactically unrestrictive, we do not try to detect any syntax errors: If the input is so cursed as to be intranslatable, this will become clear when trying to instantiate the result as a Geodesy operator. We do, however, check for and report on two semantically refusable cases: First, that PROJ does not support nested pipelines (the nesting must be done indirectly through an init-file), second that Rust Geodesy does not support init-files. Hence no support for any kind of nesting here.

§Known differences between PROJ and Rust Geodesy definitions:

§Ellipsoid definitions

  • Geodesy only supports a limited set of builtin ellipsoids OR or definition via semi-major and reverse-flattening parameters ellps=a,rf.
  • PROJ has richer ellipsoid support which parse_proj provides partial support for.
  • Specifically if an ellipsoid is defined via a and rf parameters, parse_proj will redefine them as ellps=a,rf and remove the a and rf parameters.
  • All other cases supported by PROJ are NOT handled by parse_proj and will fail when instantiating the operator.

§Scaling via k parameter

  • PROJ still supports the deprecated k parameter. Most output from projinfo will have the scaling defined as k instead of k_0.
  • parse_proj will replace k with k_0 whenever it is encountered.