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
//! Checked XY Extended Well-Known Text (EWKT) reader and writer.
//!
//! The geometry body uses [`geometry_io_wkt`]'s `PostGIS` 3.4.3-compatible
//! XY profile. Z, M, ZM, and extra ordinates are rejected, including on
//! empty geometries. No coordinate is silently discarded.
//!
//! [`from_ewkt_2d`] retains empty points and empty multipoint members using
//! [`geometry_model::GeometryValue`]. [`from_ewkt`] returns the legacy
//! [`geometry_model::DynGeometry`] and rejects unrepresentable empty points.
//!
//! The optional `SRID=` prefix accepts checked signed 32-bit integers.
//! Nonpositive values normalize to zero; values above 999999 normalize to
//! `999000 + (value % 999)`, matching the pinned `PostGIS` parser. Only space,
//! tab, CR and LF are accepted as whitespace. Whitespace is allowed before
//! the prefix and before its semicolon, but not inside `SRID=` or before digits.
//! Output SRIDs must be at most 999999; writers return an error otherwise.
//! `None` omits the prefix, while `Some(Srid::UNKNOWN)` writes `SRID=0;`.
//!
//! # Migration
//!
//! Owned and streaming writers return typed errors. Use [`to_ewkt`] instead
//! of formatting [`Ewkt`] with `Display`; formatting cannot convey geometry
//! validation errors. Negative input SRIDs now normalize to unknown, and
//! positive input SRIDs outside the `PostGIS` range normalize as described above.
//! The binary codecs and [`Srid`] itself retain their existing behavior.
//!
//! ```
//! use geometry_io_ewkt::{Srid, from_ewkt_2d, to_ewkt};
//!
//! let e = from_ewkt_2d("SRID=4326;POINT EMPTY").unwrap();
//! assert_eq!(e.srid, Some(Srid::new(4326)));
//! assert_eq!(to_ewkt(&e.geometry, e.srid).unwrap(), "SRID=4326;POINT EMPTY");
//! ```
extern crate alloc;
pub use EwktError;
pub use EwktWriteError;
pub use WktError;
pub use WriteWkt;
pub use Srid;
// feature-group: I/O — Extended Well-Known Text
// feature-desc: Parse and write PostGIS EWKT (WKT with an SRID prefix)
pub use ;
// feature-group: I/O — Extended Well-Known Text
pub use ;