USING QUANTUM GIS FOR FIELD GEOLOGY

By: Terry L. Pavlis and Richard Langford, Univ. Texas at El Paso

There are Three Basic Parts to this Tuitorial:

I. Using QGIS

II. Setting up and using QGIS for field Geology

III. An introduction to creating your own forms and symbols

Introduction and Overview of QGIS

When the ipad first came out it quickly became apparent that mobile computing was about to go through a major change. We realized at that time that Microsoft was almost certainly a big looser in the mobile computer market, and when we realized that ESRI was going to continue to cling to windows mobile we decided we needed to look for a new software platform. We also realized our existing winmobile equipment was quickly becoming archaic, and we needed to find another solution.

Some people (e.g. Steve Whitmeyer, and others) have gone one route, the ipad route, with aps for ipad. The UTEP group chose, however, to try a different approach using the open source GIS application Quantum GIS (aka QGIS). We had already been encouraging students to learn the basics of QGIS, because it runs on almost every platform (interesting, the only exception is iOS, the ipad and iphone OS—it is apparently because of the open source initiative, and apples policy with iOS). Thus, students could load the software on their own laptops, and not have to stand in line for our limited number of laptops. This was particularly important for mac and linux users where the software runs flawlessly (probably the best platforms for the software).

As we learned the software we realized it had a real potential as a “goldilocks” program for fieldwork, particularly when a version for Android was announced in 2012. In mid-2012 one of us (Pavlis) launched into building a full user interface for QGIS that was comparable to our ArcPad project, and the results are the files included in your packets. The tradeoff with open source, or course, is it is not polished like commercial software and as a result some aspects are more user hostile. We’ve tried to minimize the user issues in this tutorial, but unlike our arcpad projects this software has not been put through the “student test”; i.e. in our experience, the “student test” is the equivalent of Murphy’s law, that when you hand a student a project, anything that can go wrong will go wrong. Pavlis, however, has used both the generic project and the metamorphic project extensively, and we think most of the glitches are fixed.

Another issue with open source software is there are limited resources to draw on to get help, although personally (TP) the open source community is often a better source of help than ESRI with academics because their policy places limits on getting software help (at least in our case, each institution has a gatekeeper who you have to go through to report issues or get help beyond the manuals). All whining about ESRI aside (there used to be a great website called ihateesri.com) it is true that the qgis community can be very helpful, even just going to their forums and finding old posts that are likely to be the same problems you have. Be advised though, they are often rather geeky, and not necessarily easy to work from if you’re not comfortable speaking computereeze. If you really are going to get into tapping the full value of QGIS, it is probably a good idea to learn simple python programming as you can often work around bugs with a simple script.

Although QGIS is a potential “goldilocks” program, you need to be aware of other issues before launching into this program. The program is very stable on Windows, Linux and Mac, so if you want to use one of those platforms, this is potentially the application for you. This is particularly true with the new generation of windows tablets that are inexpensive and great field computers. We would continue with arcpad, but the writing seems to be on the wall that this software won’t be supported much long; thus, the move to QGIS. Unfortunately, as of this writing the Android version of the program is notoriously unstable. If you can put up with a program that crashes periodically, no worries, and there are workarounds that can keep crashes down to 2-3 per day—this in the old version of qgis, 1.8. As of this writing, QGIS 2.0 is totally unusable, at least on the author’s Samsung note 10.1 tablet and Samsung note phone. We are very hopeful that these problems will eventually be fixed, and if so, the android platform would be superb for this application.

With those cautionary notes, if you’re ready to brave the software, proceed. We love the program on a windows tablet, and RL routinely uses it on a mac. So everything described here works flawlessly in those environments.

Getting Started

General Statement on this tutorial:

Most of the basic operation of QGIS can be found in the online documentation, or a .pdf that can be downloaded. It is a reasonably good manual, with a lot of different parts, including developers tools if you are so inclined. As of this writing, the link for these resources is:

For this tuitorial we do not have time to go into all of the details of qgis, but will simply emphasize the parts that are most relevant to field projects.

QGIS 1.8 vs 2.0: The developers of QGIS made a major change in the software in mid 2013 when they released v 2.0. Most of this tutorial was written for 1.8 before this release and 2.0 is so different that we have two different versions of the tutorial in places. The advantage of 1.8 is that all of the available plugins work on the software, and it is known to be stable. The disadvantage is the Android version is very unstable relative to the 1.8 version. We have switching to 2.0 where possible, but have left 1.8 information because some may prefer it and it is the only working version of qgis at this stage (at again, working is a relative term, it crashes a lot).

