Unloading Zones

Here is a small task that I had been meaning to post about for a couple of weeks now. Our brief was to write a tool that converts a publicly available data set into KML, in such a manner that the information could be interpreted in a useful way when viewed with Google Earth. The dataset I chose was spatial data for loading zones and restricted parking areas from Brisbane City Council, available here. Loading zones are what I was particularly interested in having visualised, with the rest ignored. My choice was between either CSV or JSON, I chose JSON for something different after having already written a working library for my flocking simulator.




As the tool was written in C++, I used rapidjson for parsing of the dataset. I found it to be very powerful thanks to the way objects are exposed and accessed. The conversion process takes place in three main stages, the first being parsing of the JSON file. From here I extracted only the data that was required into an internal format, which consisted of an array of loading zone classes. Wanting to make use of 3D shapes in Google Earth, each class contained an array of coordinates, a type, allotted parking time and a short description. Some manipulation took place to ensure consistency among meta data.

The output process to Google Earth's Keyhole Markup Language was fairly trivial, I exported an almost bare KML file with a 3D placemark and used that as a template. Since each loading zone required the same chunk of tags to represent it, the only differences were the coordinates and meta data. This allowed me to simply write out the start of the KML file, the placemark for each loading zone in a loop and finally the ending tags. A 2D version is available for Google Maps here or you can download the KML file yourself to open in Google Earth.

Comments

Popular Posts