pub enum Geometry {
Point(Coord),
LineString(Vec<Coord>),
Polygon {
exterior: Ring,
interiors: Vec<Ring>,
},
MultiPoint(Vec<Coord>),
MultiLineString(Vec<Vec<Coord>>),
MultiPolygon(Vec<(Ring, Vec<Ring>)>),
GeometryCollection(Vec<Geometry>),
}Expand description
The canonical geometry type covering all OGC Simple Features.
Variants§
Point(Coord)
Single point geometry.
LineString(Vec<Coord>)
Connected path of vertices.
Polygon
Polygon with one exterior ring and zero or more interior rings.
MultiPoint(Vec<Coord>)
Set of points.
MultiLineString(Vec<Vec<Coord>>)
Set of line strings.
MultiPolygon(Vec<(Ring, Vec<Ring>)>)
Set of polygons.
GeometryCollection(Vec<Geometry>)
Heterogeneous set of geometries.
Implementations§
Source§impl Geometry
impl Geometry
Sourcepub fn line_string(coords: Vec<Coord>) -> Self
pub fn line_string(coords: Vec<Coord>) -> Self
Constructs a line string geometry.
Sourcepub fn polygon(exterior: Vec<Coord>, interiors: Vec<Vec<Coord>>) -> Self
pub fn polygon(exterior: Vec<Coord>, interiors: Vec<Vec<Coord>>) -> Self
Constructs a polygon geometry from exterior and interior coordinate rings.
Sourcepub fn multi_point(pts: Vec<Coord>) -> Self
pub fn multi_point(pts: Vec<Coord>) -> Self
Constructs a multipoint geometry.
Sourcepub fn multi_line_string(lines: Vec<Vec<Coord>>) -> Self
pub fn multi_line_string(lines: Vec<Vec<Coord>>) -> Self
Constructs a multilinestring geometry.
Sourcepub fn multi_polygon(polys: Vec<(Vec<Coord>, Vec<Vec<Coord>>)>) -> Self
pub fn multi_polygon(polys: Vec<(Vec<Coord>, Vec<Vec<Coord>>)>) -> Self
Constructs a multipolygon geometry.
Sourcepub fn geom_type(&self) -> GeometryType
pub fn geom_type(&self) -> GeometryType
Returns the geometry type discriminator.
Sourcepub fn all_coords(&self) -> Vec<&Coord>
pub fn all_coords(&self) -> Vec<&Coord>
Returns flattened coordinate references across all nested components.
Sourcepub fn to_gpkg_wkb(&self, srs_id: i32) -> Vec<u8> ⓘ
pub fn to_gpkg_wkb(&self, srs_id: i32) -> Vec<u8> ⓘ
Encode to GeoPackage WKB (GP header + ISO WKB + optional XY envelope).
Sourcepub fn from_gpkg_wkb(data: &[u8]) -> Result<(Self, i32)>
pub fn from_gpkg_wkb(data: &[u8]) -> Result<(Self, i32)>
Decode from GeoPackage WKB. Returns (geometry, srs_id).
Trait Implementations§
impl StructuralPartialEq for Geometry
Auto Trait Implementations§
impl Freeze for Geometry
impl RefUnwindSafe for Geometry
impl Send for Geometry
impl Sync for Geometry
impl Unpin for Geometry
impl UnsafeUnpin for Geometry
impl UnwindSafe for Geometry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more