Dem. Nom. Margin   Rep. Nom. Margin
>40% 20%-40% 0%-20%   0%-20% 20%-40% >40%
             

Alabama Votes by County 2008

Converting the voter data from an Microsoft Excel Spreadsheet and and comma delimited text file into an online IBM DB2 database using Microsoft Access was the biggest challenge for me in this project. I suspect that my lack of experience with Access was most of the problem. I was able to write SQL to append from one table to another, but not to an online table. Eventually I was able to use Access's export table function to connect to an ODBC database online, but the export function required that I export from a comma delimited text file so that I could control the data types created in DB2. Creating the PHP script (view text file) was fairly straightforward and led me back to the database to correct data types several times. The Javascript programming portion of the project was also challenging mostly in debugging the loop that parsed the data from the PHP created XML.

This mashup could be improved by making the polygons clickable so that they displayed voter data in an info window when clicked from the map or from the sidebar. This was outside the absolute requirements of this project, so I will save those improvements for my first real application of these concepts on a City site. I also discovered the Math.round() function before toFixed(), so I used a cheap multiply by 10, round, and divide by ten technique to get one decimal place in my sidebar, also not worth going back to fix. (These files have been modified slightly to function on my personal website using a MySQL database.)

Valid XHTML 1.0 Strict Valid CSS!