QGIS basic setups for field geology: If you are an ArcGIS user you will see many similarities between QGIS and Arc, but QGIS is much more limited in capabilities. For example, ability to make polygons from lines is very limited (not a problem for field applications where you shouldn’t be doing this anyway), many of the fancy GIS capabilities of Arc are limited or nonexistent in QGIS, editing is primitive relative to the most recent versions of Arc (10 as of this writing), etc. Conversely, this is not necessarily bad for a field tool, and this is where the goldilocks factor arises. There are none of the deeply nested menus of Arc (2 clicks will do anything) and there is no “dreaded red toolbox” where there is some valuable tool that you’ll never find unless someone tells you about it.

Basic Geology in QGIS:

Step 1. Start QGIS (run the program, not the browser, which appeared in QGIS 1.8 as their attempt at ArcCatalog—it isn’t very useful in 1.8 but is fully functional in 2.0 and later). The QGIS window (1.8 here) should look something like this if all the bells and whistles are running (we won’t use all of these for field aps)

You will not need all of these for field applications. The only ones you’ll really need are the edit tools (black arrow), the zoom tools (orange arrow), and the attribute toolbar (red arrow). If you’re on an android tablet, I’d also add the file menu (blue arrow) since you’ll need to be saving your project a lot! For all field projects you’ll also need to add the special gps window. QGIS 2.0 is sufficiently similar that you can treat them interchangeable, except the icons look slightly different. To toggle these buttons off, pull down the view menu, and go to the tabs panel and toolbars where you can toggle them on and off with check boxes. (it that makes no sense, look at a later section of preparing for the field where this is covered in detail—it is more important in the field than here)

Step 2. Set the Datum and Projection for your project.

2.1 Select File Menu  Project Properties. This will open a window that looks like this….

2.2 Select The Tab labeled Coordinate Reference System, which provides a display below.

2.2. a Check the box labeled Enable ‘on the fly’ CRS transformation. (this may already be checked, but it is important that this be checked)

While not necessarily essential, this will reduce or eliminate a lot of potential problems. Alternatively, you can load a file with the coordinate reference you want first, then make sure the "enable on the fly CRS transformation" button is selected. This is similar to Arc (first file loaded rule) but can be confusing.

2.3. Save your project.

Remember, like Arc the map is just the pointer to your files and gives commands for how to draw things, but you’ve started doing those setups, so save the map somewhere you can find it (we always put it in the same folder as the data, but your choice).

Generic Mapping Project in QGIS

We can use the same generic project here that also works in arcpad. QGIS won’t be able to use the arcpad layer definition files ( the .apl files) but shapefiles are shapefiles and in QGIS we’ll use a QT based form (basically an xml file) with the extension ”.ui” or shorthand for user interface file and a layer definition file we’ve made for you.

