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)
Implementations§
Source§impl Shape
impl Shape
Sourcepub fn point<T>(coordinates: T) -> Selfwhere
T: Into<Coordinate>,
pub fn point<T>(coordinates: T) -> Selfwhere
T: Into<Coordinate>,
Creates an instance of Shape::Point
Sourcepub fn line_string<T>(coordinates: T) -> Self
pub fn line_string<T>(coordinates: T) -> Self
Creates an instance of Shape::LineString
Sourcepub fn polygon<T>(coordinates: T) -> Self
pub fn polygon<T>(coordinates: T) -> Self
Creates an instance of Shape::Polygon
Sourcepub fn multi_point<T>(coordinates: T) -> Self
pub fn multi_point<T>(coordinates: T) -> Self
Creates an instance of Shape::MultiPoint
Sourcepub fn multi_line_string<T>(coordinates: T) -> Self
pub fn multi_line_string<T>(coordinates: T) -> Self
Creates an instance of Shape::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<Coordinate>,
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<Coordinate>,
Creates an instance of Shape::MultiPolygon
Sourcepub fn envelope<T>(top_left: T, bottom_right: T) -> Selfwhere
T: Into<Coordinate>,
pub fn envelope<T>(top_left: T, bottom_right: T) -> Selfwhere
T: Into<Coordinate>,
Creates an instance of Shape::Envelope
Sourcepub fn geometry_collection<T>(geometries: T) -> Self
pub fn geometry_collection<T>(geometries: T) -> Self
Creates an instance of Shape::GeometryCollection