Mutual Destination Mapper (1.0?)
Project - 06.05.19
FILE TO BE UPLOADED. Note, you will need your own Google Maps API key
Using Python, the potential destinations available to 2 travelers leaving from 2 lists of airports are plotted on Google maps. The destinations are coloured to show if the destination is mutual, only for traveller 1, or only for traveller 2
Finding mutual destinations for people travelling from different locations can be time consuming. The task is made more complex when each traveller can depart from multiple airports (for example, someone living in Glasgow would consider flying from Glasgow International, Edinburgh, and Prestwick). This script tabulates all the destinations available to each traveller and then plots them all. Mutual destinations are indicated in gold, and detinations available to only one traveller are indicated in either blue or red.
The "destinations" being plotted are the airports, the locations of which are there latitude and longitude. By plotting all destinations (and not just mutual destinations) places which the script does not pick up as "mutual", but are clearly good options for the travellers, are easily identifiable on the map.
The airports and route data used in the script are kindly supplied by openflights.org. As such, this is the limitation of the maps produced. Many routes are missing from the database or the routes shown may no longer be in operation. After all, airlines will drop or pick up destinations all the time and many people around the world make their living from keeping on top of this information. The maps produced can still be taken as a good starting point for planning a trip.
An example is shown below. This takes the first traveller's airports as Glasgow Int, Prestwick, and Edinburgh (BLUE). The second traveller's airports are Bristol and Cardiff (RED). Mutual airports are in (GOLD). Click on the image to explore the map (pan, zoom, and get information from each destination).
The Code
The Python script makes use of the following modules:
- Pandas: Used to tabulate and quickly access all the data. This project has been a good teacher in properly utilizing data structures.(note Pandas runs ontop of Numpy, so that will need to be imported as well)
- Bokeh: Used to map the data. Note that using Google Maps will require your own Google Maps API key. These can be obtained for free, here.
Improvements/Next Steps
This project has introduced a lot of new concepts to me. As such, there are some obvious improvements which were not undertaken in order to get a working script out as well as future directions the script could be taken in. These are:
- The airport IATA codes (3-letter airport identifiers, ex. London Heathrow = LHR) have to be typed in as arguments. Whilst the script does include a GET_IATA function, it would be easier to type in the city as the argument.
- The hover info panes could be improved to indicate exactly which airport(s) fly there (which is an issue if any of the traveller's have multiple airports listed).
- The quality of the underlying data needs improved. QA using Glasgow International as shows quite a few missing destinations. In conjunction with the next point below, future scripts could potentially scrape flight data from the web.
- Whilst the map is a good starter, there are more factors in choosing a destination such as cost, when the fligts arrive and depart with respect to one another, travel duration, airline preference, and so on. The next step (which is a huge step) would be to collect real future flight data and analyse it against these factors.
- Highlighting other tourist destinations which are nearby would also be useful. Potentially, a radius of X km could be drawn around each point (say 100 km, 1.5 hrs of driving). Where traveller 1's area overlaps with traveller 2's could then be indicated. Alternatively, a database of tourist locations/cities could be used, filtering through them by proximity using the haversine formula.
- Start the map at the middle of all points, rather than Europe. Users could quite easily miss destinations outside of the initial displayed area.