## Expand description

The `geo-types`

library defines geometric types for the GeoRust ecosystem.

In most cases, you will only need to use this crate if you’re a crate author and want
compatibility with other GeoRust crates. Otherwise, the `geo`

crate re-exports these types and additionally provides geospatial algorithms.

### §Geometries

: A single point represented by one`Point`

`Coord`

: A collection of`MultiPoint`

`Point`

s: A line segment represented by two`Line`

`Coord`

s: A series of contiguous line segments represented by two or more`LineString`

`Coord`

s: A collection of`MultiLineString`

`LineString`

s: A bounded area represented by one`Polygon`

`LineString`

exterior ring, and zero or more`LineString`

interior rings: A collection of`MultiPolygon`

`Polygon`

s: An axis-aligned bounded rectangle represented by minimum and maximum`Rect`

`Coord`

s: A bounded area represented by three`Triangle`

`Coord`

vertices: A collection of`GeometryCollection`

`Geometry`

s: An enumeration of all geometry types, excluding`Geometry`

`Coord`

### §Coordinates and Numeric Types

: A two-dimensional coordinate. All geometry types are composed of`Coord`

`Coord`

s, though`Coord`

itself is not a`Geometry`

type. See`Point`

for a single coordinate geometry.

By default, coordinates are 64-bit floating point numbers, but this is generic, and you may specify any numeric type that implements `CoordNum`

or `CoordFloat`

. As well as `f64`

, this includes common numeric types like `f32`

, `i32`

, `i64`

, etc.

```
use geo_types::Point;
// Geometries are f64 by default
let point: Point = Point::new(1.0, 2.0);
assert_eq!(std::mem::size_of::<Point>(), 64 * 2 / 8);
// You can be explicit about the numeric type.
let f64_point: Point<f64> = Point::new(1.0, 2.0);
assert_eq!(std::mem::size_of::<Point<f64>>(), 64 * 2 / 8);
// Or specify some non-default numeric type
let f32_point: Point<f32> = Point::new(1.0, 2.0);
assert_eq!(std::mem::size_of::<Point<f32>>(), 32 * 2 / 8);
// Integer geometries are supported too, though not all
// algorithms will be implemented for all numeric types.
let i32_point: Point<i32> = Point::new(1, 2);
assert_eq!(std::mem::size_of::<Point<i32>>(), 32 * 2 / 8);
```

## §Semantics

The geospatial types provided here aim to adhere to the OpenGIS Simple feature access standards. Thus, the types here are inter-operable with other implementations of the standards: JTS, GEOS, etc.

## §Features

The following optional Cargo features are available:

`std`

: Enables use of the full`std`

library. Enabled by default.`approx`

: Allows geometry types to be checked for approximate equality with approx`arbitrary`

: Allows geometry types to be created from unstructured input with arbitrary`serde`

: Allows geometry types to be serialized and deserialized with Serde`use-rstar_0_8`

: Allows geometry types to be inserted into rstar R*-trees (`rstar v0.8`

)`use-rstar_0_9`

: Allows geometry types to be inserted into rstar R*-trees (`rstar v0.9`

)`use-rstar_0_10`

: Allows geometry types to be inserted into rstar R*-trees (`rstar v0.10`

)`use-rstar_0_11`

: Allows geometry types to be inserted into rstar R*-trees (`rstar v0.11`

)`use-rstar_0_12`

: Allows geometry types to be inserted into rstar R*-trees (`rstar v0.12`

)

This library can be used in `#![no_std]`

environments if the default `std`

feature is disabled. At
the moment, the `arbitrary`

and `use-rstar_0_8`

features require `std`

. This may change in a
future release.

## Re-exports§

`pub use geometry::*;`

## Modules§

## Macros§

- Creates a
`Coord`

from the given scalars. - Creates a
`LineString`

containing the given coordinates. - Creates a
`Point`

from the given coordinates. - Creates a
`Polygon`

containing the given coordinates. - Creates a
`crate::geometry`

from a WKT literal.

## Structs§

- InvalidRectCoordinatesErrorDeprecated
- A
`Point`

iterator returned by the`points`

method

## Enums§

## Traits§

- For algorithms which can only use floating point
`Point`

s/`Coord`

s, like area or length calculations - For algorithms which can use both integer
**and**floating point`Point`

s/`Coord`

s - CoordinateTypeDeprecated