Airports¶
- class Airport[source]¶
Bases:
objectAn airport looked up by ICAO code from the OurAirports dataset.
Lazily initializes global 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 longitude¶
Longitude of the airport.
- property latitude¶
Latitude of the airport.
- property geometry¶
Shapely Point geometry of the airport.
- property icao_code¶
ICAO code of the airport.
- property iata_code¶
IATA code of the airport.
- property name¶
Name of the airport.
- property country¶
ISO country code of the airport.
- property municipality¶
Municipality of the airport.
- property elevation¶
Elevation of the airport in meters. Returns None if not available.
- property elevation_ft¶
Elevation of the airport in feet. Returns None if not available.
- property runways: pandas.DataFrame¶
Runway details for this airport as a DataFrame.
- initialize_data(countries=None, min_runway_length=None, runway_surface=None, airport_types=None, cache_dir=None, refresh=False)[source]¶
Initialize global variables for airports and runways data with filtering options.
- Parameters:
countries (
List[str]) – ISO country codes to filter airports by.min_runway_length (
int) – Minimum runway length in feet.runway_surface (
Union[str,List[str]]) – Runway surface type(s) to filter by.airport_types (
List[str]) – Airport types to include (default: large, medium, small).cache_dir (
Union[str,Path]) – Directory to store downloaded data files. Defaults to ~/.cache/hyplan/.refresh (
bool) – If True, re-download data files even if they already exist.
- Return type:
- find_nearest_airports(lat, lon, n=5)[source]¶
Find the N nearest airports to a given latitude and longitude.
- 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.
- get_airports()[source]¶
Get the globally initialized GeoDataFrame of airports.
- Return type:
GeoDataFrame
- get_longest_runway(icao)[source]¶
Return the length in feet of the longest runway at the given airport.