logo
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

Fields

geometries: Vec<Shape>

A collection of shapes

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

Implementations

Creates an instance of Shape::Point

Creates an instance of Shape::LineString

Creates an instance of Shape::Polygon

Creates an instance of Shape::MultiPoint

Creates an instance of Shape::MultiLineString

Creates an instance of Shape::MultiPolygon

Creates an instance of Shape::Envelope

Creates an instance of Shape::GeometryCollection

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.