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
//! `PostGIS` Extended Well-Known Text (EWKT) reader and writer.
//!
//! Not part of Boost.Geometry; follows the `PostGIS` manual, sections
//! "4.1.3. WKT and WKB" and "4.2.1. `PostGIS` EWKB and EWKT", and the
//! `PostGIS` reader in `liblwgeom/lwin_wkt_lex.l`. EWKT is the dialect
//! `ST_AsEWKT` emits and `ST_GeomFromEWKT` accepts: OGC WKT plus an
//! optional `SRID=<digits>;` prefix and the glued dimension-suffix
//! spellings. `ST_AsEWKT` glues only `M` (`POINTM(1 2 3)`); `PostGIS`
//! reads the glued `Z`, `M`, and `ZM` forms and the OGC-spaced
//! `POINT Z` / `POINT M` / `POINT ZM` forms alike, and this crate reads
//! all of them.
//!
//! The geometry body is delegated to [`geometry_io_wkt`]. This crate
//! scans the prefix, overwrites a glued suffix with spaces in place — a
//! same-length rewrite, so every byte offset it reports indexes the
//! string the caller passed — and hands the body over. [`from_ewkt`]
//! therefore emits a [`geometry_model::DynGeometry`], and the six
//! `parse_*` conveniences return concrete model types; each is paired
//! with the spatial-reference id in an [`Ewkt`].
//!
//! `PostGIS` treats SRID 0 as unknown ([`Srid::UNKNOWN`]) and omits the
//! prefix for it. This crate reads `SRID=0;` as `Some(Srid::UNKNOWN)`
//! and writes it back as `SRID=0;`; callers pass `None` to omit the
//! prefix.
//!
//! Every ordinate past the second is discarded, as in
//! [`geometry_io_wkt`], and nothing above 2D is ever written — so a
//! dimension suffix carries no information this model can hold.
//!
//! ## Read and write a prefixed geometry
//!
//! ```
//! use geometry_io_ewkt::{Srid, from_ewkt, to_ewkt};
//!
//! let e = from_ewkt("SRID=4326;POINTM(1 2 3)").unwrap();
//! assert_eq!(e.srid, Some(Srid::new(4326)));
//! assert_eq!(to_ewkt(&e.geometry, e.srid), "SRID=4326;POINT(1 2)");
//! ```
extern crate alloc;
pub use EwktError;
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 ;