Struct geos::Geometry[][src]

pub struct Geometry<'a> { /* fields omitted */ }
Expand description

Representation of a GEOS geometry.

Example

use geos::{Geom, Geometry};

let point_geom = Geometry::new_from_wkt("POINT (2.5 3.5)")
                          .expect("Invalid geometry");
assert_eq!(point_geom.get_x(), Ok(2.5));
assert_eq!(point_geom.get_y(), Ok(3.5));

Implementations

impl<'a> Geometry<'a>[src]

pub fn new_from_wkt(wkt: &str) -> GResult<Geometry<'a>>[src]

Creates a Geometry from the WKT format.

Example

use geos::Geometry;

let point_geom = Geometry::new_from_wkt("POINT (2.5 2.5)").expect("Invalid geometry");

pub fn new_from_hex(hex: &[u8]) -> GResult<Geometry<'a>>[src]

Create a new Geometry from the HEX format.

Example

use geos::{Geom, Geometry};

let point_geom = Geometry::new_from_wkt("POINT (2.5 2.5)").expect("Invalid geometry");
let hex_buf = point_geom.to_hex().expect("conversion to HEX failed");

// The interesting part is here:
let new_geom = Geometry::new_from_hex(hex_buf.as_ref())
                     .expect("conversion from HEX failed");
assert_eq!(point_geom.equals(&new_geom), Ok(true));

pub fn new_from_wkb(wkb: &[u8]) -> GResult<Geometry<'a>>[src]

Create a new Geometry from the WKB format.

Example

use geos::{Geom, Geometry};

let point_geom = Geometry::new_from_wkt("POINT (2.5 2.5)").expect("Invalid geometry");
let wkb_buf = point_geom.to_wkb().expect("conversion to WKB failed");

// The interesting part is here:
let new_geom = Geometry::new_from_wkb(wkb_buf.as_ref())
                     .expect("conversion from WKB failed");
assert_eq!(point_geom.equals(&new_geom), Ok(true));

pub fn build_area(&self) -> GResult<Geometry<'a>>[src]

Creates an areal geometry formed by the constituent linework of given geometry.

You can find new illustrations on postgis documentation.

Available using the v3_8_0 feature.

Example

use geos::{Geom, Geometry};

let geom = Geometry::new_from_wkt("POINT(100 90)").expect("Invalid geometry");
let small_geom = geom.buffer(25., 8).expect("buffer failed");
let big_geom = geom.buffer(50., 8).expect("buffer failed");

let union_geom = small_geom.union(&big_geom).expect("union failed");
let build_area_geom = union_geom.build_area().expect("build_area failed");

// Looks like a donut.
assert_eq!(union_geom.to_wkt_precision(1).unwrap(),
           "POLYGON ((150.0 90.0, 149.0 80.2, 146.2 70.9, 141.6 62.2, 135.4 54.6, \
                      127.8 48.4, 119.1 43.8, 109.8 41.0, 100.0 40.0, 90.2 41.0, \
                      80.9 43.8, 72.2 48.4, 64.6 54.6, 58.4 62.2, 53.8 70.9, 51.0 80.2, \
                      50.0 90.0, 51.0 99.8, 53.8 109.1, 58.4 117.8, 64.6 125.4, \
                      72.2 131.6, 80.9 136.2, 90.2 139.0, 100.0 140.0, 109.8 139.0, \
                      119.1 136.2, 127.8 131.6, 135.4 125.4, 141.6 117.8, 146.2 109.1, \
                      149.0 99.8, 150.0 90.0))");

pub fn polygonize<T: Borrow<Geometry<'a>>>(
    geometries: &[T]
) -> GResult<Geometry<'a>>
[src]

Description from postgis:

Creates a GeometryCollection containing possible polygons formed from the constituent linework of a set of geometries.

Example:

use geos::{Geom, Geometry};

let geom1 = Geometry::new_from_wkt("POLYGON((-71.040878 42.285678,\
                                             -71.040943 42.2856,\
                                             -71.04096 42.285752,\
                                             -71.040878 42.285678))")
                     .expect("Failed to create geometry");
