#[non_exhaustive]pub enum Geometry {
Point(Coord),
LineString(LineString),
Polygon(Polygon),
MultiPoint(Vec<Coord>),
MultiLineString(Vec<LineString>),
MultiPolygon(Vec<Polygon>),
GeometryCollection(Vec<Geometry>),
Empty(GeometryType),
}Expand description
The geometry tree. Marked #[non_exhaustive] so future SemVer-minor
releases can add variants (curves, surfaces, Z/M-bearing variants once
the IR grows past 2D).
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Point(Coord)
LineString(LineString)
Polygon(Polygon)
MultiPoint(Vec<Coord>)
MultiLineString(Vec<LineString>)
MultiPolygon(Vec<Polygon>)
GeometryCollection(Vec<Geometry>)
Empty(GeometryType)
A typed-empty geometry (e.g. POINT EMPTY, POLYGON EMPTY). The tag
is preserved so WKB serialization round-trips correctly.
Implementations§
Source§impl Geometry
impl Geometry
pub fn type_of(&self) -> GeometryType
pub fn is_empty(&self) -> bool
Sourcepub fn coord_count(&self) -> usize
pub fn coord_count(&self) -> usize
Total coordinate count across the geometry tree. O(N) walk.
This is the right number to use when budgeting memory for an
operation that scales with vertex density (Hilbert sort, geometry
simplification, WKB encode). A single polygon with 100 000
vertices charges 100 000; a MultiPolygon of 50 such parts
charges 5 000 000 — feature count alone hides this asymmetry.
Source§impl Geometry
impl Geometry
Sourcepub fn from_wkb(bytes: &[u8]) -> Result<Self>
pub fn from_wkb(bytes: &[u8]) -> Result<Self>
Decode OGC Simple Features WKB bytes into a Geometry.
Accepts both little-endian and big-endian, and respects per-nested byte-order bytes inside collections (the ISO WKB rule).
v0.1 returns Error::Unsupported for Z/M variants — the type code
is recognized but ordinates beyond X/Y are not decoded.