1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
//!
//! # 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",
//! )
//! );
//! ```
//!
pub use Builder;
pub use Formatter;
use Result;
/// Convert a wkt string to a projstring
// log for logging (optional).
use log;
// Include wasm entry point for wasm32-unknown-unknown