Time Traveling Traffic
Throughout this week, I have been continuing work on the traffic speed visualization program I was previously working on. In my last blog post I had a visualization that showed traffic speeds on streets across Austin; Since then, I have added a few new features to the program, including:
In order to make my visualization tool easy to use, I have been working on developing a user interface so anyone who wants to use the visualization can just input the city and times they want to view. Because the data is visualized using QGIS, the GIS tool Metropia uses, I am making the UI by developing a QGIS plugin. QGIS offers plugins for it's users to provide additional tools in the software, such as generating contour lines on maps or performing Cad like functions. QGIS allows users to develop their own plugins using C++ or Python. Between these two, Python is much more commonly used (especially by beginners), so there is a lot more information online on developing Python plugins than C++ plugins. So, I as plugin beginner, I decided to go with Python, even though C++ is better. Unfortunately, the last time I coded in Python was with Udacity's "Intro to Computer Science" course about three years ago when I first started programming. So, I barely know the language, making the process of developing a tool with it a bit more challenging. Thankfully, Python is just English, which is a language I'm fairly familiar with.
In order to simplify the process of developing a plugin, I used a plugin for developing plugins called Plugin Builder, which created a plugin template for me to just fill in. Initially I created the UI using QtDesigner, which amazing because all I had to do was drag and drop pictures of text boxes and input fields. However my joy was short lived, because with QtDesiner, once the possible input options are determined, they can no longer be changed by the plugin. Metropia is constantly updating the traffic data, so new traffic predictions are constantly being made available. Thus, the times to select from need to be periodically changed automatically. So, I had to hard code it :(
As a result my current UI is horrifically ugly, but it does successfully accomplish it's basic purpose of communicating user inputs to my program that processes the traffic information for the visualization.
At this point, my tool works in three parts:
- Live display of traffic incident locations, such as crashes or roadwork, and highlighting links (roads) which are affected.
- Live display of the driving trajectories of people using the Metropia app.
- Option to move forward and back in time to view incident, user trajectory, and traffic speed data from different times of day.
In order to make my visualization tool easy to use, I have been working on developing a user interface so anyone who wants to use the visualization can just input the city and times they want to view. Because the data is visualized using QGIS, the GIS tool Metropia uses, I am making the UI by developing a QGIS plugin. QGIS offers plugins for it's users to provide additional tools in the software, such as generating contour lines on maps or performing Cad like functions. QGIS allows users to develop their own plugins using C++ or Python. Between these two, Python is much more commonly used (especially by beginners), so there is a lot more information online on developing Python plugins than C++ plugins. So, I as plugin beginner, I decided to go with Python, even though C++ is better. Unfortunately, the last time I coded in Python was with Udacity's "Intro to Computer Science" course about three years ago when I first started programming. So, I barely know the language, making the process of developing a tool with it a bit more challenging. Thankfully, Python is just English, which is a language I'm fairly familiar with.
In order to simplify the process of developing a plugin, I used a plugin for developing plugins called Plugin Builder, which created a plugin template for me to just fill in. Initially I created the UI using QtDesigner, which amazing because all I had to do was drag and drop pictures of text boxes and input fields. However my joy was short lived, because with QtDesiner, once the possible input options are determined, they can no longer be changed by the plugin. Metropia is constantly updating the traffic data, so new traffic predictions are constantly being made available. Thus, the times to select from need to be periodically changed automatically. So, I had to hard code it :(
As a result my current UI is horrifically ugly, but it does successfully accomplish it's basic purpose of communicating user inputs to my program that processes the traffic information for the visualization.
The text box is there because I forgot to delete it. |
At this point, my tool works in three parts:
- A QGIS plugin that has a UI that takes in user input.
- A Java program that pulls the user specified data (from the QGIS plugin UI) from the Metropia server, then processes the information for visualization.
- A QGIS script that re-loads the visualization every time there is an update in the data or user specifications.
Clearly this is an awful design, so my goal is to continue to develop the tool by re-writing most of my Java code into python so everything can be part of the QGIS plugin. Then, when a user opens up the QGIS plugin and enters their specifications, the QGIS plugin will do app the processing and visualization updates on its own without the help of outside programs.