Example #1
0
header = ['airport_iata','name','iatacode','icaocode','delayindex_arrivals','delayindex_departures','stats',
          'latitude','longitude','elevation_m','elevation_ft','timezone_name','timezone_offset',
          'timezone_abbr','timezone_abbrname','url_homepage','url_webcam','url_wiki','img_src','img_link',
          'img_source','visible']


file = open('airport_info.csv', 'a+', newline ='')
with file:
        writer = csv.writer(file)
        writer.writerow(header)
        file.close()

final=[]
for airport in airport_iata:
    try:
        details=api.get_airport_details(airport)
        #weather=api.get_airport_weather((airport))  
        #add this - imp
        name=details['name']
        
        iatacode=details['code']['iata']
        icaocode=details['code']['icao']
        delayindex_arrivals=details['delayIndex']['arrivals']
        delayindex_departures=details['delayIndex']['departures']
        stats=details['stats']
        
        latitude=details['position']['latitude']
        longitude=details['position']['longitude']

        try:
            elevation_m=details['position']['elevation']['m']
Example #2
0
    if not alist : iataerr();
elif query == 2 : 
    if nmax == 0 :
        alist = api.get_airport_departures(airport);  # Return: a JSON dictionary of xxxxx
    else :
        alist = api.get_airport_departures(airport, page=1, limit=nmax);
    if not alist : iataerr();
elif query == 3 : 
    try: 
        alist = api.get_airports(country);            # Return: a list of (name,code) tuples. # api.get_airports('India')[10:15]
    except AttributeError :
        airerr();
    if not alist : airerr();
elif query == 4 : 
    try: 
        alist = api.get_airport_details(airport);     # Return: 
        blist = api.get_airport_weather(airport);     # Return: 
    except AttributeError :
        iataerr();
    except TypeError :
        typerr(); iataerr();
    if not alist or not blist : iataerr();
elif query == 5 : 
    try: 
        blist = api.get_airport_weather(airport);     # Return: 
    except AttributeError :
        iataerr();
    except TypeError :
        typerr(); iataerr();
    if not blist : iataerr();
elif query == 6 : 
Example #3
0
# -*- coding: utf-8 -*-
"""
Created on Sun Dec 18 21:05:56 2019

@author: mzly903
"""
# -*- coding: utf-8 -*-

import gmplot 
from pyflightdata import FlightData

f=FlightData()

AKL = f.get_airport_details('AKL')

HRK = f.get_airport_details('HRK')
  
latit_AKL, longit_AKL = AKL['position']['latitude'], AKL['position']['longitude']

latit_HRK, longit_HRK = HRK['position']['latitude'], HRK['position']['longitude']

latitude_list = [ latit_HRK, latit_AKL] 
longitude_list = [  longit_HRK ,longit_AKL] 
  
gmap3 = gmplot.GoogleMapPlotter(latit_AKL, longit_AKL, 73) 
  

gmap3.scatter( latitude_list, longitude_list, '# FF0000', size = 40, marker = False ) 

gmap3.plot(latitude_list, longitude_list, 'cornflowerblue', edge_width = 2.5) 
  
Example #4
0
 def __init__(self, airport_dep, airport_arr):
     f = FlightData()
     self.airport_dep = f.get_airport_details(airport_dep)
     self.airport_arr = f.get_airport_details(airport_arr)