Creating Political Maps, Part 2

Over the past several months, I have been running a website, http://localpols.fordean.net which lists various progressive candidates. As the list has grown, I’ve been looking for ways to improve the navigation of the site. I set up a simple clickable map so you could click on a state to find specific candidates. I have expanded this to be able to click on the district level, for example, http://localpols.fordean.net/CTStateSenate

I wrote about my initial attempts at this here. As I mentioned then, people had suggested that I check out Mapserver. In theory, it is supposed to work with IIS. However, when I tried using it with IIS on my server, no matter what I did, I kept getting, “CGI Error
The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are:”

This is an error message that has often been reported for various systems, but I have yet to find a way to get around this error.

I am not all that proficient at configuring my Apache servers, so I may not have set up MapServer as optimally as possible, but my test Mapserver is now up at http://ahynes1.homeip.net:7778/cgi-bin/mapserv.

My first pass was to try and take some of the shapefiles that I’ve gathered and put them up on the MapServer. The first problem I ran into in doing this was trying to find the appropriate ‘extent’. In the end, I used ArcGIS to check the properties of the themes and that has worked pretty well. Does anyone know how to find the proper extent of a shapefile using open tools?

I gathered redistricting shapefiles for several states and have put them all up on my Mapserver. A second problem that I’ve run into is that different shapefiles use different formats for the extents. Some of them are simple lat/long. Others seem to be lat/long times 10,000, still others on some other scale. Given this, I don’t think I can easily mix and match state shapefiles. Does anyone know how to change the scale that is being used, so, for example, they could all be simple lat/long?

My next step was to start playing with MapClient. The simple MapClient stuff seemed to work pretty well. I cut and pasted parts from their examples and set up my first little version, http://ahynes1.homeip.net:7778/mapclient/examples/test1.html This displays the different maps for the states that I’ve retrieved data.

When I set this up, I used server frames. I didn’t want a separate floating window created by Javascript. Unfortunately, when I tried porting that code into Drupal, I started getting errors. So, I’m on hold with the Drupal porting for a little while.

I then tried some other software. PHP MapScript looks really promising. I downloaded a binary version for Windows. Unfortunately, the MapScript windows binary comes with a lot of junk, which I didn’t want. It would be nice if they had a stripped down version. I’ve installed it, but when I try to run it, I get Unknown(): Unable to load dynamic library C:\PHP\extensions\php_mapscript_42.dll – Access is denied Anyone have any ideas about how to get around that one?

So, I’ve gone back to working with the MapServer MAP definitions. I’m sure that I could write much better map files. Mostly, I’ve cut and pasted from other map files, and slowly been learning how to get them to be a little nicer. My latest version gives me the ability to select different voting districts. For example, take a look at http://ahynes1.homeip.net:7778/cgi-bin/mapserv.exe?map=c:\mapserver\maps\wahoused.map&district=18,20,28,38,39,44. It highlights districts 18, 20, 28, 38, 39, and 44. I’ve also gotten my zooming working with http://ahynes1.homeip.net:7778/cgi-bin/mapserv.exe?map=c:\mapserver\maps\vasenated.map&district=12&mapext=-77.979604+37.376572+-77.224005+37.933055

I’ve used a few maps like this, particularly for Virginia and Washington, to enhance Local Pols

So, with this, I am getting closer. I still have a bunch of questions. They boil down to:

  • How do I get MapServer to work with IIS?
  • How do I get MapScript working with IIS?
  • How do I incorporate this into Drupal (e.g. getting MapClient or MapScript to work)
  • How do I find extents automatically without using ArcView?
  • Is there a nice way to change the scaling?
  • How do you make a section clickable? (I’m currently creating PNGs that I add to Drupal as a client side clickable map)
  • How do you set up a floating tag? (So, when the mouse hovers over a location, it says what the location is. I can do this with clickable maps, and have at Local Pols)
  • How do you make different sections different colors based on specific needs? (I’m doing it with a kludged up map file. I’m sure there must be a better way
  • How do I add a symbol, or many symbols, programmatically?

Any comments are greatly appreciated..

change the scaling

easier/better map files