Crate geom

source · []


angle 🔒
bounds 🔒
circle 🔒
Conversions between this crate and geo. Long-term, we should think about directly using geo or wrapping it, but in the meantime…
distance 🔒
duration 🔒
gps 🔒
line 🔒
percent 🔒
polygon 🔒
polyline 🔒
pt 🔒
ring 🔒
speed 🔒
stats 🔒
time 🔒
utils 🔒


An angle, stored in radians.
Represents a rectangular boundary of Pt2D points.
A circle, defined by a center and radius.
A distance, in meters. Can be negative.
A duration, in seconds. Can be negative.
A quad-tree to quickly find the closest points to some polylines.
Represents a rectangular boundary of LonLat points. After building one of these, LonLats can be transformed into Pt2Ds, treating the top-left of the boundary as (0, 0), and growing to the right and down (screen-drawing order, not Cartesian) in meters.
This represents world space, NOT LonLat.
A line segment.
Represents a (longitude, latitude) point.
Most of the time, [0, 1]. But some callers may go outside this range.
This represents world-space in meters.
Maybe a misnomer, but like a PolyLine, but closed.
In meters per second. Can be negative.
A tessellated polygon, ready for rendering.
In seconds since midnight. Can’t be negative.
Specifies how to stringify different geom objects.





Deserializes a trimmed f64 from an i32.
Create a GeoJson with one feature per geometry, and no properties.
Create a GeoJson with one feature per geometry, with the specified properties.
Serializes a trimmed f64 as an i32 to save space.
Reduce the precision of an f64. This helps ensure serialization is idempotent (everything is exactly the same before and after saving/loading). Ideally we’d use some kind of proper fixed-precision type instead of f64.