Adding “Early Voting Wait Time” Information to a Layer in



Tracy Garrison outlines an example of how a “County” might provide current early voting wait times to the public with and coding.  

As a GIS manager for a County in Illinois, I get requests from county departments for some type of GIS application from time to time.  But, sometimes the need for an application might not be apparent to the department at the time.

In Sangamon County, during an election cycle, early voting wait times rise and fall daily and increase as the election day draws nearer.  Sometimes the lines are very long with a wait time nearing an hour.  As I walked back into the County Building after lunch a couple times and saw those long lines, I thought, wouldn’t it be nice if the voter knew in advance what kind of wait they were in for before they parked their car and entered the building?

Initially, I thought about using something like Esri’s Local Government solution “Polling Place Wait Times” that works with the Polling locations.  But we really didn’t need to provide a map showing where the Early Voting location is because it is at the County Building.  We just need to use the wait time to display the approximate amount of time you will wait in line at this moment.

So, my idea was to create a feature layer on that has the early voting polling place information for the County (which is just one feature) along with the normal attributes for a polling location, such as: LocationName, Address, City, State, Hours, WaitTime etc.

Map zoomed to the County building.

Map zoomed to the County building.

I could have created a WDSL service (Web Services Definition Language) using c++ in Visual Studio but I figured why go to all that trouble if I could just use our existing account with a Feature Layer that is actually served as a RESTful Web Service “REST Service (REpresentational State Transfer).

So, that is what I did.  I created the feature layer named “Early Voting Polling Place Wait Time” that only contained our County Building location as the Polling Place with one of the attributes being “WAITTIME” as a type of Integer.  The “Wait Time” is stored and returned in the units of minutes.

Once the “Early Voting Polling Place Wait Time” feature layer was created, I created a “View Layer” from it.  A “View Layer” is a conceptual view of your original layer.  This is needed because your staff will need to edit the value of WAITTIME so you will make the “Early Voting Polling Place Wait Time” feature layer editable and shared only internally.   But, you make the “View Layer” version of that same feature layer as read only and share it publicly.  The Create View Layer is an option that is available from your original feature layer landing page as shown below.

Once I had these two services created I was ready to create a server-side web page that will query the publicly shared RESTful service that was just created.  I thought it would be best if the web page would just return “xx minutes”.  That way, the web page designer who is going to add the number of minutes of wait time to their web page would be able to add it to their page via an <iframe> tag.   Because I want the data to keep refreshing without the user refreshing for me I will also add the refresh meta tag in the <head> section of the page.  I used the javascript api version 3.19 in this example.

The webpage I created was named VoteWaitTime.html (see code below) and I stored it on my local machine in the inetpub\wwwroot directory (I am using a Windows 10 machine with IIS enabled).  See EarlyVoting.html.  Once it is stored in your Website test directory you can use: http://localhost/VoteWaitTime  to view the wait time in minutes that is currently stored in your “Early Voting Polling Place Wait Time” Feature layer.   The VoteWaitTime page queries the REST end point of the “View” of your Feature layer for the value of the field “WAITTIME” and displays that value to viewer (see image below).


The next step is to just create a very basic web page that will be used to show off how this would work to your colleagues.

I created a test web page that will display a heading of some type and then I added a line that reads “Early voting wait time is about:  xx minutes “.   Where xx minutes is actually coming from the VoteWaitTime.html web page we created above.  I do this by adding the <iframe> tag.  (See GetWaitTime.html code below)  Place this file in your IIS inetpub\wwwroot directory.

In your browser go to http://localhost/GetWaitTime and you should see your test web page displaying the Heading along with the wait time text.  This text should refresh every 30 seconds.  The staff can edit the value of the wait time on or via the Collector App.

I have submitted my idea to the County Clerk who, at this time is weighing several different options at this time.  Nevertheless, I feel that that this method will be of use to others or might give you other ideas along the same line.

Early Voting Wait Time Code Examples

The following is the code for the VoteWaitTime.html and the GetWaitTime.html examples.

VoteWaitTime.html Example

<!DOCTYPE html>



<meta http-equiv=”refresh” content=”30″>

<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″>

<meta name=”viewport” content=”initial-scale=1, maximum-scale=1,user-scalable=no” />

<link rel=”shortcut icon” href=”images/favicon.ico” />

<title>Early Voting Wait Times</title>

<style type=”text/css”>



#main {

margin: 0;

padding: 0;

height: 100%;

width: 100%;



<script type=”text/javascript”>

var package_path = window.location.pathname.substring(0, window.location.pathname.lastIndexOf(‘/’));

var dojoConfig = {

// The locationPath logic below may look confusing but all its doing is

// enabling us to load the api from a CDN and load local modules from the correct location.

packages: [{

name: “js”,

location: package_path + ‘/js’


async: true


console.log(package_path + ‘/js’);


<script src=”“></script>


var map;

var resizeTimer;

require([ “esri/tasks/query”, “dojo/parser”, “esri/tasks/FeatureSet”,

“dojo/store/JsonRest”, “esri/tasks/QueryTask”, “dojo/on”,

“dojo/store/Memory”, “dojo/domReady!”],

function ( query, parser, FeatureSet, JsonRest, QueryTask, Memory, on) {

// Define the proxy page for this application. = “http://sangis/DotNet/proxy.ashx”; = false;


// Get rest service for Sangamon County Early Voting Poll Location.

var queryTask = new esri.tasks.QueryTask(“”);

//Define query parameters

var query = new esri.tasks.Query();

query.outFields = [“WAITTIME”];

query.returnGeometry = true;

query.where = “WAITTIME <> 9999”;

//#############################  Run Query  ##############

queryTask.execute(query, myWaitTime);

//######################  myWaitTime Function When query returns a value #################

function myWaitTime(results) {

var waittime = results.features[0].attributes[“WAITTIME”];

document.getElementById(“WAITTIME”).innerHTML = “<b> ” + waittime + ” minutes</b>”;

//dojo.byId(‘WaitTime’).innterHTML = WAITTIME;

console.log(‘Wait Time = ‘ + waittime);






<span id=”WAITTIME“></span>



GetWaitTime.html Example

<!DOCTYPE html>



<h1>Early Voting Wait Time Example</h1>

<h2>This page will display the wait time.</h2>

<h3>in an iframe that is refreshed every 20 seconds</h3>


<span>Early Voting wait time is:&nbsp; <iframe name=”myIframe” src=”” width=”100″; Height=”14″; scrolling=”no”; frameborder=”0″></iframe>  </span>




About the Author

Tracy Garrison is the GIS Manager for Sangamon County, Illinois and has been since March of 2001. He has been a member of the GIS community since 1994.  Tracy is also a licensed Professional Land Surveyor in Illinois and Missouri.


Like this article and want more?

Enter your email to receive the weekly GIS Lounge newsletter: