FairData
 Google Maps

Resources

Census Issues
CACFP
ESL
Geobase
Projects
Racial Profiling
Redistricting
Socio-Econ
Summer Food
Voter Registration
PL 94 Data
SF 1 Data
Contact/Uploads
Downloads
 More Resources

3/11/06

Polling Places on a Google Map

Three websites provide relatively quick ways to put polling places, voters who need a ride, etc. on a publicly accessible web map (minus the census and political boundary geography). There is currently no charge for these services.

1. Wayfaring.com is an easy way to create an online Google map if you have just a few polling places to map. It does not yet offer a batch geocoding service.

Update: Microsoft's new version of Local Live (released in May 2006 ) is a faster, more reliable alternative -- but there is no batch geocoding feature. See also these examples.

2.  Batch Geocoder  geocodes thousands of addresses and maps up to 100 polling places at a time on the new style Yahoo maps. The map can then be saved for instant online viewing, hosted by Batch Geocoder. Click on a marker's info window and you retrieve driving directions on a Google map. The geocoder also automatically generates a .kml file for importing into Google Earth. Unfortunately, there is no way to edit erroneous geocodes on the saved Batch Geocoder map, other than modifying the original addresses and doing a rerun, e.g. change to 7th and Main instead of  727 S. Main.

Here is a Batch Geocoder map  using polling places for Spartanburg, South Carolina (all polling places geocoded -- of the 91, 11 are matched to zip code only). The geocoding and mapping process took less than a minute.

3.  Mapbuilder.net  geocodes thousands of addresses and maps 300 or more polling places at a time on  Google maps -- but there is a learning curve. The map can be hosted on the Mapbuilder site or on your own.  You must get a free account and then you can access this page,  http://www.mapbuilder.net/import/, which explains how to upload and geocode a list of addresses starting with an Excel .csv file. You can add and delete polling places using map tools. 

Here is a Mapbuilder map for Spartanburg County, SC  hosted on the Mapbuilder site (all sites geocoded, imprecise addresses are not displayed).  

Both Mapbuilder and Batch Geocoder use Yahoo's geocoding service. In some instances, an address match cannot be found and the site is assigned to the center point of the  zipcode or city. These imprecise  geocodes can be identified by geocoding your list a second time based on city and zip only. Coordinates in the initial set of geocodes by address are not precisely geocoded by address if they match coordinates returned for the city/zip geocodes (generated at step 6 on the Batch Geocoder form) A quick way to spot the imprecise addresses is to copy this second list of coordinates into the spreadsheet and subtract them from the first set. City-only or zipcode-only matches will equal 0.00000000..... You can make edits directly to the Mapbuilder map using the add/delete tools -- or use the spreadsheet technique described below.

Interfacing with the FairData Map

The steps outlined below describe how to create a Google map showing polling places (hosted on your website) with a menu link at the top to the FairData census boundary map. Here is a polling place interface map (Poll_base.html) for Spartanburg County. Click on a marker and you get site info and can obtain driving directions. Click on the menu item "FairData" and a new map window will open that shows the census theme. The clickable side bar in this instance is sorted by precinct. Here is a basic Google polling place map (poll_map.html) without the FairData link.

(1)Copy and paste columns A thru F of this Excel spreadsheet  into the Batch Geocoder form at step 2.

(2) Copy and paste the geocoded results back into the Excel spreadsheet from the Batch Geocoder form at step 6. Note that the latitude and longitude coordinates are in columns G and H. Coordinates geocoded to the city or zip level will need to be modified to show the correct site location (see below).

(3) Copy and paste column K in red (a formula)  into a text-based .xml file.  (Be sure to copy the formula to rows beyond 92 if you have additional sites.) You can use a simple text editor like Windows Notepad to create and save the .xml file. The first line of the .xml file must read <markers> and the last line must read </markers>. Click on the .xml file with your browser to determine if it is formatted correctly -- if not, see additional details below.

(4) Replace the key number in the poll_base.html file with your API key. A free Google API license key can be obtained here.

(5) Copy the poll.xml  file (the geocoded addresses) and the poll_base.html file (the map) into the same web directory. The .html file should produce the interface map (with your polling places displayed).

(6) Select "Save View" (above the map) to create a new URL centered on your area, as in the maps below.

Charleston County
Cherokee County
Greenville County 

York County

Additional Details on  the .xml File

1. The .xml file will not load if ampersands -- & -- or slashes are in addresses or names.

2. The .xml file will not load if a cell  in the Excel spreadsheet is left blank, because that creates an error in a formula cell in Column K on the spreadsheet (containing the data for the .xml file.) Just insert an apostraphe -- ' -- in the blank cells.

3. If you need to modify the Column K formula, note that line breaks (for the info window display on the map) are represented by  "&lt;br&gt;"

4. The first line of the xml file,  must read
<markers>
and the last line must read
</markers>

See also Mike Williams' excellent Google Maps API Tutorial.

 Fixing Erroneous Geocodes

The Google maps in these examples have not been edited to fix erroneous geocodes. To make corrections:

(1) Double click on the true location for a site that did not geocode properly.  The point will automatically shift to the center of the map. ( If you prefer a visual marker, the menu item "Center Point" shows a balloon marker centered in a new map window.)

(2) Copy and paste the center coordinates  for the site (shown above the map) into Columns G and H in the Excel spreadsheet

(3) Create a new poll.xml file from the Excel spreadsheet and upload this corrected version to your web map directory.

The poll locations and addreses used in these examples were retrieved from:

http://www.state.sc.us/scsec/precinctsnew.html

Load Time and Display Speed

Google maps load too slowly in Internet Explorer 6.0 once you go beyond about 100 polling places. There are programming techniques to work around this problem, but the easiest solution is to create separate maps for different areas -- preferably under 50 polling places per map. Create different web directories for each map and you can continue using  the file names poll.xml and  poll_base.html.

For a speed check, this map displays 195 polling places in Charlotte/Mecklenburg County, NC (Feb.2006 data) -- all geocoded to the address. With a broadband connection, the map loads very fast with Firefox and not so fast with Internet Explorer 6.0.

 

 

FairPlan    FairData