I spent part of my Saturday at the #HackGoesOn, one edition in a series of hackathons that aims to extend the efforts sparked from Open Data Day in Toronto. I think the concept is really rad; thinking about the utility of hackathons and considering how easily efforts and projects are turned into one-offs that don’t go anywhere. The data peeps are making a good effort to continue conversations and projects over the long(ish) term.
I’m interested in transit and City Hall so I joined the TTCriders group. TTCriders is documenting how city councillors vote on TTC issues in hopes that this information will spark some civic engagement among advocates. They have some static maps made already and the political divide is pretty interesting (or frustrating, or both). The following one concerns a council vote to save 41 bus routes throughout Toronto. Green is a yes vote, red is a no vote. This map was made by Jonah Guo.
So the goal is to have an interactive map where people can select the council agenda item they wish to view. The respective council votes will turn on and people can hover or click to get a pop-up with councillor information; name, photo, email, phone number, what have you. Pretty simple, right? Sounds simple. I volunteered to make it… so I hope it’s a tackle-able challenge.
I started with finding a KML of Toronto wards on the DataTO group and converted it to GeoJSON using Ogre. Then I didn’t know what to do with it… and decided I needed to take a step backwards.
Going through Lyzi Diamond’s Learn GeoJSON tutorial I learned some things and played around with geojson.io and forked my first repo ever! I noticed I could save as a GeoJSON file on geojson.io, so I copied my wards GeoJSON code into there and everything worked out really nicely. Here it is on gist. I need to clean up the attributes, which at this point I think I have to do individually for each ward–I’m not sure if there’s a quicker way. Then I need to plug it onto my Leaflet map.
My Leaflet map! I went through Lyzi’s Leaflet presentation, which I found to be real simple, probably thanks to some experience with the Google Maps API. I got a basic map up and running locally but I’m not a fan of the standard OSM tiles for this project. I’m playing around with some others. I like Mapbox streets but I think I need to use mapbox.js to get those? Or have tiles in my account? I think I need a ‘sidewalkballet-xxxxxxx’ key or something but I haven’t figured that out yet.
I made a repo to try and store the code online but I dunno if that was for naught or not. Trying things out.
So next: learning to add GeoJSON to Leaflet.
