Skip to content

Add BoundingBox (geo) #43

@vhrcgcom

Description

@vhrcgcom

Description

Implement BoundingBox as a ValueObject in the geo module.

Spec: composite: SW Coordinate + NE Coordinate

Implementation checklist

  • Create src/geo/boundingbox.rs
  • Implement ValueObject trait
  • Add #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
  • Export from src/geo/mod.rs and prelude
  • Unit tests: valid input · empty input · invalid format · normalisation
  • Doc comment with # Example block
  • Update status in ROADMAP.md from ⬜ to ✅

Implementation detail

Input / Output

BoundingBox is a composite value object. Depends on Coordinate.

Type
Input BoundingBoxInput { south_west: Coordinate, north_east: Coordinate }
Output String — e.g. "SW(49.0000, 12.0000) NE(51.0000, 16.0000)"

Validation

  • The south-west latitude must be strictly less than the north-east latitude.
  • The south-west longitude must be strictly less than the north-east longitude.

Extra methods

  • south_west() -> &Coordinate
  • north_east() -> &Coordinate
  • contains(coord: &Coordinate) -> bool — returns true if the coordinate falls within the bounding box (inclusive on all edges).

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or improvement

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions