FayyazAK/Global-Aviation-Waypoints
Python-based waypoint scraper that collects global aviation waypoints from OpenNav. It processes over 51,000 waypoints, converting coordinates to a format compatible with APIs, and compiles the data into a single CSV file for easy access and analysis. The tool is indispensable for aviation route planning and navigation studies. โ๏ธ๐๐
Waypoint Scraper
Overview
๐๐๐ This repository contains a Python script that scrapes waypoint data for countries worldwide and saves the data into a single consolidated CSV file. The waypoints are sourced from OpenNav, a platform providing aeronautical navigation data. The script uses Alpha-2 country codes from a CSV file to fetch data for all countries.
What Are Waypoints?
๐ฉ๏ธ๐ฉ๏ธ๐ฉ๏ธ Waypoints are predefined geographical coordinates used in aviation and navigation to define routes and positions in airspace. They are critical components of modern navigation systems and are represented by identifiers such as latitude, longitude, and a unique code (IDENT).
Importance of Waypoints:
โ๏ธ Air Traffic Management: Waypoints are used by pilots and air traffic controllers to define flight paths, avoiding obstacles and ensuring safe navigation.- ๐ Route Planning: They help create efficient flight routes, reducing fuel consumption and travel time.
- ๐ฏ Precision Navigation: Waypoints are integral to satellite navigation systems (like GPS), ensuring accurate positioning.
- ๐จ Emergency Handling: In emergencies, waypoints assist in guiding aircraft to alternate routes or safe landing zones.
Features
โจโจโจ - Fetches waypoint data for all countries using their Alpha-2 country codes.
- Converts latitude and longitude from DMS (Degrees, Minutes, Seconds) format to decimal format for compatibility with APIs.
- Saves all waypoint data into a consolidated CSV file:
worldwide_waypoints.csv. - Handles errors gracefully, ensuring uninterrupted processing of other countries if an issue occurs for one.
Dependencies
๐ฆ๐ฆ๐ฆ The script uses the following Python libraries:
- ๐งพ requests: For making HTTP requests to fetch webpage content.
- ๐งฉ BeautifulSoup (bs4): For parsing and extracting data from HTML.
- ๐ csv: For reading and writing CSV files.
- ๐๏ธ os: For file and directory operations.
Usage
Input File
๐๐๐ The script requires a CSV file named country_codes.csv containing country information, including their Alpha-2 codes. The file should follow this format:
Alpha-2 code,Country,Latitude (average),Longitude (average)
AD,Andorra,42.5,1.6
AE,United Arab Emirates,24,54
AF,Afghanistan,33,65
AG,Antigua and Barbuda,17.05,-61.8
AI,Anguilla,18.25,-63.1667Running the Script
๐๐๐ 1. Ensure Python is installed on your system.
2. Install the required dependencies:
pip install requests beautifulsoup4- Place the
country_codes.csvfile in the same directory as the script. - Run the script:
python waypoint_scraper.py
- The script will generate a single CSV file named
worldwide_waypoints.csvin the same directory.
Output
๐๏ธ๐๏ธ๐๏ธ The output CSV file contains the following columns:
- COUNTRY_CODE: Alpha-2 code of the country.
- COUNTRY_NAME: Full name of the country.
- IDENT: Unique identifier for the waypoint.
- LATITUDE: Latitude in decimal format.
- LONGITUDE: Longitude in decimal format.
Example file: worldwide_waypoints.csv
COUNTRY_CODE,COUNTRY_NAME,IDENT,LATITUDE,LONGITUDE
PK,Pakistan,ABC,33.123456,73.987654
PK,Pakistan,XYZ,34.654321,74.321098Scale of Data
๐๐๐ The script successfully scrapes over 51,000 waypoints from across the globe, providing a comprehensive dataset for aviation and navigation purposes.
Error Handling
No data found for <Country Name> (<Alpha-2 Code>).
- If the website structure changes or an error occurs, the script logs the issue and moves on to the next country.
Contributing
๐ค๐ค๐ค Contributions to improve the script or add new features are welcome. Please fork the repository, make changes, and create a pull request.
License
๐๐๐ This project is licensed under the MIT License. See the LICENSE file for more details.
Contact
๐ง๐ง๐ง For questions or suggestions, feel free to open an issue or contact.