GitHunt
FA

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:

  1. โœˆ๏ธ Air Traffic Management: Waypoints are used by pilots and air traffic controllers to define flight paths, avoiding obstacles and ensuring safe navigation.
  2. ๐ŸŒ Route Planning: They help create efficient flight routes, reducing fuel consumption and travel time.
  3. ๐ŸŽฏ Precision Navigation: Waypoints are integral to satellite navigation systems (like GPS), ensuring accurate positioning.
  4. ๐Ÿšจ 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.1667

Running the Script

๐Ÿš€๐Ÿš€๐Ÿš€ 1. Ensure Python is installed on your system.
2. Install the required dependencies:

pip install requests beautifulsoup4
  1. Place the country_codes.csv file in the same directory as the script.
  2. Run the script:
    python waypoint_scraper.py
  3. The script will generate a single CSV file named worldwide_waypoints.csv in 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.321098

Scale 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

โš ๏ธโš ๏ธโš ๏ธ - If a country does not have waypoint data on the website, the script logs the message: 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.

FayyazAK/Global-Aviation-Waypoints | GitHunt