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
GeometryCollection
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
impl GeoShape
Sourcepub fn point<T>(coordinates: T) -> Selfwhere
T: Into<GeoLocation>,
pub fn point<T>(coordinates: T) -> Selfwhere
T: Into<GeoLocation>,
Creates an instance of GeoShape::Point
Sourcepub fn line_string<T>(coordinates: T) -> Self
pub fn line_string<T>(coordinates: T) -> Self
Creates an instance of GeoShape::LineString
Sourcepub fn polygon<T>(coordinates: T) -> Self
pub fn polygon<T>(coordinates: T) -> Self
Creates an instance of GeoShape::Polygon
Sourcepub fn multi_point<T>(coordinates: T) -> Self
pub fn multi_point<T>(coordinates: T) -> Self
Creates an instance of GeoShape::MultiPoint
Sourcepub fn multi_line_string<T>(coordinates: T) -> Self
pub fn multi_line_string<T>(coordinates: T) -> Self
Creates an instance of GeoShape::MultiLineString
Sourcepub 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>,
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
Sourcepub fn envelope<T>(top_left: T, bottom_right: T) -> Selfwhere
T: Into<GeoLocation>,
pub fn envelope<T>(top_left: T, bottom_right: T) -> Selfwhere
T: Into<GeoLocation>,
Creates an instance of GeoShape::Envelope
Sourcepub fn circle<T, R>(coordinates: T, radius: R) -> Self
pub fn circle<T, R>(coordinates: T, radius: R) -> Self
Creates an instance of GeoShape::Circle
Sourcepub fn geometry_collection<T>(geometries: T) -> Self
pub fn geometry_collection<T>(geometries: T) -> Self
Creates an instance of GeoShape::GeometryCollection