Enum GeoShape

Source
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

A single geographic coordinate

Note: Elasticsearch uses WGS-84 coordinates only

Fields

§coordinates: GeoLocation

Coordinates

§

LineString

An arbitrary line given two or more points

Fields

§coordinates: Vec<GeoLocation>

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<GeoLocation>>

Coordinates

§

MultiPoint

An array of unconnected, but likely related points

Fields

§coordinates: Vec<GeoLocation>

Coordinates

§

MultiLineString

An array of separate linestrings

Fields

§coordinates: Vec<Vec<GeoLocation>>

Coordinates

§

MultiPolygon

An array of separate polygons

Fields

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

Coordinates

§

Envelope

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

Fields

§coordinates: (GeoLocation, GeoLocation)

Coordinates

§

Circle

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

Fields

§coordinates: GeoLocation

Coordinates

§radius: Distance

Circle radius

§

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<GeoShape>

A collection of geo shapes

Implementations§

Source§

impl GeoShape

Source

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

Creates an instance of GeoShape::Point

Source

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

Creates an instance of GeoShape::LineString

Source

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

Creates an instance of GeoShape::Polygon

Source

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

Creates an instance of GeoShape::MultiPoint

Source

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

Creates an instance of GeoShape::MultiLineString

Source

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

Creates an instance of GeoShape::MultiPolygon

Source

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

Creates an instance of GeoShape::Envelope

Source

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

Creates an instance of GeoShape::Circle

Source

pub fn geometry_collection<T>(geometries: T) -> Self
where 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 for GeoShape

Source§

fn eq(&self, other: &GeoShape) -> 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 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 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.