• Oct
  • 30
  • 2010

PHP Library to Draw Election Results on a Map

by Andrew Kandels

I am releasing PHPStateMapper 1.0.5, which includes a new class called PHPStateMapper_Election for reporting election results (just in time, I know).

PHPStateMapper Preview

Loading

Loading data in is easy, either by chaining calls in PHP or by importing a CSV file. The results are outputted into a PNG file (as shown above). You can choose the colors and size of the file.

Custom Maps

Obviously, the default U.S. state map is more suited for a presidential election, so another new feature is the ability to load custom maps. A map need only be a PNG file with specific colors for the regions within it. More information is available on the project page. World and continent maps will be available in the next release.

Vector Images

Finally, Ive recreated the existing maps so they render a little cleaner in different sizes. The output is now a little sharper.

Let me know what you think or if you have any ideas for future development. Finally, you can download the library on its GitHub project page.