Skip to main content

Crate geo_core

Crate geo_core 

Source
Expand description

§geo-core

Format-agnostic geospatial domain types, geometry helpers, and transforms for video-analysis.

This crate owns stable internal concepts such as coordinates, bounding boxes, geometry, features, collections, and geometry simplification. It intentionally does not depend on GeoJSON or expose wire-format crate types.

§Install

[dependencies]
geo-core = { package = "moenarch-geo-core", version = "0.1.0" }
use geo_core::{Coordinate, Geometry};

§Package surface

Primary workflow: geo.distance.

Workflow operations:

  • geo.bounds: Computes bounds and coordinate counts for an internal geometry document.
  • geo.distance: Computes haversine meters or planar coordinate-unit distance between lon/lat coordinates.

Debug operations:

  • describe: inspect package metadata and runtime support.

Runtime support: library, CLI, server, and WASM wrappers expose these operations.

Run the primary workflow through the CLI:

cargo run -p moenarch-geo-core-cli -- run \
  --operation geo.distance \
  --json '{"from":[8.0,49.0],"mode":"haversine","to":[9.0,49.0]}'

Successful responses use the shared package-surface shape with operation, title, message, summary, and result. Default surface calls are deterministic, local-first, and do not download models, write persistent files, or execute external tools unless an operation explicitly documents native or external-tool execution.

Modules§

surface
Library-owned runtime surface for geo-core.

Structs§

BBox
Data type for a 2D bounding box.
Coordinate
Data type for a 2D geographic coordinate.
GeoFeature
GeoJSON-compatible feature data.
GeoFeatureCollection
GeoJSON-compatible feature collection data.

Enums§

GeoError
Error type for geospatial domain validation and local data access.
Geometry
GeoJSON-shaped geometry data.

Functions§

assemble_multipolygon
Assembles polygon or multipolygon geometry from outer and inner ring segments.
geometry_intersects_bbox
Returns true when a geometry intersects a bbox.
is_valid_closed_ring
Returns true when a ring has at least four positions and matching first/last points.
line_string
Creates linestring geometry from coordinates.
map_feature_coordinates
Applies a coordinate transform to every coordinate in a feature.
map_geometry_coordinates
Applies a coordinate transform to every coordinate in a geometry.
normalize_ring_orientation
Reverses a ring when needed to match the requested orientation.
point
Creates point geometry.
point_in_ring
Returns true when a point lies inside a closed ring.
polygon_or_multipolygon
Creates polygon or multipolygon geometry from polygon rings.
ring_area
Returns signed planar area for a closed ring.
simplify_geometry
Simplifies lines and rings in a geometry using Douglas-Peucker simplification.
simplify_line
Simplifies an open line using Douglas-Peucker simplification.
simplify_ring
Simplifies a closed ring and preserves ring closure.
stitch_rings
Stitches line segments into closed rings.
translate_geometry
Translates every coordinate in a geometry by a longitude/x and latitude/y delta.

Type Aliases§

Position
Two-dimensional coordinate position in [longitude, latitude] order.
Properties
JSON object used for feature properties.
Result
Geo crate result type.