pub struct Geom { /* private fields */ }Expand description
An owned geometry that can represent any OGC Simple Feature type.
This is the main type for working with geometries. It supports:
- All geometry types: Point,
LineString, Polygon, and Multi/Collection variants - Parsing from WKT, WKB,
GeoJSON, HEX, andGeoBinformats - Spatial predicates: intersects, contains, within, covers, touches, etc.
- Serialization to various output formats
Memory is managed by the TG library and freed when dropped.
Implementations§
Source§impl Geom
impl Geom
pub fn geom_type(&self) -> GeomType
pub fn rect(&self) -> Rect
pub fn is_empty(&self) -> bool
pub fn new_point(point: Point) -> Result<Self>
pub fn new_point_z(point: Point, z: f64) -> Result<Self>
pub fn new_point_m(point: Point, m: f64) -> Result<Self>
pub fn new_point_zm(point: Point, z: f64, m: f64) -> Result<Self>
pub fn new_point_empty() -> Result<Self>
pub fn new_linestring(line: &Line) -> Result<Self>
pub fn new_linestring_z(line: &Line, extra_coords: &[f64]) -> Result<Self>
pub fn new_linestring_m(line: &Line, extra_coords: &[f64]) -> Result<Self>
pub fn new_linestring_zm(line: &Line, extra_coords: &[f64]) -> Result<Self>
pub fn new_linestring_empty() -> Result<Self>
pub fn new_polygon(poly: &Poly) -> Result<Self>
pub fn new_polygon_z(poly: &Poly, extra_coords: &[f64]) -> Result<Self>
pub fn new_polygon_m(poly: &Poly, extra_coords: &[f64]) -> Result<Self>
pub fn new_polygon_zm(poly: &Poly, extra_coords: &[f64]) -> Result<Self>
pub fn new_polygon_empty() -> Result<Self>
pub fn new_multipoint(points: &[Point]) -> Result<Self>
pub fn new_multipoint_z(points: &[Point], extra_coords: &[f64]) -> Result<Self>
pub fn new_multipoint_m(points: &[Point], extra_coords: &[f64]) -> Result<Self>
pub fn new_multipoint_zm(points: &[Point], extra_coords: &[f64]) -> Result<Self>
pub fn new_multipoint_empty() -> Result<Self>
pub fn new_multilinestring(lines: &[&Line]) -> Result<Self>
pub fn new_multilinestring_z( lines: &[&Line], extra_coords: &[f64], ) -> Result<Self>
pub fn new_multilinestring_m( lines: &[&Line], extra_coords: &[f64], ) -> Result<Self>
pub fn new_multilinestring_zm( lines: &[&Line], extra_coords: &[f64], ) -> Result<Self>
pub fn new_multilinestring_empty() -> Result<Self>
pub fn new_multipolygon(polys: &[&Poly]) -> Result<Self>
pub fn new_multipolygon_z(polys: &[&Poly], extra_coords: &[f64]) -> Result<Self>
pub fn new_multipolygon_m(polys: &[&Poly], extra_coords: &[f64]) -> Result<Self>
pub fn new_multipolygon_zm( polys: &[&Poly], extra_coords: &[f64], ) -> Result<Self>
pub fn new_multipolygon_empty() -> Result<Self>
pub fn new_geometrycollection(geoms: &[&Geom]) -> Result<Self>
pub fn new_geometrycollection_empty() -> Result<Self>
Sourcepub unsafe fn from_raw(ptr: *mut tg_geom) -> Option<Self>
pub unsafe fn from_raw(ptr: *mut tg_geom) -> Option<Self>
§Safety
The pointer must be valid and not owned elsewhere.
pub fn as_ptr(&self) -> *const tg_geom
pub fn into_raw(self) -> *mut tg_geom
pub fn is_feature(&self) -> bool
pub fn is_featurecollection(&self) -> bool
pub fn point(&self) -> Point
pub fn line(&self) -> Option<LineRef<'_>>
pub fn poly(&self) -> Option<PolyRef<'_>>
pub fn num_points(&self) -> usize
pub fn point_at(&self, index: usize) -> Option<Point>
pub fn num_lines(&self) -> usize
pub fn line_at(&self, index: usize) -> Option<LineRef<'_>>
pub fn num_polys(&self) -> usize
pub fn poly_at(&self, index: usize) -> Option<PolyRef<'_>>
pub fn num_geometries(&self) -> usize
pub fn geometry_at(&self, index: usize) -> Option<GeomRef<'_>>
pub fn extra_json(&self) -> Option<&str>
pub fn dims(&self) -> i32
pub fn has_z(&self) -> bool
pub fn has_m(&self) -> bool
pub fn z(&self) -> f64
pub fn m(&self) -> f64
pub fn extra_coords(&self) -> &[f64]
pub fn memsize(&self) -> usize
pub fn error(&self) -> Option<&str>
pub fn equals(&self, other: &Geom) -> bool
pub fn intersects(&self, other: &Geom) -> bool
pub fn disjoint(&self, other: &Geom) -> bool
pub fn contains(&self, other: &Geom) -> bool
pub fn within(&self, other: &Geom) -> bool
pub fn covers(&self, other: &Geom) -> bool
pub fn coveredby(&self, other: &Geom) -> bool
pub fn touches(&self, other: &Geom) -> bool
pub fn intersects_rect(&self, rect: Rect) -> bool
pub fn intersects_xy(&self, x: f64, y: f64) -> bool
Source§impl Geom
impl Geom
pub fn from_geojson(geojson: &str) -> Result<Self>
pub fn from_geojson_ix(geojson: &str, ix: IndexKind) -> Result<Self>
pub fn from_wkt(wkt: &str) -> Result<Self>
pub fn from_wkt_ix(wkt: &str, ix: IndexKind) -> Result<Self>
pub fn from_wkb(wkb: &[u8]) -> Result<Self>
pub fn from_wkb_ix(wkb: &[u8], ix: IndexKind) -> Result<Self>
pub fn from_hex(hex: &str) -> Result<Self>
pub fn from_hex_ix(hex: &str, ix: IndexKind) -> Result<Self>
pub fn from_geobin(geobin: &[u8]) -> Result<Self>
pub fn from_geobin_ix(geobin: &[u8], ix: IndexKind) -> Result<Self>
pub fn parse_ix(data: &[u8], ix: IndexKind) -> Result<Self>
pub fn to_geojson(&self) -> String
pub fn to_wkt(&self) -> String
pub fn to_wkb(&self) -> Vec<u8> ⓘ
pub fn to_hex(&self) -> String
pub fn to_geobin(&self) -> Vec<u8> ⓘ
Trait Implementations§
impl Send for Geom
impl Sync for Geom
Auto Trait Implementations§
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more