Enum Shape

Source
pub enum Shape {
    Point {
        coordinates: Coordinate,
    },
    LineString {
        coordinates: Vec<Coordinate>,
    },
    Polygon {
        coordinates: Vec<Vec<Coordinate>>,
    },
    MultiPoint {
        coordinates: Vec<Coordinate>,
    },
    MultiLineString {
        coordinates: Vec<Vec<Coordinate>>,
    },
    MultiPolygon {
        coordinates: Vec<Vec<Vec<Coordinate>>>,
    },
    Envelope {
        coordinates: (Coordinate, Coordinate),
    },
    GeometryCollection {
        geometries: Vec<Shape>,
    },
}
Expand description

The shape data type facilitates the indexing of and searching with arbitrary x, y cartesian shapes such as rectangles and polygons. It can be used to index and query geometries whose coordinates fall in a 2-dimensional planar coordinate system.

Variants§

§

Point

A single x, y coordinate

Fields

§coordinates: Coordinate

Coordinates

§

LineString

An arbitrary line given two or more points

Fields

§coordinates: Vec<Coordinate>

Coordinates

§

Polygon

A closed polygon whose first and last point must match, thus requiring n + 1 vertices to create an n-sided polygon and a minimum of 4 vertices

Fields

§coordinates: Vec<Vec<Coordinate>>

Coordinates

§

MultiPoint

An array of unconnected, but likely related points

Fields

§coordinates: Vec<Coordinate>

Coordinates

§

MultiLineString

An array of separate linestrings

Fields

§coordinates: Vec<Vec<Coordinate>>

Coordinates

§

MultiPolygon

An array of separate polygons

Fields

§coordinates: Vec<Vec<Vec<Coordinate>>>

Coordinates

§

Envelope

A bounding rectangle, or envelope, specified by specifying only the top left and bottom right points.

Fields

§coordinates: (Coordinate, Coordinate)

Coordinates

§

GeometryCollection

A GeoJSON shape similar to the multi* shapes except that multiple types can coexist (e.g., a Point and a LineString)

Fields

§geometries: Vec<Shape>

A collection of shapes

Implementations§

Source§

impl Shape

Source

pub fn point<T>(coordinates: T) -> Self
where T: Into<Coordinate>,

Creates an instance of Shape::Point

Source

pub fn line_string<T>(coordinates: T) -> Self

Creates an instance of Shape::LineString

Source

pub fn polygon<T>(coordinates: T) -> Self

Creates an instance of Shape::Polygon

Source

pub fn multi_point<T>(coordinates: T) -> Self

Creates an instance of Shape::MultiPoint

Source

pub fn multi_line_string<T>(coordinates: T) -> Self

Creates an instance of Shape::MultiLineString

Source

pub fn multi_polygon<T>(coordinates: T) -> Self

Creates an instance of Shape::MultiPolygon

Source

pub fn envelope<T>(top_left: T, bottom_right: T) -> Self
where T: Into<Coordinate>,

Creates an instance of Shape::Envelope

Source

pub fn geometry_collection<T>(geometries: T) -> Self
where T: IntoIterator, T::Item: Into<Self>,

Creates an instance of Shape::GeometryCollection

Trait Implementations§

Source§

impl Clone for Shape

Source§

fn clone(&self) -> Shape

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Shape

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Shape

Source§

fn eq(&self, other: &Shape) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Shape

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Shape

Auto Trait Implementations§

§

impl Freeze for Shape

§

impl RefUnwindSafe for Shape

§

impl Send for Shape

§

impl Sync for Shape

§

impl Unpin for Shape

§

impl UnwindSafe for Shape

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.