A lightweight C++ command-line tool that tracks the real-time location of the International Space Station (ISS) and translates its coordinates into a human-readable geographic location.
The application works by querying the Open-Notify API for the station's current latitude and longitude, and then utilizing the OpenStreetMap Nominatim API to reverse-geocode those coordinates into a specific city, country, or region.
- Real-Time Tracking: Fetches live coordinates of the ISS using the Open-Notify API.
- Reverse Geocoding: Converts raw latitude and longitude data into human-readable locations using OpenStreetMap.
- Ocean/Unmapped Handling: Gracefully handles edge cases where the ISS is passing over oceans or unmapped territories.
- JSON Parsing: Utilizes
nlohmann/jsonfor efficient JSON response handling.
To build and run this project, you will need a C++ compiler (supporting C++11 or later) and the following libraries:
- libcurl: Used to handle HTTP GET requests.
- nlohmann/json: A robust, single-header C++ JSON library.
- Install the required dependencies:
sudo apt-get update sudo apt-get install libcurl4-openssl-dev nlohmann-json3-dev
- Compile the source code:
g++ -o iss_tracker iss_tracker.cpp -lcurl
- Install the dependencies:
brew install curl nlohmann-json
- Compile the source code:
g++ -std=c++11 -o iss_tracker iss_tracker.cpp -lcurl -I/opt/homebrew/include
Run the compiled executable from your terminal:
./iss_trackerFetching real-time ISS coordinates...
ISS is currently at -> Latitude: 46.2276, Longitude: 2.2137
Determining location on Earth...
Result: The ISS is currently passing over:
France, Metropolitan France
Fetching real-time ISS coordinates...
ISS is currently at -> Latitude: -12.4563, Longitude: -130.8752
Determining location on Earth...
Result: The ISS is currently over an ocean or an unmapped region.
- Oceanic Coverage: Approximately 71% of the Earth's surface is covered by water. If the ISS is over an ocean, the OpenStreetMap API will usually return an error indicating no address was found. The code catches this and alerts the user accordingly.
- Rate Limiting: This application utilizes the free OpenStreetMap Nominatim API. Their usage policy strictly limits requests to a maximum of 1 request per second. If you intend to modify this code to run in a continuous loop, ensure you implement a
sleep()command to respect this rate limit and prevent your IP from being temporarily blocked.
- libcurl - Client-side URL transfer library
- nlohmann/json - JSON for Modern C++
- Open-Notify - Real-time ISS location API
- OpenStreetMap Nominatim - Open-source geocoding API