mirror of
https://github.com/azaion/satellite-provider.git
synced 2026-06-21 19:01:15 +00:00
b0fffa6d42
Phase A baseline outputs from /autodev (Steps 1-5): - Problem & solution docs (_docs/00_problem, _docs/01_solution) - Codebase documentation (_docs/02_document) incl. architecture, module-layout, glossary, system-flows, baseline compliance scan - Test specs (blackbox, performance, resilience, security, resource, traceability matrix) - Test task decomposition (_docs/02_tasks/todo): AZ-285..AZ-290 - Testability refactor (_docs/04_refactoring/01-testability-refactoring): - TC-01 Move DownloadedTileInfoV2 + new ExistingTileInfo to Common.DTO - TC-02 Replace dead ISatelliteDownloader API with real signatures - TC-03 GoogleMapsDownloaderV2 implements ISatelliteDownloader - TC-04 TileService depends on ISatelliteDownloader (mockable) - TC-05 DI + endpoints use ISatelliteDownloader - Test runner scripts (scripts/run-tests.sh, run-performance-tests.sh) - Autodev state pointer (_docs/_autodev_state.md) Prepares the codebase for AZ-285..AZ-290 unit/integration test work. Co-authored-by: Cursor <cursoragent@cursor.com>
2.6 KiB
2.6 KiB
Module: Common/Utils/GeoUtils
Purpose
Static geographic computation utilities: coordinate conversions, distance calculations (Haversine), bearing computation, point interpolation, and bounding box calculation.
Public Interface
All methods are static on GeoUtils:
WorldToTilePos(GeoPoint point, int zoom) → (int x, int y): converts lat/lon to slippy map tile coordinates at given zoomTileToWorldPos(int x, int y, int zoom) → GeoPoint: converts tile coordinates back to lat/lon (NW corner of tile)ToRadians(double degrees) → doubleToDegrees(double radians) → doubleDirectionTo(this GeoPoint p1, GeoPoint p2) → Direction(extension method): Haversine distance + forward azimuth between two pointsGoDirection(this GeoPoint startPoint, Direction direction) → GeoPoint(extension method): destination point given start + bearing + distanceGetBoundingBox(GeoPoint center, double radiusM) → (minLat, maxLat, minLon, maxLon): axis-aligned bounding box around a center pointCalculateIntermediatePoints(GeoPoint start, GeoPoint end, double maxSpacingMeters) → List<GeoPoint>: generates evenly-spaced points along a great-circle path (returns empty if distance ≤ maxSpacing)CalculateDistance(GeoPoint p1, GeoPoint p2) → double: convenience wrapper aroundDirectionTo().DistanceCalculateCenter(GeoPoint northWest, GeoPoint southEast) → GeoPoint: simple midpointCalculatePolygonDiagonalDistance(GeoPoint northWest, GeoPoint southEast) → double: diagonal distance of a bounding box
Internal Logic
- Earth radius constant:
6378137meters (WGS-84 semi-major axis) - Distance calculation uses the Haversine formula
- Bearing uses
atan2of longitude/latitude components CalculateIntermediatePointsdivides the segment into equal sub-segments, each ≤maxSpacingMeters- Tile conversion follows the standard Web Mercator / slippy map tile numbering scheme
Dependencies
SatelliteProvider.Common.DTO.GeoPointSatelliteProvider.Common.DTO.Direction
Consumers
GoogleMapsDownloaderV2—WorldToTilePos,TileToWorldPos,GetBoundingBoxTileService— indirectly via downloaderRegionService—WorldToTilePosfor tile stitchingRouteService—CalculateIntermediatePoints,CalculateDistanceRouteProcessingService—WorldToTilePosfor map stitchingSatTileconstructor —TileToWorldPosProgram.cs(ServeTile handler) —TileToWorldPos
Data Models
None.
Configuration
None.
External Integrations
None (pure math).
Security
None.
Tests
No dedicated unit tests for GeoUtils.