pub enum GeoShape {
    Point {
        coordinates: GeoLocation,
    },
    LineString {
        coordinates: Vec<GeoLocation>,
    },
    Polygon {
        coordinates: Vec<Vec<GeoLocation>>,
    },
    MultiPoint {
        coordinates: Vec<GeoLocation>,
    },
    MultiLineString {
        coordinates: Vec<Vec<GeoLocation>>,
    },
    MultiPolygon {
        coordinates: Vec<Vec<Vec<GeoLocation>>>,
    },
    Envelope {
        coordinates: (GeoLocation, GeoLocation),
    },
    Circle {
        coordinates: GeoLocation,
        radius: Distance,
    },
    GeometryCollection {
        geometries: Vec<GeoShape>,
    },
}
Expand description

The geo_shape data type facilitates the indexing of and searching with arbitrary geo shapes such as rectangles and polygons. It should be used when either the data being indexed or the queries being executed contain shapes other than just points.

Variants§

§

Point

Fields

§coordinates: GeoLocation

Coordinates

A single geographic coordinate

Note: Elasticsearch uses WGS-84 coordinates only

§

LineString

Fields

§coordinates: Vec<GeoLocation>

Coordinates

An arbitrary line given two or more points

§

Polygon

Fields

§coordinates: Vec<Vec<GeoLocation>>

Coordinates

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

§

MultiPoint

Fields

§coordinates: Vec<GeoLocation>

Coordinates

An array of unconnected, but likely related points

§

MultiLineString

Fields

§coordinates: Vec<Vec<GeoLocation>>

Coordinates

An array of separate linestrings

§

MultiPolygon

Fields

§coordinates: Vec<Vec<Vec<GeoLocation>>>

Coordinates

An array of separate polygons

§

Envelope

Fields

§coordinates: (GeoLocation, GeoLocation)

Coordinates

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

§

Circle

Fields

§coordinates: GeoLocation

Coordinates

§radius: Distance

Circle radius

A circle specified by a center point and radius with units, which default to METERS

§

GeometryCollection

Fields

§geometries: Vec<GeoShape>

A collection of geo shapes

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

Implementations§

source§

impl GeoShape

source

pub fn point<T>(coordinates: T) -> Selfwhere T: Into<GeoLocation>,

Creates an instance of GeoShape::Point

source

pub fn line_string<T>(coordinates: T) -> Selfwhere T: IntoIterator, T::Item: Into<GeoLocation>,

Creates an instance of GeoShape::LineString

source

pub fn polygon<T>(coordinates: T) -> Selfwhere T: IntoIterator, T::Item: IntoIterator, <T::Item as IntoIterator>::Item: Into<GeoLocation>,

Creates an instance of GeoShape::Polygon

source

pub fn multi_point<T>(coordinates: T) -> Selfwhere T: IntoIterator, T::Item: Into<GeoLocation>,

Creates an instance of GeoShape::MultiPoint

source

pub fn multi_line_string<T>(coordinates: T) -> Selfwhere T: IntoIterator, T::Item: IntoIterator, <T::Item as IntoIterator>::Item: Into<GeoLocation>,

Creates an instance of GeoShape::MultiLineString

source

pub fn multi_polygon<T>(coordinates: T) -> Selfwhere T: IntoIterator, T::Item: IntoIterator, <T::Item as IntoIterator>::Item: IntoIterator, <<T::Item as IntoIterator>::Item as IntoIterator>::Item: Into<GeoLocation>,

Creates an instance of GeoShape::MultiPolygon

source

pub fn envelope<T>(top_left: T, bottom_right: T) -> Selfwhere T: Into<GeoLocation>,

Creates an instance of GeoShape::Envelope

source

pub fn circle<T, R>(coordinates: T, radius: R) -> Selfwhere T: Into<GeoLocation>, R: Into<Distance>,

Creates an instance of GeoShape::Circle

source

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

Creates an instance of GeoShape::GeometryCollection

Trait Implementations§

source§

impl Clone for GeoShape

source§

fn clone(&self) -> GeoShape

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 GeoShape

source§

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

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

impl PartialEq<GeoShape> for GeoShape

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for GeoShape

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 GeoShape

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. 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 Twhere 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 Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.