rs_server_catalog/data_management/geometry_manager.md¶
Geometry validation utilities for STAC item create/update operations.
parse_bbox(bbox)
¶
Parse bbox and enforce STAC length/order constraints.
Source code in docs/rs-server/services/catalog/rs_server_catalog/data_management/geometry_manager.py
parse_number(value, value_label)
¶
Parse numeric value and reject bool/non-numeric inputs.
Source code in docs/rs-server/services/catalog/rs_server_catalog/data_management/geometry_manager.py
parse_position(position, position_label)
¶
Parse [lon, lat] position and return numeric pair.
Source code in docs/rs-server/services/catalog/rs_server_catalog/data_management/geometry_manager.py
validate_geometry(geometry)
¶
Validate GeoJSON geometry format and Shapely validity.
Validity checks performed:
- geometry must be a GeoJSON object (dict)
- geometry must be parseable by shapely.shape(...)
- parsed geometry must not be empty
- parsed geometry must be topologically valid (is_valid)
Raises:
| Type | Description |
|---|---|
HTTPException
|
400 Bad Request when any validation condition fails. |
Source code in docs/rs-server/services/catalog/rs_server_catalog/data_management/geometry_manager.py
validate_geometry_and_enforce_bbox(item)
¶
Validate item geometry and enforce geometry/bbox consistency for Catalog item ingest/update.
ESA/STAC requirements covered: - STAC-CORE-ITEM-REQ-0220 (Polygon Geometry): validates right-hand-rule orientation for Polygon/MultiPolygon (exterior ring CCW, interior rings CW). - STAC-CORE-ITEM-REQ-0230 (Minimum-bounding rectangle): enforces 2D bbox format [minLon, minLat, maxLon, maxLat] in SW->NE order.
Behavior:
- if geometry is missing/null, no geometry check is performed.
- if geometry is present and bbox is missing, bbox is computed from geometry bounds.
- if geometry and bbox are both present, bbox must be consistent with geometry bounds.
In strict mode, inconsistency raises HTTP 400.
Source code in docs/rs-server/services/catalog/rs_server_catalog/data_management/geometry_manager.py
validate_linear_ring_orientation(ring, expected_ccw, ring_label)
¶
Validate one linear ring: structure, closure, area, and orientation.
Source code in docs/rs-server/services/catalog/rs_server_catalog/data_management/geometry_manager.py
validate_polygon_geometry_orientation(geometry)
¶
Validate right-hand-rule orientation for Polygon and MultiPolygon.
Source code in docs/rs-server/services/catalog/rs_server_catalog/data_management/geometry_manager.py
validate_polygon_rings(rings, geometry_label)
¶
Validate linear rings: first exterior CCW (counterclockwise), others interior CW (clockwise).