GIS Mapping: Part I
Hello everyone! Many of us may not love working with data, but the collection and analysis of numbers is a pretty important part of decision-making, especially under the constraints of limited funding. To that end, the visualization of data – that is, creating images that tell your story – can be much more helpful than a spreadsheet in making a convincing argument.
Graphs built in a program like Excel are great, but what if you want to showcase trends based on location? You’ll need a map! Enter Geographic Information System (GIS) Mapping. With a few (free!) tools that are downloadable online, you can create maps to tell your story. Here’s one way to do it, based on information that LSNTAP already had in its Tech Library; next week I’ll be posting Part II of the GIS series, with a different method.
Tools for the job
To write this article, I made a few different maps showing the cases closed by Montana Legal Services Association (MLSA) in 2012. To do so, I used the following tools:
- Google Earth (I had some trouble downloading from that link; if you do too, try this direct link)
- GE Graph (choose the green “Download Now!” button) – unfortunately, it’s only available on Windows
- AFF Mapper (direct link)
- Shapefiles (.shp) downloaded from the US Census Bureau. The link is for 2009 files, but it’s the best set of files I’ve found and unless your state/county’s borders have changed in the last four years, they should be fine! You can also Google search for other sources of shapefiles, but be careful what you download. For more on shapefiles, keep reading.
- Finally, iTouchMap.com is a useful tool. This website will tell you the coordinates of a point if you just enter an address, city, or country (depending on how specific you want to be) at the top of the page. Keep reading and you’ll see why this is so handy!
Using a spreadsheet with data on cases closed by MLSA in 2012, I made three different styles of maps, each showing the same data. I’ll show you those in a minute, but first let’s go through some Google Earth basics, since that will be your main tool.
Google Earth and You
Below that, you have “Places.” This basically toggles on and off the various layers or items you’ll see to the right, in your viewer. As you add layers later on, more items will appear in your “Places.” Notice that some of the items will have a little + or – next to them, meaning that you can expand or collapse the menu to view subcategories. As you create maps, they’ll appear in a “Temporary Places” list. When you quit Google Earth, it will give you the option to save that map as a permanent “Place” within the software. Delete those you won’t use again, like tests – they’ll just clutter things up.
Below that are “Layers.” This is similar to “Places,” but it’s the generalized, Google-provided items. So, while “Places” will have the items you added into your map, “Layers” will have things like borders, roads, geographic features, and historical/cultural landmarks that you can choose to show or not show. Look through some of them – it’s pretty cool!
Across the bottom of the screen are “Tour Guides.” One of the neat features of Google Earth is that you can create virtual “Tours” of places – little videos showing you a 360-degree view of notable places, geographic features, etc. Try clicking on a few of the pre-loaded ones – have you ever been to the Grand Canyon? Check it out!
Finally, near the top right are a few control buttons; a zoom in/out scale, the bottom circle to move, and the top circle to rotate. You can also move by clicking the screen and dragging with the little “hand” instead of your usual mouse.
At the top of the screen are a row of buttons that I didn’t really need. Click on them if you’d like, but you’ve got all you need!
Preparing to make a map
There are two types of maps you can create: point and thematic. Point maps, like the one in the next section (“Level 1”), are a little easier to create because the software doesn’t have to figure out the borders of an area (like the map in “Level 3”); it just has to present data for a number of specific points.
To create either, you’ll need a set of coordinates to feed into the map. To get these, you can either use iTouchMap.com (mentioned above in the “Tools” section) and input each city or location individually to get coordinates; or, you can download a shapefile. Shapefiles (.shp) are a GIS-specific format that describe geography geometrically. To use one, you’ll need to (a) download it, and (b) convert it from .shp to .kml format. I’m about to give you a lot of steps to follow, but it’s not too hard, I promise.
- To find shapefiles, try the TIGER/Line files from the U.S. Census Bureau (mentioned above in the “Tools” section). It will download as a .zip file; right-click and “Extract All” to access the files.
- Then, open up AFF Mapper (also mentioned above). Click “Input Shape” and navigate through the folder structure to the shapefile you downloaded and extracted. In the “Label Field” drop-down menu, choose “Name,” and then “Render.” You don’t need to choose what color the areas on your map will be (in the pop-up box), but you can – you can also change it later. Click “OK,” then when you return to the original screen, choose “Output KML” at the bottom. Choose where to save it, and then click “Go.”
- Within Google Earth, open the KML file you just created. KML files can be opened with both Excel and Google Earth, so it’s a handy go-between. Two layers will be imported from your shapefile and display in Google Earth: Areas (for use in thematic maps) and Pushpins (for use in point maps). You’ll see them under “Places” on the left, and can toggle them on and off. Right click on Areas, then on Pushpins and click “Save Place As…” for each. Specify in the file name which it is – areas or pushpins – and make sure that the file type is KML and not KMZ.
- In Excel, open the Pushpins KML files that you just created in Google Earth. Make sure that you are looking for “All Files;” the default is to only look for Excel files. You’ll get about three error messages when you try to open it; just say “Okay” for all of them. Everything will be fine.
You can delete Column A, since it just says “Pushpins” all the way down. You can also delete the column of pound signs (#). So you’re left with Column A being place names, and Column B being coordinates.
You will need to split Column B into two columns; one latitude and one longitude. The third value in each cell should be a 0, which indicates altitude (don’t worry about it). Highlight Column B and choose “Text to Columns.” (In Excel 2007, this is located in the “Data” tab, in the “Data Tools” category). You want it to be “Delimited” instead of “Fixed Width” (then click “Next”); and you want the Delimiter to be a “Comma.” Click “Next” again, then “Finish.” You can delete Column D since it’s just zeroes.
Change the names of each column to Location, Latitude, and Longitude. You should also switch Columns B and C, so that you have Latitude and then Longitude. Add a fourth column to the right – this will be your value input – your actual data. However, you might want to save the spreadsheet without values first, so that you can use it again for other things. Add your values and save; later, you can copy and paste from your spreadsheet directly into GE Graph.
Dealing with the Areas file was a bit trickier, at least for me. The file is much larger and more complicated, so opening it in Excel takes a long time. What I found to be easier is just to import it directly into GE Graph (the next step, below), and to manually add my data values.
Level 1: A flat, point-based map.
Starting in the “Graph Type” box, click “Flat,” and choose how many sides you want your data-representing shapes to have – in the example above, I used 50-sided polygons, which basically look like circles.
There are two ways for these flat circles to represent different values in different parts of the map: their size and their color. In each of the “Size” and “Color” toggles, choose how you want data to be displayed: by variations in color or size, or variations in both. I chose to have variations in both and selected “According to value” in both boxes.
Below that, choose what colors you’d like to use, either from the pre-made color scales, or with a custom color scheme. You can also choose whether or not to show the scale in your final map (“Show scale in GE”) and create your own minimum and maximum values for colors (uncheck “Automatic scale” and input values below it).
In “Grid,” you can choose to display grid lines on the map in a color of your choice – you probably won’t want to do this, but it’s available if you do!
On the top right, you can give your map a title; first and second lines are available and you can set the color, font, and choose whether or not to show your title on the final map.
Below that, “Value Transform” will alter values to make differences more apparent. For example, my MLSA data has several counties where very few cases were closed, and several counties where several hundred cases were closed. Without choosing one of these “Value Transform” items, I get a map that has some counties displayed in white (my minimum value) and some counties displayed in navy blue (my maximum value). The scale is so wide that it only really shows extremes. To get a more nuanced view, I chose “Log (value + 1).”
The other toggles I mostly left alone, except for “Color” and “Labels.” In the “Color” box, you can choose whether or not to give your data-showing polygons (for lack of a better name) an outline. Remember, they’ll be colored according to value based on the color scheme you chose under “Color scale,” but if you’d like to add an outline as well, you can do that here. In the “Labels” box, choose whether you’d like the place name (in my case, county) and/or the value ascribed to it to appear. It can get a bit busy if you have both, so experiment with it and see how it looks.
Finally, you get to the most important part: the data itself (you can also input data first; it doesn’t really matter). This is where you’ll use the “Pushpin” map that you created in the previous section (“Preparing to make a map”). Make sure that your columns are in the following order: place name (in my case, county), latitude, longitude, and value. Make sure that the order is correct or the data won’t import correctly (yes, they’re in a different order in GE Graph, with place name following longitude, but somehow it all works out). Copy and paste it into the GE Graph window (use the “Paste grid from clipboard” option).
Once everything is set, click “Run” (it’s next to “File” at the top left). It will ask you to save the file before it shows you what it looks like. You can always go back, however, to edit and re-run it – just replace the file you already created until you’re satisfied. From here, I took a screenshot to turn the map into an image file; also make sure to save it when you quit Google Earth so that it will be added to your “Places.”
Level 2: A three-dimensional, point-based map.
Creating a map like this is basically the same as creating the previous, two-dimensional type. Simply click “3D” instead of “Flat” at the top left. You’ll have a “Height” option added to “Size” and “Color;” treat it the same way. You can also choose the size of the bars in your graph – I chose 10 miles across, but if you’re in a smaller state, you might want something smaller. Run it and see how it looks; you can always come back and tweak it!
You’ll also have to do a bit more angling of the Viewer to get a view of your data that makes sense. It can be hard to find an angle that works as a static image for this type of map – bars are always overlapping each other. I couldn’t find a way to embed the map in a webpage, so that the user could manipulate it; if you know how, let us all know in the comments!
Level 3: A two-dimensional, thematic map.
Again, you’ll basically be following the same steps as outlined in Level 1; just make sure to select “Flat” and input the data from the Areas KML file into the spreadsheet part of the window.
If you’re using labels, they may be floating mysteriously above the Earth’s surface once you open the map in Google Earth. If this is the case, there’s a pretty easy fix: right-click on “Names/Values,” and choose “Properties.” In the “Style, Color” tab, force your labels to “Share Style,” and in the “Altitude” tab that appears, choose “Clamped to Earth.” For one reason or another, Google Earth likes to make these labels “Relative to Earth” and float them miles above the surface, resulting in distortions when you try to view them.
One of the neat things you can do with GE Graph is to combine thematic and point maps. If you create both, with each one representing different variables, you can layer them in Google Earth – just by clicking the little checkboxes next to each – and you’ll get something like this:
In this case, both sets of data (the 3D bars and the thematically-colored counties underneath) are representing the same thing: the number of cases closed in that county. But, there are probably lots of ways to use a layering feature like this – maybe cases closed vs. poverty level, for instance.
You can also layer maps to show county or other borders when you’re using a point map, like this one. Just don’t add any data to the Areas map and make it slightly transparent (using the tool between the “Places” and “Layers” window in Google Earth). Then add a point map, and presto! Borders.
In any case, there are a lot of ways to use GE Graph and Google Earth to create maps that will display your data attractively. I’ve covered a small portion of that here – for more, see the webinar series by Madhu Lakshmanan. Or, stay tuned in the next week or so for Part II in the series, which will feature some newer GIS technology. As always, get in touch with me at email@example.com if you run into trouble and want some help!