Skip to content

A simple visualisation of the usage of car parks over one working day.

Notifications You must be signed in to change notification settings

azza-bazoo/parkgraph

Repository files navigation

Parkgraph

Parkgraph is an interactive animation that shows the change in utilisation of car parks in Perth over an average working day.

To view, just open perth.html in any modern browser. Some browsers require the use of an HTTP server, such as staticfiles.js.

Besides the fairly simple data-wrangling scripts described below, most of the interesting code is in parkgraph.js.

(I'm Hourann Bosci and built this in the lead-up to GovHack Perth, mainly as an excuse to learn about D3.js.)

Not-so-frequently asked questions

Why Perth?

As the GovPond folks say, we're all liberationists in Western Australia, fighting for secession!

Perth is actually unique among big Australian cities in having a large percentage of central-city parking in public ownership (only Adelaide comes close). What's more, the City of Perth is one of the few parking operators anywhere that publishes live availability online.

Something similar could easily be done with San Francisco's very cool SFpark system and its (complex) API. Or maybe you could somehow crunch data out of the many places that have Streetline-based systems.

Why car parking?

Mainly because it's urban data available online in an easily-scraped format.

It would be cool to overlay the parking statistics with other measures of city busy-ness, like tag ons and tag offs at train stations, or traffic on major bike routes -- if only that data were available.

Here are some similar efforts: Lisbon, London, Copenhagen, Madrid, Boston.

Do the circles really represent used spaces?

Well, sort of. Each circle's radius is proportional to total_spaces - free_spaces for a car park, and its colour corresponds to the ratio of that value over total_spaces.

But the published numbers don't distinguish spaces that are reserved (for monthly permit holders, etc.), and these show on the map as always in use -- even very late at night.

Generating the base map

perth.json, representing most OpenStreetMap objects around the city centre, can be regenerated with the generate-topojson.sh script. I've included building data for a nicer-looking map, but that can be a problem in browsers with poorer SVG performance.

$ curl -O http://download.bbbike.org/osm/bbbike/Perth/Perth.osm.shp.zip && unzip Perth.osm.shp.zip

$ ~/parkgraph/map/generate_topojson.sh
$ cp perth.json ~/parkgraph/map/

The script requires ogr2ogr, from the gdal-bin package in apt-get or gdal in Homebrew, and topojson from npm.

Running the crawler and generating display data

The crawler is simply a Node application that outputs into the data/ directory. Run something like this via cron:

$ cd ~/parkgraph && node crawler.js

The raw crawl output is a basic mapping of times to carparks to available spaces. To convert this into GeoJSON for display by D3.js, run:

$ node convert_data.js data/crawl-perth-`date +%Y-%m-%d`.json

About

A simple visualisation of the usage of car parks over one working day.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published