How bacemkarray/great-circle-mapper works
Project type and purpose
• This is a single‐module, desktop GUI application written in Python.
• Purpose: Let users enter a chain of ICAO airport codes, fetch their lat/long via the airportsdata library, and render the great-circle flight paths on a satellite map image (Google Maps Static API) inside a Tkinter window.
File structure
• Top-level files only:
• great_circle_mapper.py – the entire application logic (UI, data fetching, map generation, rendering).
• requirements.txt – third-party dependencies (airportsdata, requests, pillow).
• .gitignore – standard ignore rules (e.g., .env).
• README.md – high-level overview, instructions.
• Configuration: uses a .env file (not checked in) to supply MAPS_STATIC_API_KEY.
• No separate “backend” or “service” folders—everything lives in one script.
Key insights from the README
• Dependencies:
• airportsdata (airport metadata lookup)
• requests (HTTP client for map image)
• pillow (image display)
• tkinter (GUI)
• Workflow:
1. Parse user’s ICAO string.
2. Look up each airport’s coordinates.
3. Build Google Maps Static API URL with markers and great circle polylines.
4. Fetch the image.
5. It in a Tkinter window via Pillow.
Main components
a. UI Layer (Tkinter)
• Input field for ICAO string
• Canvas or Label for displaying the map image
b. Data-Lookup Service
• airportsdata library
• Function to parse codes and return lat/long pairs
c. Route-Generation Logic
• Great-circle computation (either custom math or leveraging API’s path parameter)
d. API Client
• Builds the Google Static Maps URL (markers + path)
• Uses requests to GET the image
e. Image Renderer
• pillow loads the raw JPEG/PNG bytes
• Converts to a PhotoImage for Tkinter display
f. Configuration Loader
• Reads MAPS_STATIC_API_KEY from .env via os.getenv
g. External Services
• airportsdata (local library, but external package)
• Google Static Maps API endpoint
Relationships and data flow
• UI → (parse input) → Route-Generation Logic
• Route-Generation Logic → (requests coords) → Data-Lookup Service
• Data-Lookup Service → coordinates → Route-Generation Logic
• Route-Generation Logic → (build URL) → Map API Client
• API Client → (HTTP GET) → External Google Maps service → image bytes → Image Renderer
• Image Renderer → GUI canvas → UI
• Configuration Loader → provides API key to Map API Client
Architectural patterns & design principles
• Separation of concerns: UI vs. data lookup vs. map fetching vs. rendering
• Dependency inversion for external services (e.g., wrap requests in a client class to facilitate testing)
• Environment‐based configuration for keys and secrets