Election map for DC's 2014 general election
JavaScript CSS HTML Ruby
Latest commit ad97821 Mar 6, 2015 @cmgiven Adds civic.json (#2)
Permalink
Failed to load latest commit information.
css
data
img
js
.gitignore
CNAME
civic.json
index.html
license.txt
readme.md
update-data.rb

readme.md

Created by Code for DC. Published as a public domain work under the CC0 License.

So you want a election map?

You will need

  • A topojson file showing the boundaries of voting districts in your jurisdiction. You'll probably need to find a shapefile (.shp) of these boundaries, perhaps from a board of elections or government data portal, and convert it to the topojson format (look in the 'Converting Data' section of this useful tutorial). Save this file as data/precinct-boundaries.json.
  • A Google Spreadsheet matching the format of this one, but with your own candidates and results. A starting point for demographic data about voting districts is the US Census Bureau's American FactFinder website, where you'll need to select the geographic type 'Voting District' from the advanced search interface.

You can easily customize

  • The header and footer in the index.html file.
  • The Google Analytics tracking code in the index.html file.
  • The location of your Google Spreadsheet in the update-data.rb file.
  • The REFRESH_DELAY in the js/main.js file to enable automatic refreshing of data.
  • The TOOLTIP_DESCRIPTION in the js/main.js file to customize how a voting district is identified with additional information from the vtd spreadsheet (i.e. to describe "Precinct 48" as "North Springfield").
  • The AVAILABLE_FILTERS in the js/main.js file to customize the filtering options based on the data you have available.

To get started

  • Easiest way to host the map is by using Github Pages.
  • Run the command ./update-data.rb from the project directory in order to grab the latest data from your Google Spreadsheet (you'll either need a Mac or need a Linux machine with Ruby installed). Alternatively, you can download your Google Spreadsheet as a CSV file and replace the data in the data/ directory.