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
Fields
coordinates: Coordinate
Coordinates
A single x, y
coordinate
LineString
Fields
coordinates: Vec<Coordinate>
Coordinates
An arbitrary line given two or more points
Polygon
Fields
coordinates: Vec<Vec<Coordinate>>
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<Coordinate>
Coordinates
An array of unconnected, but likely related points
MultiLineString
Fields
coordinates: Vec<Vec<Coordinate>>
Coordinates
An array of separate linestrings
MultiPolygon
Fields
coordinates: Vec<Vec<Vec<Coordinate>>>
Coordinates
An array of separate polygons
Envelope
Fields
coordinates: (Coordinate, Coordinate)
Coordinates
A bounding rectangle, or envelope, specified by specifying only the top left and bottom right points.
GeometryCollection
A GeoJSON shape similar to the multi*
shapes except that multiple
types can coexist (e.g., a Point and a LineString)
Implementations
sourceimpl Shape
impl Shape
sourcepub fn point<T>(coordinates: T) -> Self where
T: Into<Coordinate>,
pub fn point<T>(coordinates: T) -> Self where
T: Into<Coordinate>,
Creates an instance of Shape::Point
sourcepub fn line_string<T>(coordinates: T) -> Self where
T: IntoIterator,
T::Item: Into<Coordinate>,
pub fn line_string<T>(coordinates: T) -> Self where
T: IntoIterator,
T::Item: Into<Coordinate>,
Creates an instance of Shape::LineString
sourcepub fn polygon<T>(coordinates: T) -> Self where
T: IntoIterator,
T::Item: IntoIterator,
<T::Item as IntoIterator>::Item: Into<Coordinate>,
pub fn polygon<T>(coordinates: T) -> Self where
T: IntoIterator,
T::Item: IntoIterator,
<T::Item as IntoIterator>::Item: Into<Coordinate>,
Creates an instance of Shape::Polygon
sourcepub fn multi_point<T>(coordinates: T) -> Self where
T: IntoIterator,
T::Item: Into<Coordinate>,
pub fn multi_point<T>(coordinates: T) -> Self where
T: IntoIterator,
T::Item: Into<Coordinate>,
Creates an instance of Shape::MultiPoint
sourcepub fn multi_line_string<T>(coordinates: T) -> Self where
T: IntoIterator,
T::Item: IntoIterator,
<T::Item as IntoIterator>::Item: Into<Coordinate>,
pub fn multi_line_string<T>(coordinates: T) -> Self where
T: IntoIterator,
T::Item: IntoIterator,
<T::Item as IntoIterator>::Item: Into<Coordinate>,
Creates an instance of Shape::MultiLineString
sourcepub fn multi_polygon<T>(coordinates: T) -> Self where
T: IntoIterator,
T::Item: IntoIterator,
<T::Item as IntoIterator>::Item: IntoIterator,
<<T::Item as IntoIterator>::Item as IntoIterator>::Item: Into<Coordinate>,
pub fn multi_polygon<T>(coordinates: T) -> Self where
T: IntoIterator,
T::Item: IntoIterator,
<T::Item as IntoIterator>::Item: IntoIterator,
<<T::Item as IntoIterator>::Item as IntoIterator>::Item: Into<Coordinate>,
Creates an instance of Shape::MultiPolygon
sourcepub fn envelope<T>(top_left: T, bottom_right: T) -> Self where
T: Into<Coordinate>,
pub fn envelope<T>(top_left: T, bottom_right: T) -> Self where
T: Into<Coordinate>,
Creates an instance of Shape::Envelope
sourcepub fn geometry_collection<T>(geometries: T) -> Self where
T: IntoIterator,
T::Item: Into<Self>,
pub fn geometry_collection<T>(geometries: T) -> Self where
T: IntoIterator,
T::Item: Into<Self>,
Creates an instance of Shape::GeometryCollection
Trait Implementations
impl StructuralPartialEq for Shape
Auto Trait Implementations
impl RefUnwindSafe for Shape
impl Send for Shape
impl Sync for Shape
impl Unpin for Shape
impl UnwindSafe for Shape
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more