X-guy

The X-guy, who fights a never ending battle for truth and justice, and always takes the CTA instead of flying or driving in the city.


This application is basically a interactive map of Chicago, where you can fly around and check crime and traffic information within it.

This map tracks the real-time Chicago L lines train tracking information. So any train showing on the map should be the actual location they are at right now. The map also visualized past Chicago crime records that pre-downloaded from City of Chicago Data Center. You can filter certain those records to get a more brief view or you can aggregate all data on the map for an overview. I also used some past crime records to simulate a real-time crime monitor system. So our virtual hero can find somewhere to go instead of hanging around the city with his skin tight jeans.

road

Credits

1. Real-time CTA-L-line train tracking information comes directly from CTA with their developers’ API

From their API, a developer can get a xml file with detailed information regarding all active trains on a specific line. I use their train id to track each train and update its position every 20 seconds. I attached the train id with the train in the map, in order to give a sense motion for the observers.

communities

2. Community names and boundaries, crime records, CTA-L-line route and stations information come from Chicago Data Portal.

For communities’ boundaries and names, I extract the information by parsing a xml file, connects all points along the edge of each community and put its name in the middle. The only issue with this is, some points on the edge stays too close and the omegalib seems to complain a lot about it.(not necessarily identical, even when they’re just close together.) So I did set a threshold to eliminate this problem. And actually it makes the line looks better since it kinda smooth it out.

For crime records, I built a MySQL database and loaded filterred records into my laptop. And I can access the data through a mysql connector for python. This approach did save some start up time for me, but I have to handle with the lag from communication. That would be talked in details later.

Installation

The script for this application is only the testTrain.py under ./app/. You can run it through orun -s YOURDIR/app/testTrain.py

However, there are couple files used along with it.

1. You need the two ./app/chicago_yahoo(_sat).earth for yahoo’s map API.

2. You need the ./app/utm and ./app/utm-0.3.0 for coordinates transformation.

3. You need all files under ./app/Data to build the whole city with two exceptions: i. You don’t need ./app/Data/Sky or ./app/Data/Skybox. Sorry I’m just being too lazy to delete it; ii. You don’t need most files in ./app/Data/crime/ except the communityCode.csv. Since all data are pre-loaded into the database, but you might want to use those files to initialize your database and put some data in there.

Usage

Navigation

I disabled the built-in camera control. But the one I put in there is similar to the original. I just changed the rotation a little bit. Now the camera cannot rotate along its local y-axis, instead you can only do x-axis and z-axis. Note: You can also use keyboard if you really want to controls are (wasd)(rf)(ijkl)

trains

Menu

Right click to open the menu. In side the menu you can quick jump to the overview of the scene by clicking overview, or go to different communities by clicking community and pick you destination in the popup menu

You can switch between different map layers by clicking the map. And there will be a set of radio button for you to choose from “road map”, “satellite” or “none”.

saterllite

Clicking the option, you can control what’s updateing in the map. Including trains tracking, crime displaying and communities displaying.

Crime filtering gives you the freedom to choose the updated crime information. In this application, the database loading and displaying can be at different phase. Even the user choose not to display the crime data. The system is still trying to load it. And user can choose which data to be pre-loaded (or not load at all). You can combine the filter condition with its year or type

The real time crime simulation uses the past data to pretend a real time situation. Because of the sparsity of the crime records within the time slot. I build a display panel on the top left to tell the user about the information of ongoing crime. So they can use the quick jump to go to the district and easier to observe crimes.

Source and Video

github_source
YOUTUBE

Fun Stuff

1. There’s a trade off between the loading time and responding time. to make the program faster to launch, I decided to use database to preload the data and retrieve the data dynamically via runtime.
This approach kind reduces the start up time that the application would need. However, it still takes a long time to load models inside the application.
There is a guy using shader to load the data. That is really awesome. It speeds up the process of generating models and it provides infinity capacity of objects displaying at the same time.

2. For Python, people like how flexible it could be. That’s exactly how I feel when I get started. However, there’s a really interesting issue I happen to came across.
I have this code working on my PC. And I’m quite happy about that. However, when I run it in the CAVE, something goes wrong and feels really strange. Cause I always question myself. So I keep checking my buggy code trying to find out some problem. It take me 5 hours and I missed the project due.
Turns out to be that on Windows, you are allowed to use a += operator between a None and list. However, on UNIX machine it’s not allowed and there will be an error throwing out. Unfortunately, it happens in my slave node instead of my master node so I didn’t even notice it until the last minute.