let geom2 = Geometry::new_from_wkt("POLYGON((-71.17166 42.353675,\
                                             -71.172026 42.354044,\
                                             -71.17239 42.354358,\
                                             -71.171794 42.354971,\
                                             -71.170511 42.354855,\
                                             -71.17112 42.354238,\
                                             -71.17166 42.353675))")
                     .expect("Failed to create geometry");

let polygonized = Geometry::polygonize(&[geom1, geom2]).expect("polygonize failed");
assert_eq!(polygonized.to_wkt().unwrap(),
           "GEOMETRYCOLLECTION (POLYGON ((-71.0408780000000064 42.2856779999999972, \
                                          -71.0409429999999986 42.2856000000000023, \
                                          -71.0409599999999983 42.2857520000000022, \
                                          -71.0408780000000064 42.2856779999999972)), \
                                POLYGON ((-71.1716600000000028 42.3536750000000026, \
                                          -71.1720260000000025 42.3540440000000018, \
                                          -71.1723899999999929 42.3543579999999977, \
                                          -71.1717940000000056 42.3549709999999990, \
                                          -71.1705110000000047 42.3548550000000006, \
                                          -71.1711200000000019 42.3542380000000023, \
                                          -71.1716600000000028 42.3536750000000026)))");

pub fn polygonizer_get_cut_edges<T: Borrow<Geometry<'a>>>(
    &self,
    geometries: &[T]
) -> GResult<Geometry<'a>>
[src]

pub fn line_merge(&self) -> GResult<Geometry<'a>>[src]

Merges Multi Line String geometry into a (set of) Line String.

Warning

If you use this function on something else than a Multi Line String or a Line String, it’ll return an empty Geometry collection.

Example

use geos::{Geom, Geometry};

let lines = Geometry::new_from_wkt("MULTILINESTRING((-29 -27,-30 -29.7,-36 -31,-45 -33),\
                                                 (-45 -33,-46 -32))")
                     .expect("Invalid geometry");
let lines_merged = lines.line_merge().expect("line merge failed");
assert_eq!(
    lines_merged.to_wkt_precision(1).unwrap(),
    "LINESTRING (-29.0 -27.0, -30.0 -29.7, -36.0 -31.0, -45.0 -33.0, -46.0 -32.0)",
);

pub fn reverse(&self) -> GResult<Geometry<'a>>[src]

Reverses the order of the vertexes.

Available using the v3_7_0 feature.

Example

use geos::{Geom, Geometry};

let line = Geometry::new_from_wkt("LINESTRING(1 10,1 2)")
                    .expect("invalid geometry");
let reversed_line = line.reverse().expect("reverse failed");

assert_eq!(
    reversed_line.to_wkt_precision(1).unwrap(),
    "LINESTRING (1.0 2.0, 1.0 10.0)",
);

pub fn simplify(&self, tolerance: f64) -> GResult<Geometry<'a>>[src]

Returns a simplified version of the given geometry.

pub fn topology_preserve_simplify(
    &self,
    tolerance: f64
) -> GResult<Geometry<'a>>
[src]

Returns a simplified version of the given geometry. It will avoid creating invalid derived geometries.

pub fn set_srid(&mut self, srid: usize)[src]

Set SRID of self.

Example

use geos::{Geom, Geometry};

let mut point_geom = Geometry::new_from_wkt("POINT (2.5 2.5 4.0)")
                              .expect("Invalid geometry");
point_geom.set_srid(4326);
assert_eq!(point_geom.get_srid(), Ok(4326));

pub fn normalize(&mut self) -> GResult<()>[src]

Normalizes self in its normalized/canonical form. May reorder vertices in polygon rings, rings in a polygon, elements in a multi-geometry complex.

Example

use geos::{Geom, Geometry};

let mut geom = Geometry::new_from_wkt(
    "GEOMETRYCOLLECTION(POINT(2 3), MULTILINESTRING((0 0, 1 1),(2 2, 3 3)))",
).expect("Invalid geometry");

geom.normalize().expect("normalize failed");

assert_eq!(geom.to_wkt_precision(1).unwrap(),
           "GEOMETRYCOLLECTION (MULTILINESTRING ((2.0 2.0, 3.0 3.0), (0.0 0.0, 1.0 1.0)), \
                                POINT (2.0 3.0))");

