示例#1
0
def getLatLng():
    airports = getAirports()
    d = []
    loc = {}
    with open('airportTolatlng.json') as f:    
        file = json.load(f)
        d = file["data"]
        
    
    
    for l in d:
        if str(l[8]) in airports:
            index = airports.index(str(l[8]))
            lat = str(l[9])
            lng = str(l[10])
            loc[airports[index]] = (lat, lng)
        

    return loc
示例#2
0
def findAllDest(dep):
    '''
    This function will get all available destinations from a given departure location.

    '''
    locations = getAirports()
    orig = len(locations)
    print (len(locations))
    temp = locations.index(dep)
    del(locations[temp])
    #temp = locations.pop(locations.index(dep))
    #destinations = locations.pop(locations.index(dep))
    destinations = locations

    if len(destinations) == orig:
        print("Error: departure location not in database.")
        exit(-1)
        
    print(len(destinations))
        
    return destinations