Tuesday, July 15, 2014

Shaprgram: a Govhack entry for crowdsourcing photos of spatial data

#Govhack is over, and I'm still recovering from it. I didn't know what to expect, but ran into Kieran and Chris from the AdelaideRB meetup.

We decided to team up, and kicked around a few ideas.


We got to talking through the ideas and datasets. Some we didn't love, some we didn't just have time for. Things got a bit weird with all of the teams murmuring in hushed tones, protecting their ideas. We decided the point of govhack was openness, so we shared our non starters. I was surprised to see the huge rush of people within milliseconds, obviously stalking the #govhack twitter feeds.

It came down to do a visualisation/data exploration tool or make a reusable tool that improves data. I managed to sway the rest of the team towards reusable tool, pointing out that schema and data production was a complete pain; and anything we built might not survive beyond the underlying data being regenerated.

We spent the rest of the time setting up on #Slack, Trello, Github and more. I sketched out some of the worst looking paper prototypes, then at home early into the AM bashed out a bunch of placeholders.


Exhausted from the early morning work, I crawled in at around 11am to find terrible scaffold turning into a much nicer rails app.
We made a few choices that would come back to haunt us, including using https://github.com/mutablestate/ink3-rails - works great in dev, but absolutely hates being compiled in production mode, as we later found out.

We wrote some CSV and Shapefile importers, working with rgeo and postgis to add collections of points. Chris pointed out postgres' JSON field support solved one of the flexible schema problems we had (I was dreaming up nasty hacks and ways to kick ActiveRecord square in the pants), and by mid afternoon we had a pretty good prototype working.

A stampede took place, and all of the other teams vanished before we knew what was going on. 

I took the chance to catch up with Alex, and we got talking to some of the data.sa.gov.au folks. 

I found this pretty valuable - we touched on some of the reluctance to open up data that exists, the need for productive narratives & collaborations to highlight the value of open data, and the need for data set requests.

Chris was bitten by the urge to work into the early hours, and pushed us a lot further along.

When I got home, I thought we were looking pretty good - at least until I demo'd it to a non developer. Nothing like a live demo to find bugs.


The final day - it came down to polish and deploy, which turned out to be a lot harder than it should have been.

Due to the previously mentioned asset compilation problems, there was frenzied cursing and kicking of the asset pipeline; as well as a fair bit of effort being put into infrastructure. I'd started out with a bit of chef to cook a machine, but found the change/deploy/test loop was tedious.

A few cosmetic and usability fixes were done, our team video recorded, and then disaster: most of the data sets we chose were in arbitrary reference systems (GDA94, etc), and we'd accidentally broken our transformations into WSG84.

Literally in the last 10 minutes, we ended up live editing to strongly encourage WSG84 friendly data sets to be added and to prove our code was happy end to end.


Shaprgram is live, if a little buggy. It lets you take any dataset in WSG84 hosted on a data.*.gov.au site and crowdsource photos.

Here's our entry - don't forget to vote!

Who's this for

Shaprgram is aimed at government data producers who may not have the full resources of a geospatial team at their beck and call, who need to crowdsource information about their assets; and anyone that can benefit from visual imagery to supplement raw data.

Use cases

Adelaide City Council produces a number of data sets regarding picnic sites, which is published on their website and as open data. Unfortunately no one was able to snap a few photos at the time, and google streetview doesn't reach these places.

Using this tool, anyone with a shapefile or CSV can put up a list of assets that need photographs, and download a simple .zip file with an enhanced dataset.

Asset tracking

Just spent a few hard earned rate payer dollars on nice new benches? Use this tool to capture a visual representation of the asset at the time of installation; and during routine tasks - letting you see how your assets survive in the wild, when they need repair or more.

Much more

  • Parking spaces & restricted parking - all parking inspectors carry cameras, making it trivial to document your city
  • Signs - need to capture the signed speed limits across multiple authorities? Use this tool to complete your dataset
  • Tree health - Let members of your community tell you when a tree is ill, growing too much or more - find out *before* it becomes a costly issue to rectify.

No comments: