Python Live Transit Data on Map on Web Subdomain

A rather long video but I wanted to display a map from a Flask App in a subdomain on the web. The map shows the transit route of a bus for Metlink in Wellington NZ and uses the General Transit Feed Specification structure for its API. On the map it shows the route of the bus and the stops along the way. There is a blue pin showing the current location of the current active bus on the route that is updated every 5 seconds and that can be paused/toggled by a button and also there is a button for getting the time for the next bus that is going to a specific destination.
In the video it:

1. walks through the API and the process for setting up the scripts

2. setting the app up on a subdomain on my VPS (Virtual Private Server) on windows with IIS.

3. Discussion of conflict with having 2 flasks apps running simultaneously on the same domain and ways to resolve the issue (mine was to combine the 2 apps into 1)
References were made to the following links:

  1. My Map
  2. Google Map API
  3. Metlink
  4. Metlink Developers portal
  5. General Transit Feed Specification
  6. http://web2py.com/
    • https://www.pythonanywhere.com

Here is link to the files:

  • https://drive.google.com/drive/folders/1NTBPq-0nx_4mWKHZh-Ewb50fVWKjoFXJ?usp=sharing
  • NOTE: The scripts wont work as they require:
    • 1/ A google s Map API key
    • 2/ A Metlink Developers API key.

Background

The philosophy of this app is to extend the process of the previous video where I remotely trigger a python script process that has multiple steps.

Instead, why not have the python scripts create something directly in the browser, as an app, rather than a lot of background processes culminating in an email with a pdf attachment?

So this process was explored, using API call for data and then processing that data and giving live information directly to the web page.

So the app needed to be built and then the process of hosting it needed to be developed.

End comment

I was pleased with the result, it now allows me to get up to date data without filling my inbox with a lot of unnecessary emails.

Now I have a process I can extend it to other projects. In this project I used a background map, in the nxt I want to use other visualisations such as charts and tables.