Skip to main content

Module geometry

Module geometry 

Source
Expand description

GeoJSON-compatible geometry types.

Supports Point, LineString, Polygon, MultiPoint, MultiLineString, MultiPolygon, and GeometryCollection. Stored as GeoJSON for JSON compatibility. Includes distance (Haversine), area, bearing, and centroid calculations.

Structs§

Coord
A 2D coordinate (longitude, latitude) following GeoJSON convention. Note: GeoJSON uses [lng, lat] order, NOT [lat, lng].

Enums§

Geometry
GeoJSON-compatible geometry types.

Functions§

haversine_bearing
Haversine bearing from point A to point B in degrees (0-360).
haversine_distance
Haversine distance between two points in meters.
point_in_polygon
Check if a point is inside a polygon (ray casting algorithm).
polygon_area
Approximate area of a polygon on Earth’s surface in square meters.