pub fn create_empty_polygon() -> GResult<Geometry<'a>>[src]

Creates an empty polygon geometry.

Example

use geos::{Geom, Geometry};

let geom = Geometry::create_empty_polygon().expect("Failed to build empty polygon");

assert_eq!(geom.to_wkt().unwrap(), "POLYGON EMPTY");

pub fn create_empty_point() -> GResult<Geometry<'a>>[src]

Creates an empty point geometry.

Example

use geos::{Geom, Geometry};

let geom = Geometry::create_empty_point().expect("Failed to build empty point");

assert_eq!(geom.to_wkt().unwrap(), "POINT EMPTY");

pub fn create_empty_line_string() -> GResult<Geometry<'a>>[src]

Creates an empty line string geometry.

Example

use geos::{Geom, Geometry};

let geom = Geometry::create_empty_line_string().expect("Failed to build empty line string");

assert_eq!(geom.to_wkt().unwrap(), "LINESTRING EMPTY");

pub fn create_empty_collection(type_: GeometryTypes) -> GResult<Geometry<'a>>[src]

Creates an empty collection.

The type_ must be one of:

Example

use geos::{Geom, Geometry, GeometryTypes};

let geom = Geometry::create_empty_collection(GeometryTypes::MultiPolygon)
                    .expect("Failed to build empty collection");

assert_eq!(geom.to_wkt().unwrap(), "MULTIPOLYGON EMPTY");

pub fn create_polygon<'b>(
    exterior: Geometry<'a>,
    interiors: Vec<Geometry<'b>>
) -> GResult<Geometry<'a>>
[src]

Creates a polygon formed by the given shell and array of holes.

Note

exterior must be a LinearRing.

Example

use geos::{Geom, Geometry};

let geom = Geometry::new_from_wkt("LINEARRING(75.15 29.53,77 29,77.6 29.5, 75.15 29.53)")
                    .expect("Invalid geometry");
let polygon_geom = Geometry::create_polygon(geom, vec![])
                            .expect("create_polygon failed");

assert_eq!(
    polygon_geom.to_wkt_precision(1).unwrap(),
    "POLYGON ((75.2 29.5, 77.0 29.0, 77.6 29.5, 75.2 29.5))",
);

pub fn create_geometry_collection(
    geoms: Vec<Geometry<'a>>
) -> GResult<Geometry<'a>>
[src]

Create a geometry collection.

Example

use geos::{Geom, Geometry};

let geom1 = Geometry::new_from_wkt("POLYGON((0 0, 10 0, 10 6, 0 6, 0 0))")
                     .expect("Invalid geometry");
let geom2 = Geometry::new_from_wkt("POINT (3.0 4.0)").expect("Invalid geometry");

let geom = Geometry::create_geometry_collection(vec![geom1, geom2])
                    .expect("Failed to build multipolygon");

assert_eq!(geom.to_wkt_precision(1).unwrap(),
           "GEOMETRYCOLLECTION (POLYGON ((0.0 0.0, 10.0 0.0, 10.0 6.0, 0.0 6.0, 0.0 0.0)), \
                                POINT (3.0 4.0))");