So, like in the arcpad tutorial, the first thing you should do is go to your tutorial folder, find the folder “newgenericproject_2D”, open it, and copy the “shapefiles” folder into a working directory for this project (set it up as you like; but we usually make a “workingfiles” directory. Since these files have the same data structure as the generic arcpad project, the only difference here is setting up the graphics in QGIS. Once set up, it operates very much the same way as an arcpad project. The only catch in QGIS you have to do a few more setups to make things nice and clean. Once you are set up, you’re good to go, and to our knowledge you won’t run into some of the nasty arcpad issues that force you to exit the program periodically. Again, like arc, the map will be just a pointer to the data (shapefiles) so it is the shapefiles that are important to backup. Also ,the default map projection will be the same as the first data file you load and if you check the project on the fly box, everything should load fine.

Step 3. Load and manipulate a raster file.

3.1 Either select the Add Raster Layer button (right),

or select Layer Menu Add Raster Layer

Navigate to the Generic Mapping Project folder and add Sfranklintopo.tif

______

NOTE TO ANDROID USERS: The file browser that comes up by default in QGIS on my android tablet (a Samsung note 10.1) is mind boggling, and strangely it is different in 1.8 and 2.0. For some reason, it doesn’t seem to follow the standard file tree structure, and you may need to do some serious searching to find your data. You need to be very careful here to make sure you know where the files are that you’re working on; I do not understand this behavior in my android system, and it might be unique to Samsung but more likely it is QGIS since it seems to have changed in 2.0. I haven’t found anything about this issue on QGIS forums, so just use some caution here.

WARNING TO ANDROID USERS: NEVER put your data into one of the QGIS program folders. I found out the hard way that if you do that there is a danger the program will wipe out your data! So like arcpad, put it somewhere safe, like an external SD card.

______

We have discovered two manipulations that are particularly helpful for field mapping.

These are changing the transparency and enhancing contrast and colors.

3.2 Manipulate image transparency.

Either double click, or control click or right click on the layer name in the layers panel and select Properties.

This will open the Layer properties window. The transparency tab is the third one in QGIS 1.8.

Play with changing the transparency. This allows you to superimpose different images(e.g. topo contours on an orthophoto) and it can help you see your linework on a background image (particularly on DRG topo maps)

3.3. Manipulate raster color contrast.

Open one of the photographs in the generic project. Try l3106_13_1_nc_21092008. An image should appear, covering the topographic map. You can play with the transparency and look at how the topography matches the geology in the photograph . But first, lets better differentiate the layers.

3.3 a Open the layer properties window, just as in changing transparency, but instead of selecting the transparency tab, select the Style tab on the left. There are numerous ways of changing the image, but most are ineffective in enhancing geologic contrast. A simple way to play with enhancing contrast is to stretch the color contrast

3.3.b On the drop down menu near the bottom of the style tab, change “no stretch” to “Stretch to MinMax”. Check the “Use standard deviation” radio button. You can now play with the value in the box to the right. Lower values enhance contrast. For this image, 2.5 to 2.0 work on my screen, enhancing the color differences of the different units. (Note: If you are arcgis user, this will look familiar. It is a big advantage over arcpad though, where you do not have this control.

STEP 4. Load and Set Styles for Shapefiles and other Vector Files

Loading Shape files is similar to loading them in ArcGIS, but there are extra steps that are required in order to have them display properties you might want on a geologic map. First, let’s load a shape file.

4.1 Select Add Vector layers from the button or the Layers menu. Navigate to QGIS Generic Project folder and then to the shapefiles_genericproject folder. Notice that in QGIS, there is a dropdown menu in the bottom of the file selection screen that allows you to load a wide variety of files, including KML files from Google Earth. If all of the files are grey, select shapefiles from the menu at the bottom and then select depositional contacts from the list. Only the .shp files should be highlighted. Select all of the shapefiles in the folder, and load them.

4.2 Right click on the name in the layers list and select properties. As with Raster images, this is where we can set file display properties.

You should now have a screen that looks something like the image below (again, slightly different in 2.0). The colors will vary because this is a random assignment of styles. You’ll see all the shapefiles to the left in the legend (layers window). There are two useful windows at the bottom, the one labeled “coordinate” gives a readout of the location of the cursor on the map (in map earthcoordinates, so this is utm), and the map scale is next to that. So you can change the map scale with this tab—very useful.

4.3 Re arrange data layers. Arranging data layers is easy, simply drag the layer to the position you want it in the layers panel. We must put all of imagery at the bottom and the shapefiles on top in order to see the shapefiles. In the field, it also helps to use a standard order, (for example, point files like stations and orientations on top) If you’re not using all the shapefiles, or some you use rarely, you can either remove them or put them at the bottom of the layers.

4.4 Set line and Point Styles. When you get the layers in the order you like, double click on the “depositionalcontact” layer (or right click, and choose properties), and you should get this big dialog box (2.0 will look slightly different).

.

We have set up some “easy-to-use” files that you can adapt to easily apply line styles. While not difficult to do, it can be a little tedious to create your own styles. On the other hand, adapting the files we provide, is easy and, as long as you save under new names, you can always re-use the originals.

4.5 In the layer properties window, select the Style Tab. Select Load Style, Navigate to the Layer Definitions folder in the Generic project folder and select the depositionalcontact.qml file.

Close the Layer Properties window

4.6 Select the depositional contact layer definition and look at the line styles you have loaded. You can change these, and save the style, but we recommend that you are careful about this and make sure you save the qml file under a different name.

You can set this up any way you want if you don’t like our setups, but we’ve provided some pre-made style sheets and forms, which we’ll add now. (unlike arcpad, you are encouraged to experiment with line styles here, it is rock solid stable so feel free to change these on the fly in the field as needed)