mborsetti / airportsdata

Extensive database of current data for nearly every airport and landing strip in the world, with over 28,000 entries.
Other
84 stars 28 forks source link

[FEATURE] Add possibility to find an airport #16

Open rignaneseleo opened 1 year ago

rignaneseleo commented 1 year ago

Hi, great library. I am wondering if you could implement a function to search for an airport, given the city name, the airport name, the airport code or a portion of them.

Example:

import airportsdata
airports_db = airportsdata.load()

#returns a list of airports in Milan
airports = airports_db.search("Milan")

#returns FCO airport in Rome
airports = airports_db.search("Fiumicino")

#returns Eindhoven airport in Netherlands
airports = airports_db.search("EIN")

I guess you can easily do this by merging airport name, city and airport code and then use .contains(query) on that value. The result is approximative but still valuable I think.

What do you think? Thanks!

mborsetti commented 1 year ago

This is intriguing, if not as part of the package itself (to avoid bloat), as part of the documentation providing a cool example on how to use it. PRs welcomed.