pub fn create_multipolygon(polygons: Vec<Geometry<'a>>) -> GResult<Geometry<'a>>[src]

Create a multi polygon geometry.

Example

use geos::{Geom, Geometry};

let geom1 = Geometry::new_from_wkt("POLYGON((0 0, 10 0, 10 6, 0 6, 0 0))")
                     .expect("Invalid geometry");
let geom2 = Geometry::new_from_wkt("POLYGON((3 3, 10 3, 10 6, 3 6, 3 3))")
                     .expect("Invalid geometry");

let geom = Geometry::create_multipolygon(vec![geom1, geom2])
                    .expect("Failed to build multipolygon");

assert_eq!(geom.to_wkt_precision(1).unwrap(),
           "MULTIPOLYGON (((0.0 0.0, 10.0 0.0, 10.0 6.0, 0.0 6.0, 0.0 0.0)), \
                          ((3.0 3.0, 10.0 3.0, 10.0 6.0, 3.0 6.0, 3.0 3.0)))");

pub fn create_multiline_string(
    linestrings: Vec<Geometry<'a>>
) -> GResult<Geometry<'a>>
[src]

Create a multiline string geometry.

Example

use geos::{Geom, Geometry};

let geom1 = Geometry::new_from_wkt("LINESTRING (1.0 2.0, 3.0 4.0)").expect("invalid geometry");
let geom2 = Geometry::new_from_wkt("LINESTRING (5.0 6.0, 7.0 8.0)").expect("invalid geometry");

let geom = Geometry::create_multiline_string(vec![geom1, geom2])
                    .expect("Failed to build multiline string");

assert_eq!(geom.to_wkt_precision(1).unwrap(),
           "MULTILINESTRING ((1.0 2.0, 3.0 4.0), (5.0 6.0, 7.0 8.0))");

pub fn create_multipoint(points: Vec<Geometry<'a>>) -> GResult<Geometry<'a>>[src]

Creates a multi point geometry.

Example

use geos::{Geom, Geometry};

let geom1 = Geometry::new_from_wkt("POINT (1.0 2.0)").expect("Invalid geometry");
let geom2 = Geometry::new_from_wkt("POINT (3.0 4.0)").expect("Invalid geometry");

let geom = Geometry::create_multipoint(vec![geom1, geom2])
                    .expect("Failed to build multipoint");

assert_eq!(geom.to_wkt_precision(1).unwrap(), "MULTIPOINT (1.0 2.0, 3.0 4.0)");

pub fn create_point(s: CoordSeq<'a>) -> GResult<Geometry<'a>>[src]

Creates a point geometry.

Example

use geos::{CoordDimensions, CoordSeq, Geom, Geometry};

let coords = CoordSeq::new_from_vec(&[&[1., 2.]])
                      .expect("failed to create CoordSeq");

let geom = Geometry::create_point(coords).expect("Failed to create a point");

assert_eq!(geom.to_wkt_precision(1).unwrap(), "POINT (1.0 2.0)");

pub fn create_line_string(s: CoordSeq<'a>) -> GResult<Geometry<'a>>[src]

Creates a line string geometry.

Example

use geos::{CoordDimensions, CoordSeq, Geom, Geometry};

let coords = CoordSeq::new_from_vec(&[&[1., 2.], &[3., 4.]])
                      .expect("failed to create CoordSeq");

let geom = Geometry::create_line_string(coords).expect("Failed to create a line string");

assert_eq!(geom.to_wkt_precision(1).unwrap(), "LINESTRING (1.0 2.0, 3.0 4.0)");

pub fn create_linear_ring(s: CoordSeq<'a>) -> GResult<Geometry<'a>>[src]

Creates a linear ring geometry.

Example

use geos::{CoordDimensions, CoordSeq, Geom, Geometry};

let coords = CoordSeq::new_from_vec(&[&[75.15, 29.53],
                                      &[77., 29.],
                                      &[77.6, 29.5],
                                      &[75.15, 29.53]])
                      .expect("failed to create CoordSeq");

let geom = Geometry::create_linear_ring(coords)
                    .expect("Failed to create a linea ring");

assert_eq!(geom.to_wkt_precision(1).unwrap(),
           "LINEARRING (75.2 29.5, 77.0 29.0, 77.6 29.5, 75.2 29.5)");

Trait Implementations

impl<'a> Clone for Geometry<'a>[src]

fn clone(&self) -> Geometry<'a>[src]

Also passes the context to the newly created Geometry.

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<'a> ContextHandling for Geometry<'a>[src]

impl<'a> ContextInteractions<'a> for Geometry<'a>[src]

fn set_context_handle(&mut self, context: ContextHandle<'a>)[src]

Set the context handle to the geometry.

use geos::{ContextInteractions, ContextHandle, Geometry};

let context_handle = ContextHandle::init().expect("invalid init");
context_handle.set_notice_message_handler(Some(Box::new(|s| println!("new message: {}", s))));
let mut point_geom = Geometry::new_from_wkt("POINT (2.5 2.5)").expect("Invalid geometry");
point_geom.set_context_handle(context_handle);

fn get_context_handle(&self) -> &ContextHandle<'a>[src]

Get the context handle of the geometry.

use geos::{ContextInteractions, Geometry};

let point_geom = Geometry::new_from_wkt("POINT (2.5 2.5)").expect("Invalid geometry");
let context = point_geom.get_context_handle();
context.set_notice_message_handler(Some(Box::new(|s| println!("new message: {}", s))));

fn get_last_error(&self) -> Option<String>[src]

Gets the last error (if any) from the ContextHandle held by this object. Read more

fn get_last_notification(&self) -> Option<String>[src]

Gets the last notification (if any) from the ContextHandle held by this object. Read more

impl<'a> Drop for Geometry<'a>[src]

fn drop(&mut self)[src]

Executes the destructor for this type. Read more

impl<'a> Geom<'a> for Geometry<'a>[src]

fn get_type(&self) -> GResult<String>[src]

Returns the type of the geometry. Read more

fn geometry_type(&self) -> GeometryTypes[src]

fn is_valid(&self) -> bool[src]

Checks if the geometry is valid. Read more

fn is_valid_reason(&self) -> GResult<String>[src]

Returns an explanation on why the geometry is invalid. Read more

fn get_coord_seq(&self) -> GResult<CoordSeq<'a>>[src]

Get the underlying geos CoordSeq object from the geometry Read more

fn area(&self) -> GResult<f64>[src]

Returns the area of the geometry. Units are specified by the SRID of the given geometry. Read more

fn to_wkt(&self) -> GResult<String>[src]

Returns a WKT representation of the geometry. It defaults to 2 dimensions output. Use WKTWriter type directly if you want more control. Read more

fn to_wkt_precision(&self, precision: u32) -> GResult<String>[src]

Returns a WKT representation of the geometry with the given precision. It is a wrapper around WKTWriter::set_rounding_precision. Read more

fn is_ring(&self) -> GResult<bool>[src]

Returns true if the geometry is a ring. Read more

fn intersects<'b, G: Geom<'b>>(&self, other: &G) -> GResult<bool>[src]

Returns true if self shares any portion of space with other. So if any of this is true: Read more

fn crosses<'b, G: Geom<'b>>(&self, other: &G) -> GResult<bool>[src]

Returns true if self and other have at least one interior into each other. Read more

fn disjoint<'b, G: Geom<'b>>(&self, other: &G) -> GResult<bool>[src]

Returns true if self doesn’t: Read more

fn touches<'b, G: Geom<'b>>(&self, other: &G) -> GResult<bool>[src]

Returns true if the only points in common between self and other lie in the union of the boundaries of self and other. Read more

fn overlaps<'b, G: Geom<'b>>(&self, other: &G) -> GResult<bool>[src]

Returns true if self spatially overlaps other. Read more

fn within<'b, G: Geom<'b>>(&self, other: &G) -> GResult<bool>[src]

Returns true if self is completely inside other. Read more

fn equals<'b, G: Geom<'b>>(&self, other: &G) -> GResult<bool>[src]

Checks if the two Geometry objects are equal. Read more

fn equals_exact<'b, G: Geom<'b>>(
    &self,
    other: &G,
    precision: f64
) -> GResult<bool>
[src]

Checks if the two Geometry objects are exactly equal. Read more

fn covers<'b, G: Geom<'b>>(&self, other: &G) -> GResult<bool>[src]

Returns true if no point of other is outside of self. Read more

fn covered_by<'b, G: Geom<'b>>(&self, other: &G) -> GResult<bool>[src]

Returns true if no point of self is outside of other. Read more

fn contains<'b, G: Geom<'b>>(&self, other: &G) -> GResult<bool>[src]

Returns true if no points of the other geometry is outside the exterior of self. Read more

fn buffer(&self, width: f64, quadsegs: i32) -> GResult<Geometry<'a>>[src]

Returns a geometry which represents all points whose distance from self is less than or equal to distance. Read more

fn is_empty(&self) -> GResult<bool>[src]

Returns true if the given geometry is empty. Read more

fn is_simple(&self) -> GResult<bool>[src]

Returns true if the given geometry has no anomalous geometric points, such as self intersection or self tangency. Read more

fn difference<'b, G: Geom<'b>>(&self, other: &G) -> GResult<Geometry<'a>>[src]

Returns a geometry which represents part of self that doesn’t intersect with other. Read more

fn envelope(&self) -> GResult<Geometry<'a>>[src]

Returns the minimum bouding box of the given geometry. Read more

fn sym_difference<'b, G: Geom<'b>>(&self, other: &G) -> GResult<Geometry<'a>>[src]

Returns a geometry which represents the parts of self and other that don’t intersect. Read more

fn union<'b, G: Geom<'b>>(&self, other: &G) -> GResult<Geometry<'a>>[src]

Aggregates the given geometry with another one. Read more

fn get_centroid(&self) -> GResult<Geometry<'a>>[src]

Returns the geometric center or (equivalently) the center of mass of the given geometry as a point. Read more

fn unary_union(&self) -> GResult<Geometry<'a>>[src]

Documentation from postgis: Read more

fn voronoi<'b, G: Geom<'b>>(
    &self,
    envelope: Option<&G>,
    tolerance: f64,
    only_edges: bool
) -> GResult<Geometry<'a>>
[src]

Create a voronoi diagram. Read more

fn intersection<'b, G: Geom<'b>>(&self, other: &G) -> GResult<Geometry<'a>>[src]

Returns a geometry representing the intersection between self and other. Read more

fn convex_hull(&self) -> GResult<Geometry<'a>>[src]

Documentation from postgis: Read more

fn boundary(&self) -> GResult<Geometry<'a>>[src]

Returns the closure of the combinatorial boundary of self. Read more

fn has_z(&self) -> GResult<bool>[src]

Returns true if self has a Z coordinate. Read more

fn is_closed(&self) -> GResult<bool>[src]

Returns true if start and end point are coincident. Read more

fn length(&self) -> GResult<f64>[src]

Returns the length of self. The unit depends of the SRID. Read more

fn distance<'b, G: Geom<'b>>(&self, other: &G) -> GResult<f64>[src]

Returns the distance between self and other. The unit depends of the SRID. Read more

fn distance_indexed<'b, G: Geom<'b>>(&self, other: &G) -> GResult<f64>[src]

Returns the indexed distance between self and other. The unit depends of the SRID. Read more

fn hausdorff_distance<'b, G: Geom<'b>>(&self, other: &G) -> GResult<f64>[src]

Returns the hausdorff distance between self and other. The unit depends of the SRID. Read more

fn hausdorff_distance_densify<'b, G: Geom<'b>>(
    &self,
    other: &G,
    distance_frac: f64
) -> GResult<f64>
[src]

Returns the hausdorff distance between self and other. The unit depends of the SRID. Read more

fn frechet_distance<'b, G: Geom<'b>>(&self, other: &G) -> GResult<f64>[src]

Returns the frechet distance between self and other. The unit depends of the SRID. Read more

fn frechet_distance_densify<'b, G: Geom<'b>>(
    &self,
    other: &G,
    distance_frac: f64
) -> GResult<f64>
[src]

Returns the frechet distance between self and other. The unit depends of the SRID. Read more

fn get_length(&self) -> GResult<f64>[src]

Returns the length of the given geometry. Read more

fn snap<'b, G: Geom<'b>>(
    &self,
    other: &G,
    tolerance: f64
) -> GResult<Geometry<'a>>
[src]

Documentation from postgis: Read more

fn extract_unique_points(&self) -> GResult<Geometry<'a>>[src]

Returns unique points of self.

fn nearest_points<'b, G: Geom<'b>>(&self, other: &G) -> GResult<CoordSeq<'a>>[src]

fn get_x(&self) -> GResult<f64>[src]

Returns the X position. The given Geometry must be a Point, otherwise it’ll fail. Read more

fn get_y(&self) -> GResult<f64>[src]

Returns the Y position. The given Geometry must be a Point, otherwise it’ll fail. Read more

fn get_z(&self) -> GResult<f64>[src]

Returns the Z position. The given Geometry must be a Point, otherwise it’ll fail. Read more

fn get_point_n(&self, n: usize) -> GResult<Geometry<'a>>[src]

Returns the nth point of the given geometry. Read more

fn get_start_point(&self) -> GResult<Geometry<'a>>[src]

Returns the start point of self. Read more

fn get_end_point(&self) -> GResult<Geometry<'a>>[src]

Returns the end point of self. Read more

fn get_num_points(&self) -> GResult<usize>[src]

Returns the number of points of self. Read more

fn get_num_interior_rings(&self) -> GResult<usize>[src]

Returns the number of interior rings. Read more

fn get_num_coordinates(&self) -> GResult<usize>[src]

Returns the number of coordinates inside self. Read more

fn get_num_dimensions(&self) -> GResult<usize>[src]

Returns the number of dimensions used in self. Read more

fn get_coordinate_dimension(&self) -> GResult<Dimensions>[src]

Return in which coordinate dimension the geometry is. Read more

fn make_valid(&self) -> GResult<Geometry<'a>>[src]

This functions attempts to return a valid representation of self. Read more

fn get_num_geometries(&self) -> GResult<usize>[src]

Returns the number of geometries. Read more

fn get_srid(&self) -> GResult<usize>[src]

Get SRID of self. Read more

fn get_precision(&self) -> GResult<f64>[src]

Returns the precision of self. Read more

fn set_precision(
    &self,
    grid_size: f64,
    flags: Precision
) -> GResult<Geometry<'a>>
[src]

Returns the precision of self. Read more

fn get_x_max(&self) -> GResult<f64>[src]

Returns the biggest X of the geometry. Read more

fn get_x_min(&self) -> GResult<f64>[src]

Returns the smallest X of the geometry. Read more

fn get_y_max(&self) -> GResult<f64>[src]

Returns the biggest Y of the geometry. Read more

fn get_y_min(&self) -> GResult<f64>[src]

Returns the smallest Y of the geometry. Read more

fn minimum_clearance(&self) -> GResult<f64>[src]

Returns the smallest distance by which a vertex of self could be moved to produce an invalid geometry. Read more

fn minimum_clearance_line(&self) -> GResult<Geometry<'a>>[src]

Returns the two-point LineString spanning of self’s minimum clearance. Read more

fn minimum_rotated_rectangle(&self) -> GResult<Geometry<'a>>[src]

Returns the minimum rotated rectangle inside of self. Read more

fn minimum_width(&self) -> GResult<Geometry<'a>>[src]

Returns the minimum width inside of self. Read more

fn delaunay_triangulation(
    &self,
    tolerance: f64,
    only_edges: bool
) -> GResult<Geometry<'a>>
[src]

Returns a delaunay triangulation around the vertices of self. Read more

fn interpolate(&self, d: f64) -> GResult<Geometry<'a>>[src]

fn interpolate_normalized(&self, d: f64) -> GResult<Geometry<'a>>[src]

fn project<'b, G: Geom<'b>>(&self, p: &G) -> GResult<f64>[src]

fn project_normalized<'b, G: Geom<'b>>(&self, p: &G) -> GResult<f64>[src]

fn node(&self) -> GResult<Geometry<'a>>[src]

fn offset_curve(
    &self,
    width: f64,
    quadrant_segments: i32,
    join_style: JoinStyle,
    mitre_limit: f64
) -> GResult<Geometry<'a>>
[src]

Return an offset line at a given distance and side from an input line. All points of the returned geometries are not further than the given distance from the input geometry. Read more

fn point_on_surface(&self) -> GResult<Geometry<'a>>[src]

fn polygonize_full(
    &self
) -> GResult<(Geometry<'a>, Option<Geometry<'a>>, Option<Geometry<'a>>, Option<Geometry<'a>>)>
[src]

Returns, in the tuple elements order: Read more

fn shared_paths<'b, G: Geom<'b>>(&self, other: &G) -> GResult<Geometry<'a>>[src]

fn to_hex(&self) -> GResult<CVec<u8>>[src]

Converts a Geometry to the HEX format. For more control over the generated output, use the [WKBWriter] type. Read more

fn to_wkb(&self) -> GResult<CVec<u8>>[src]

Converts a Geometry to the WKB format. For more control over the generated output, use the [WKBWriter] type. Read more

fn to_prepared_geom(&self) -> GResult<PreparedGeometry<'a>>[src]

Creates a new PreparedGeometry from the current Geometry. Read more

fn clone(&self) -> Geometry<'a>[src]

Also passes the context to the newly created Geometry.

fn get_geometry_n<'c>(&'c self, n: usize) -> GResult<ConstGeometry<'a, 'c>>[src]

Returns the 1-based nth geometry. Read more

fn get_interior_ring_n<'c>(&'c self, n: u32) -> GResult<ConstGeometry<'a, 'c>>[src]

Returns the nth interior ring. Read more

fn get_exterior_ring<'c>(&'c self) -> GResult<ConstGeometry<'a, 'c>>[src]

Returns the exterior ring. Read more

impl<'a, 'b, G: Geom<'b>> PartialEq<G> for Geometry<'a>[src]

fn eq(&self, other: &G) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl<'a, T: Borrow<Point<f64>>> TryFrom<&'a [T]> for GGeometry<'a>[src]

type Error = Error

The type returned in the event of a conversion error.

fn try_from(other: &'a [T]) -> Result<GGeometry<'a>, Self::Error>[src]

Performs the conversion.

impl<'a, 'b> TryFrom<&'a Geometry> for GGeometry<'b>[src]

type Error = Error

The type returned in the event of a conversion error.

fn try_from(other: &'a Geometry) -> Result<GGeometry<'b>, Self::Error>[src]

Performs the conversion.

impl<'a, 'b> TryFrom<&'a LineString<f64>> for GGeometry<'b>[src]

type Error = Error

The type returned in the event of a conversion error.

fn try_from(other: &'a LineString<f64>) -> Result<GGeometry<'b>, Self::Error>[src]

Performs the conversion.

impl<'a, 'b> TryFrom<&'a MultiPolygon<f64>> for GGeometry<'b>[src]

type Error = Error

The type returned in the event of a conversion error.

fn try_from(other: &'a MultiPolygon<f64>) -> Result<GGeometry<'b>, Self::Error>[src]

Performs the conversion.

impl<'a, 'b> TryFrom<&'a Point<f64>> for GGeometry<'b>[src]

type Error = Error

The type returned in the event of a conversion error.

fn try_from(other: &'a Point<f64>) -> Result<GGeometry<'b>, Self::Error>[src]

Performs the conversion.

impl<'a, 'b> TryFrom<&'a Polygon<f64>> for GGeometry<'b>[src]

type Error = Error

The type returned in the event of a conversion error.

fn try_from(other: &'a Polygon<f64>) -> Result<GGeometry<'b>, Self::Error>[src]

Performs the conversion.

impl<'a> TryFrom<Geometry> for GGeometry<'a>[src]

type Error = Error

The type returned in the event of a conversion error.

fn try_from(other: Geometry) -> Result<GGeometry<'a>, Self::Error>[src]

Performs the conversion.

impl<'a> TryFrom<LineString<f64>> for GGeometry<'a>[src]

type Error = Error

The type returned in the event of a conversion error.

fn try_from(other: LineString<f64>) -> Result<GGeometry<'a>, Self::Error>[src]

Performs the conversion.

impl<'a> TryFrom<MultiPolygon<f64>> for GGeometry<'a>[src]

type Error = Error

The type returned in the event of a conversion error.

fn try_from(other: MultiPolygon<f64>) -> Result<GGeometry<'a>, Self::Error>[src]

Performs the conversion.

impl<'a> TryFrom<Point<f64>> for GGeometry<'a>[src]

type Error = Error

The type returned in the event of a conversion error.

fn try_from(other: Point<f64>) -> Result<GGeometry<'a>, Self::Error>[src]

Performs the conversion.

impl<'a> TryFrom<Polygon<f64>> for GGeometry<'a>[src]

type Error = Error

The type returned in the event of a conversion error.

fn try_from(other: Polygon<f64>) -> Result<GGeometry<'a>, Self::Error>[src]

Performs the conversion.

impl<'a> Send for Geometry<'a>[src]

impl<'a> Sync for Geometry<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for Geometry<'a>

impl<'a> Unpin for Geometry<'a>

impl<'a> UnwindSafe for Geometry<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.