Airports¶
Airport lookup and selection.
Provides geographic search, filtering by proximity, country, type, and runway requirements using the OurAirports global database.
Data source¶
OurAirports (https://ourairports.com), maintained by David Megginson. CSV data retrieved from https://github.com/davidmegginson/ourairports-data. Licensed under the Public Domain (CC0).
- class Airport[source]¶
Bases:
objectAn airport looked up by ICAO code from the OurAirports dataset.
Lazily initializes airport data on first instantiation. Properties provide access to location, elevation, and runway information.
- Parameters:
icao (str) – ICAO code of the airport (e.g., “KJFK”).
- Raises:
ValueError – If the ICAO code is not found in the dataset.
- property elevation¶
Elevation of the airport in meters. Returns None if not available.
- property elevation_ft: float | None¶
Elevation of the airport in feet. Returns None if not available.
- property runways: DataFrame¶
Runway details for this airport as a DataFrame.
- airports_within_radius(lat, lon, radius, unit='kilometers', return_details=False)[source]¶
Find all airports within a specified radius of a given point.
- Parameters:
- Return type:
- Returns:
List of ICAO codes, or a GeoDataFrame if return_details is True.
- find_nearest_airports(lat, lon, n=5)[source]¶
Find the N nearest airports to a given latitude and longitude.
- generate_geojson(filepath='airports.geojson', icao_codes=None)[source]¶
Generate a GeoJSON file of the airports using GeoPandas with CRS explicitly set to EPSG:4326.
- get_longest_runway(icao)[source]¶
Return the length in feet of the longest runway at the given airport.
- initialize_data(countries=None, min_runway_length=None, runway_surface=None, airport_types=None, cache_dir=None, refresh=False)[source]¶
Initialize airport and runway data with filtering options.
Downloaded CSVs are cached and never auto-refreshed; OurAirports publishes updates daily, so pass
refresh=True(or delete the cached files) to pick up new data. A log hint is emitted when the cachedairports.csvis older than ~30 days.- Parameters:
countries (
list[str] |None) – ISO country codes to filter airports by.min_runway_length (
int|None) – Minimum runway length in feet.runway_surface (
str|list[str] |None) – Runway surface type(s) to filter by.airport_types (
list[str] |None) – Airport types to include (default: large, medium, small).cache_dir (
str|Path|None) – Directory to store downloaded data files. Defaults tohyplan.terrain.io.get_cache_root()(~/.cache/hyplan, overridable via theHYPLAN_CACHE_ROOTenvironment variable).refresh (
bool) – If True, re-download data files even if they already exist.
- Return type: