Ohio Ballot Drop Box Locator

Drive-through drop box in Hamilton County, Ohio. Image: Cincinnati Enquirer.

The Project

https://bennkeel.github.io/OhioElections/index.html#

Base Screen
Zooming in on the drop box for Hamilton County, Ohio

The Data

The data was compiled in a spreadsheet manually. I used a Beautiful Soup python function in a Jupyter notebook to get the BoE links and navigation directions off the SoS’s site quickly. Getting the lat-long items and the addresses was a manual copy-paste operation, to my spreadsheet chagrin. The drop box images were the hardest to find, as they are either on a Board of Elections’ site, Facebook page, or photographed for a local newspaper — all over the place. Once that was done, the Mapbox studio dataset editor made it very easy to convert to a geojson. Find that geojson here.

View of the data and fields in Mapbox Studio

The Process

Though I’m a professional designer, I am still very much a student of web apps. Using that store locator as a base, here were a number of elements that weren’t in the tutorial that I worked to include:

var boxesconst url = “https://bennkeel.github.io/OhioElections/BoE-Locations-OH.geojson";const updateUISuccess = function(data) {             
const parsedData = JSON.parse(data);
console.log(parsedData);boxes = parsedDataboxes.features.forEach(function(box, i){box.properties.id = i;});/*Rest of Store Locator code here*/}
const updateUIError = function(error) {console.log(error);};
const responseMethod = function(httpRequest) {if (httpRequest.readyState === 4) {if (httpRequest.status === 200) {updateUISuccess(httpRequest.responseText);} else {updateUIError(httpRequest.status + ': ' + httpRequest.responseText);
}}};
const createRequest = function(url){const httpRequest = new XMLHttpRequest(url);httpRequest.addEventListener('readystatechange', (url) => responseMethod(httpRequest));httpRequest.open('GET', url);httpRequest.send();};createRequest(url);
data.features.sort( function( a, b ) {a = a.properties.county;b = b.properties.county;return a < b ? -1 : a > b ? 1 : 0;});
Disclaimer (left) under the listing notes that a voter should be prepared to visit during the office hours of the Board of Election and before the Election Day deadline. Most probably do and just didn’t note it as such online, and a call to the BoE could have clarified this question for me.
function addDropbox(element, confirm, img, source){var dropboxImage = document.getElementById(“db”);var dropboxSource = document.getElementById(“dbSource”);var NoImage = document.getElementById(“imgna”);if (dropboxImage){dropboxImage.remove();}if (dropboxSource){dropboxSource.remove();}if (NoImage){NoImage.remove();}if (img) {element.appendChild(img_create(img, “Dropbox Location Image”, “Dropbox”, “db”));if (source) {var s = document.createElement(‘a’);s.href = `${source}`;s.id = “dbSource”;s.innerHTML = “Image Source”;s.target = “blank”;element.appendChild(s);}} else {var d = document.createElement(‘div’);d.id = “imgna”;d.innerHTML = “Image Not Available”;element.appendChild(d);}if (confirm == 0){var c = document.getElementById(‘Confirm’);if (c){c.remove();}c = document.createElement(‘div’);c.id = ‘Confirm’;c.innerHTML = “Could not confirm if a 24-hour dropbox is available. Please be prepared to deliver ballot to Board of Election office during open hours (see link) or by 7:30pm on November 3rd.”;element.appendChild(c);} else {var c = document.getElementById(‘Confirm’);if ©{c.remove();}c = document.createElement(‘div’);c.id = ‘Confirm’;c.innerHTML = “You can drop your absentee ballot off at a drop box at the Board of Elections.”;element.appendChild(c);}}

The Future

The eventual aim was to make an easy database in case more drop boxes were added through the last month, but the Ohio Secretary of State did not permit more drop boxes off of BoE sites. Features I’d love to add in similar projects are an automatic county locator button, in-app directions, and perhaps a drive time estimate. I’m looking forward to learning more about Mapbox GL JS with future projects.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store