Alkahest my heroes have always died at the end

October 30, 2008

Computer maps

Filed under: Technical — cec @ 9:17 am

A few years ago, K was taking some GIS (geographic information systems) classes.  That was a lot of fun for me since GIS is something I’ve poked at on and off for quite some time.  Back when I was first playing with GIS, GRASS was probably the best (and may still be) open-source GIS system out there, but it wasn’t too user friendly.  So it was a lot of fun playing with ESRI’s ArcGIS.

But 99% of the time, the things that I would like to do with maps don’t require a full blown GIS system.  The Python toolkit Matplotlib includes a Basemap package and that’s getting closer.  Basemap can read GIS shapefiles, handle coordinate transformations, etc.  But even that’s sometimes too much.  What if I wanted a simple, dynamically computed heat map of the location of website visitors?  Or for the PWC database – the counties from which we receive animals?

Well, the Wikimedia Commons has a map of the U.S. where states are slightly separated to allow for easier coloring.  But that’s again difficult to deal with programatically.  So what I’ve done is to create an indexed PNG image where each state is a different index color.  To color the map, you just load it up and change each state’s color triplet to the appropriate value.

I’m not certain if that’s useful to anyone else, but at least I’ve got it documented here for when I need it.

The associated index of colors to states is here: state-colors

At some point in the future, I might do something similar with a NC county map and maybe a world country map.

No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Powered by WordPress