Saturday, May 27, 2017

GIS Programming Module 2: Python Fundamentals

This week in GIS Programming was a crash course (for me, a welcome review) of the basics of Python syntax and how to manipulate different data types. The lab assignment was to write a short script that began with a string containing my full name, extracted the last name, calculated its length, and ultimately returned the last name and a number three times the number of characters it contains. This output is pictured below:


The steps in the coding process went something like this: assign full name to a variable --> split string into list --> print the last item in the list --> calculate the length of the last item in the list --> multiply it by 3 --> print that result.

Tuesday, May 23, 2017

GIS Programming Module 1: Introduction to Python

Not much to report from the first week of GIS Programming. This week was a very basic overview of the Python scripting language and how the course is going to work. For the first assignment, we were given a prepared Python script to automatically set up a folder tree to be used for file storage throughout the course. All we had to to was open it in PythonWin and run it, but it was pretty neat:


12 folders with more folders inside them, and all I had to do was click a button.

I took some programming classes just for fun a few years ago, so I'm pretty excited to learn more about using Python this semester, and especially how to apply those skills to GIS. 

Wednesday, May 3, 2017

Cartographic Skills Final Project

For very last Cartographic Skills assignment, we were tasked with making a publication-quality map using two thematic datasets and all of our skills from the past semester. I opted to find my own data and make a map with a political theme. Following in the footsteps of other mapmakers who've created election results maps that show politically divided states or counties as shades of purple rather than just the red and blue of the winning party, I mapped the county-level results of the 2012 presidential election using a red-purple-blue color scheme. Then I overlaid cities and towns symbolized according to their population size as of the 2010 census. The point of this was twofold: illustrating the variation that underlies the question of red or blue (in some counties the win was by a large margin; in others it was extremely close), and comparing voting patterns with population distribution in an attempt to investigate that so-called "urban-rural divide" plaguing modern politics.

I focused on Washington, DC and the adjacent states of Maryland and Virginia, partly because it's a region I know well and partly because DC is the capital, and is a major city in region that has both other major cities and really rural areas, so what better place to start looking at how election results map out? If you're wondering why I chose the 2012 election rather than 2016, it's because 1) the data was easily available, already compiled and published by someone else, 2) it happened closer to the most recent census, so the population data seemed more relevant, and 3) 2016 had a lot of surprises and I wanted to start with something that might be a little more typical.

As you can see below, there's a lot of red in those "blue" states, especially in the west, and there's also a lot of purple, which indicates counties where there a lot of Republican AND a lot of Democratic voters. The actual value being mapped is the difference (in percentage points) between the major candidates' shares of the total vote. You can also see that there's something going on with regard to urban areas trending blue and sparsely populated ones trending red, but there's also some areas that don't appear to fit that trend, which is interesting.


Both the main map and the inset maps, which provide close-ups of the most crowded urbanized areas, were created in ArcMap, and the fine-tuning and final layout were done in Adobe Illustrator. I used a choropleth map for the election results, because color is the obvious way of illustrating election results and a choropleth map made a good base to overlay the population data on. The data was manually classified to help simplify a kind-of-confusing legend by using nice round numbers to group the data, although the classes are similar to what ArcMap came up with using natural breaks. Eight classes is kind of a lot, but I wanted to show us much variation as possible rather than just a few classes with huge data ranges (there's a big difference between a 5-point margin and a 30-point margin, after all), and eight classes seemed about the upper limit of what would keep those classes visually distinguishable. For city and town populations, my stand-in for population distribution, I used proportional symbols, which worked better than classed graduated symbols given the huge range in population sizes. I opted to only display cities and towns of at least 5,000 and only label a selection of those, lest the map get too complicated, and I also made the city symbols semi-transparent to help minimize the degree to which they obscure not only each other but the underlying choropleth layer. Finally, I made the city symbols a contrasting color, and made sure everything else in the layout was grey or black to ensure that both bright-colored datasets really stand out.

This project was a lot of work, but I'm please with the result. I've really enjoyed this class and have learned a lot about good map design.