Expand description
§WKT CRS parser
Convert WKT CRS to proj string
Support both WKT1 and WKT2 formats.
This is a companion crate for proj4rs
because of this conversions are limited
to projection supported by proj4rs
. As more projection will be supported
in proj4rs
, more conversions will be supported in proj4wt
.
This crate may be built as WASM package
Example:
use proj4wkt::wkt_to_projstring;
const nad83: &str = concat!(
r#"PROJCS["NAD83 / Massachusetts Mainland",GEOGCS["NAD83","#,
r#"DATUM["North_American_Datum_1983",SPHEROID["GRS 1980",6378137,298.257222101,"#,
r#"AUTHORITY["EPSG","7019"]],AUTHORITY["EPSG","6269"]],PRIMEM["Greenwich",0,"#,
r#"AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994328,"#,
r#"AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4269"]],UNIT["metre",1,"#,
r#"AUTHORITY["EPSG","9001"]],PROJECTION["Lambert_Conformal_Conic_2SP"],"#,
r#"PARAMETER["standard_parallel_1",42.68333333333333],"#,
r#"PARAMETER["standard_parallel_2",41.71666666666667],"#,
r#"PARAMETER["latitude_of_origin", -41],PARAMETER["central_meridian",-71.5],"#,
r#"PARAMETER["false_easting",200000],PARAMETER["false_northing",750000],"#,
r#"AUTHORITY["EPSG","26986"],AXIS["X",EAST],AXIS["Y",NORTH]]"#,
);
let projstr = wkt_to_projstring(nad83).unwrap();
assert_eq!(
projstr,
concat!(
"+proj=lcc +lat_1=42.68333333333333 +lat_2=41.71666666666667",
" +lat_0=-41 +lon_0=-71.5 +x_0=200000 +y_0=750000 +units=m +a=6378137",
" +rf=298.257222101 +towgs84=0,0,0,0,0,0,0",
)
);
Modules§
- parser
- Generic, grammar free WKT parser implementation
Structs§
Functions§
- wkt_
to_ projstring - Convert a wkt string to a projstring