Orientation symbols in both qgis 1.8 and 2.0--svg

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
1
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.
2
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:
http://www.qgis.org/en/documentation/manuals.html
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.
3
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….
4
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.
5
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
6
_________________________
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)
7
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.
8
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.
9
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 premade 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)
Step 5. Setting up forms for data entry in v. 1.8. (v. 2.0 is different--see next
section)
Select the Layer Properties by double clicking on the depositionalcontacts layer. This time
select the General tab. It should look like below.
10
At the right-hand side of the Edit UI line, there is a button(three dots).
Select this, to pop up another dialog box to add a file.
Step 5.B Navigate to wherever your files are and find this folder given
the very original name “forms”. Open that folder, and you should see a
bunch of .ui files in a dialog like below; choose depositonalcontact.ui then hit open:
11
Step 5: QGIS v. 2.0
Setting up forms is different in v. 2. They moved the location for linking the files. The
same forms work (they use the same QT system), you just have to link them differently.
As in 1.8, open the Properties dialog box for the layer you want (in the figure below, we
show "depositional contact" but others will be similar). You'll have to select the "fields" tab this
time, and get something like this:
You'll need to pull down the "attribute editor layout" tab (arrow above) and in the pull down menu,
select the "provide ui-file" tab. Once you have that toggled, the upper right corner of the properties
dialog box will look like this:
12
Now you hit the well hidden button (arrow points to button with 3 dots) and browse for your ui form.
Note that 2.0 is as stupid as 1.8 and will default to another folder, but find the ui forms as in 1.8 and
follow same procedure.
Now let’s try our form.
5. C Turn editing on for the layer (black arrow below). Then select the Add Feature button (orange
arrow below) in the edit menu. Then start drawing something.
To finish the line in QGIS you must right click. This is also painful on a touch screen tablet—it is usually a
press and hold. (there are machine setups that vary this, depending on your hardware. There may be
options in qgis for this that I don’t know how to change too).
But hopefully when you right click, you’ll now get a nice data entry form pop up like below:
The black arrow (on the map) shows the line I just made and the dialog box is the form ready for
data entry. The first two fields have pull-down tabs to fill these attributes, the last one is a freeform
note field. Like the arcpad project, changing the contact type changes the line style, but the others are
just attribute fields to be filled out at your wish. So here is an example of the form filled out with
speculative volcanic contact, and no note yet added—NULL will be the default.
5.D Repeat the operation of loading a layer definition style and form for each of these data layers.
Don’t do any new editing yet, just do the tedious part of linking in all the forms and layer definitions.
For “orientations” use the orientationsESRIfonts if you have used arc on your computer. Otherwise
use the other one, and we’ll go into that below) The good news is you only need to do this once, per
map. So it is highly advisable to use a workflow in QGIS where you always do your edits in a working
directory, and put backups into separate folders, moving things in and out of the working directory.
5.E VERY IMPORTANT—fix widgets in Orientations data entry
Something that cropped up in qgis 2 is a peculiar problem with data entry forms. Qgis 1.8 had a slightly
different problem described in the troubleshooting guide, but that problem seemed unpredictable. This
13
one seems to happen on all windows machines we’ve used; we don’t know if other machines suffer this
problem.
a. Open the properties dialog for the Orientations shapefile
b. Select the fields tab
c. In the table find the STRIKE row and go to“Edit Widget”. The default will probably be “line edit:
and if so select that field. You should get something like this:
For some reason, the default, line edit doesn’t work. You need to change this to “range” and
then change the value range to appropriate range for strike (0-360)
You should get this:
14
d.
Repeat this operation for the three rows DIP, TREND, PLUNGE (of course, for DIP and PLUNGE
the range will be 0-90 and for TREND it will be 0-360)
5.F
When you get all these forms and layer definitions linked, your map should look something like this.
15
Now, save your project!
You can now add and edit data.
Select the Pencil to enable editing and try adding a few lines. Unlike Arcpad, you must
remember to save your edits!!! (just hit the little icon that looks like a floppy disk)
Remember, in QGIS, you click to create a vertex or point, and Right-click (or press and hold) to
end your line. If you want a freehand line tool there is one available as a plugin—it is called
freehand editing. Just use the plugin manager and search for freehand.
Final Note on Setups: Because, each time you create a project, you will have to redo the steps above,
it is highly advisable to use a different workflow than we showed in Arcpad. In QGIS once you have
set up your project, you will want to keep your map setups the same. So it is best to do all your data
entry and edits in the same working directory. At the end of each field day, or when finished with
edits, make a simple backup by transferring files into separate folders. Although this is a very
different workflow than arcpad, most people find this more intuitive because it is a simple backup
copy process.
16
Orientation symbols in both qgis 1.8 and 2.0--svg graphics
There is a nice resource out there somewhere where we found some nice svg graphics symbols for
strike and dip (sorry, I don’t remember the source so can’t reference it properly, but I am sure google
search will find it). In your tutorial folder there should be a folder called “GeologySymbols”. We’re
going to use that. You can also easily build your own in programs like adobe illustrator--just make the
symbol a full page, and save it as svg graphics.
To add the svg graphics, you need to look at the properties folder (orientations). The screen should
look something like this (you might not see geo symbols yet):
To change a symbol, select the feature you want to change (e.g. vertbed) then hit the button
"change" (arrow points at the button). You should then get a new dialog box (it will look a little different
in 1.8; this is 2.0 screen)
17
Hit the + button in the lower left (procedure is slightly different in 1.8), and symbol selector
changes to this:
18
You need to toggle the "symbol layer type" from simple marker to SVG marker. Now you have a big
selection:
The available symbols in the defaults are in the SVG image window, scroll through these, but it is
doubtful you'll have the right symbols loaded. You'll almost certainly need to browse for the symbols,
using the button in lower right (shown by arrow). If you do that, you'll get a standard dialog box, and
you can browse to find the folder "geology symbols" in the tuitorial file. If you load those, you'll see
most of the symbols you might want for geology. Just select the one you want, go through as many
changes as you want, then just save the style (probably want to give it a new name) and you're good to
go.
SHORTCUT: To avoid the browse step, you can paste the svg graphics into a qgis folder. The path
on my PC for that folder (in QGIS2.0) is:
C:\Program Files\QGIS Dufour\apps\qgis\svg
if you put them there, they will appear in the SVG window (like above)
NOTE FOR ANDROID USERS: In android you’ll have to use a file manager to put these into the svg
graphic folder for qgis. In v. 1.8 you had to do this, or you couldn't change the symbols but in 2.0 I you
can browse. Nonetheless, easiest to put them in the svg folder. On my Samsung, the path is:
/storage/sdcard0/Android/data/org.qgis.qgis/files/share/svg
19
WARNING--ALWAYS CHECK TO MAKE SURE YOUR FORMS
WORK, AND THAT THE FORMS ARE RECORDING DATA! IF
THERE IS A PROBLEM, SEE THE TROUBLESHOOTING GUIDE
BELOW. (THE PROBLEM IS SUPPOSED TO BE SOLVED IN QGIS
2.0, BUT ALWAYS DOUBLE CHECK BY ENTERING FAKE DATA,
THEN LOOK AT THE ATTRIBUTE TABLE TO MAKE SURE DATA
HAVE BEEN RECORDED!!!)
20
STEP 6. Editing Points and Lines in QGIS
Note that with editing menu active (selecting the pencil), the linework also now displays all of the
anchor points, which are now editable, etc. Try your hand at editing by selecting the edit vertices tool
(black arrow), grab a vertex, and move it.
Simple, just like almost any drawing tool, a click and drag. Easy to get something like this
Aside: It is hard to find these sometimes in the manual, so other useful editing functions are:
1) delete vertex, select the vertex, then hit the delete key (somewhat painful on a tablet without a
keyboard);
2) add a vertex, put cursor over the place you want a new vertex and double click (even more painful
with a blunt digitizer like your finger on a touch screen tablet—best to either get a mouse for these
devices for this type of operation, or get a tablet with a pen interface, like the Samsung note series or
various windows devices)
21
3) Move a Vertex , The button with the three dots with the arrow pointing to one of the dots. This and
all the other editing tools are found, (not surprisingly) in the edit menu.
4) To delete an entire object, you must first select it with the "select single feature" tool, which is on the
same toolbar as the settings and i (query) tool (see below, 2.0 screen). There are several selection
options in the toolbar--you'll need to play with these to get used to them--single feature is shown here.
The selection tools can also be found in the View Menu.
VERY IMPORTANT: Like data entry, if you want to keep your edits, you hit the little icon that looks
like a floppy disk in the edit menu. (AGAIN: very important for qgis, unlike arcpad which automatically
saves things every time you hit the arrow or check mark, you must hit this button to save any changes,
input or edits)
22
GETTING READY FOR THE FIELD
QGIS can have a few issues in the field, so a little preparation and care can save a lot of trouble.
PART 1. Modifying the Display.
On tablets and phones, QGIS can get a little busy and the menu’s can occupy a lot of the screen.
It is very easy to modify the display in QGIS. The procedure is very similar in QGIS 1.8 and 2.0
STEP 1 Pull down the menu tab “view” and in that menu you’ll see near the bottom of the menu
two things: panels and toolbars. GPS functions can be found under “panel” and the toolbars under, of
course, toolbars. Note, this is one of the few cascading menus in qgis but they are obvious as pulldown
tabs on the menu bar. To get rid of the fluff, you just uncheck the toolbars you won’t need.
STEP 1.A For field work we generally uncheck everything but digitizing, attributes, and map
navigation (+/- file if you want a button to save the map). Your screen should look something like the
next figure after you'd uncheck these (this is 2.0 screen with a background map displayed--key is you're
down to one or two rows of buttons)
On a phone this step is essential or your whole screen will be tiny buttons. For a tablet it is less of a
problem so you can also keep things like vector and raster, although all of these can also be accessed
from the menu bar. Aside: unfortunately, to deactivate or activate a toolbar you have to do them one
at a time, you can’t just check off all the ones you don’t need at one time. On a touchscreen tablet, this
can be very annoying if your poor digitizer (finger) hits the wrong button.
23
STEP 2. USING A GPS (V. 1.8 AND 2.0)
Finally, you undoubtedly want to use a GPS and that panel is accessed under, surprise, panels, and
check the box for GPS information. When you do that the default screen should look like this (of course,
different menus are likely and in v. 2.0 it will look slightly different). To open the panel, Select the View
Menu, then Panels from the list, then GPS information. . It should look like this.
Arrow is pointing at the gps panel. Note, this placement is slightly annoying because it takes up
part of the layers window where your data files are displayed (as in arc). For a windows, mac, or linux
user, it is nice to undock this menu. To get there you just hit the restore button (next to the x go away
button) and the menu can be undocked, resized, etc. Next figure shows this clearly.
VERY VERY VERY IMPORTANT FOR ANDROID
USERS!!!!!!!!!!!!!
NEVER, EVER HIT THE RESTORE OR RESIZE BUTTONS ON
THE GPS WINDOW WITH THE GPS PANEL IN ANDROID!
There is a major bug as of this writing in both QGIS 1.8 and 2.0. Eventually this will
undoubtedly get fixed, but moving the gps panel in android produces the worst crash of any
application crash I have ever seen since computers became multitasking. The panel will enlarge
to fill the entire qgis screen, with NO GO AWAY BOX. You can deactivate the panel, but that
24
does little good because then you don’t have a gps. This basically makes the program
nonfunctional. When I (TP) did this in 1.8, I literally had to reinstall the program to get rid of
this nightmare!!! In 2.0 you can get the program to run again, but you'll never get the GPS
panel docked again without reinstalling the program! Worse yet, in 1.8 I had to rebuild all my
preferences too, because that got wiped out at the same time. Nasty nasty bug. There is
probably a better work around, but that was all I could do.
Regardless of what platform you’re on this panel will look the same. You can scroll the menu if it is
docked or you can enlarge it like this to see details (again, don't do this with android!). This GPS panel is
basically push and pray. With the default autodetect, and a little luck, the gps should just connect, and
life is good. The default panel is the options tab (arrow shows this option) but the other tabs (right to
left ) allow you to get a sky plot, satellite strengths, and lat-long position readouts.
Caveats: Like any plug and pray issue, life is good if this works, not so good when it doesn’t. Here is
some simple troubleshooting advice, depending on what kind of gps you’re using.
For a built in gps—this tool seems to always work (at least I have no experience with the gps failing to
connect). You have to activate the built in gps first, of course, but the program quickly finds the gps.
We suspect serial devices are the same way—simple cable connection, properly set up in windows, linux
or mac, we are sure it will be flawless. Bluetooth is another issue. USUALLY the process is within the
system. Set up the Bluetooth connection, and the program will find it. BUT, we have had problems with
the software going haywire with Bluetooth connections, at least on a windows machine. One problems
25
we have had was different software trying to access the Bluetooth port, so if you avoid that it should not
be a problem (we experienced this problem trying to use field move, arcpad and qgis at the same time—
they fought over the port and even if you shut them all down but one, problems tended to persist
(requiring reboot).
Windows 8 has other issues. QGIS generally behaves better than arcpad with external GPS units, even in
windows 8, but there are weird issues. Our windows 8 tablets do not have a built in gps, so we use
external Bluetooth gps units. The procedure with these devices is to lock the Bluetooth gps to your
computer (watch out if there are multiple devices active near you, you might lock onto the wrong
device!!!) There is a strange feature in windows 8 that requires you to use a pin code with you
Bluetooth receiver, so make sure you have that handy when you do the setups. (previous versions of
windows and windows mobile did not require this, it is new to windows 8, You might need to go to the
manufacturers website for this information, so you obviously should do this long before you leave for
the field! Most of them are the spaceballs combination—1111 or 1234, etc.). The other peculiarity on
windows 8 is that you will see the Bluetooth connection established in the bluethooth manager, then
after a few seconds it will disappear, making you think the connection is lost. DON’T BELIEVE WINDOWS
HERE, IT REALLY IS CONNECTED! Once you are locked to the device, the qgis gps window should just
automatically connect.
26
Advanced , Setting up your own QT forms for Quantum GIS
(TP text, so if this confuses you, get in touch with him)
Quantum GIS uses data entry forms that are slightly different from Arcpad. The program uses user
interface (.ui) files that execute .xml code. I designed all of the forms here using an application called
QT Creator, but there are other ways to do this. I understand you can also use python to do this, but I
haven't mastered the snake.
QT Creator is a free online application, but if you really get into it, there is a pay version that is more
sophisticated. QT is the application that QGIS is wrapped in for the Android version, as I understand it
anyway.
Because QGIS is not a commercial program, it isn't surprising that adding forms and making them work
in QGIS is rather more involved than Arcpad with its Arcpad Studio Application. However, the good
news is, the QT Creator application is pretty friendly, and more versatile, than Arcpad Studio. Moreover,
I've made some premade forms for you, and they are very easy to modify in QT Creator (easier than
Arcpad Studio)
Just for fun, this is what the first few lines of the "stations" user inferface file looks like:
<ui version="4.0">
<class>Dialog</class>
<widget class="QDialog" name="Dialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>782</width>
<height>547</height>
</rect>
</property>
<property name="maximumSize">
<size>
<width>800</width>
<height>550</height>
</size>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="geometry">
<rect>
<x>530</x>
<y>490</y>
<width>169</width>
<height>27</height>
You can fiddle with this code if you want, but it is dangerous if, like me, your really don't know what
you're doing. So lets try something simpler.
27
Making a form in QT creator is a lot like Arcpad studio, you just need to know a couple tricks. Run the
application, and then open one of our forms (you can of course start from scratch, but it is easier to see
this way) Here is the screen for depositionalcontact.ui
28
On the left are various widgets you can use, on the lower right is the xml code, and in the upper right is a
summary of the objects in the form. We've used a combination of "combo boxes", "text edit" and "plain
text edit". Labels are just what they sound like--blank label features. The orientation.ui file also
employs a spin box--a somewhat annoying requirement related to forcing numeric fields.
Hopefully the widgets are self explanatory if you've gotten this far, the key is set up the form to the size
you want, enter the various fields, resize to make things fit, etc. It is basically a graphic operation, and
the program generates the xml code. The only time I had to ever fiddle with xml code so far was to
change things like "maximumSize" to avoid the forms going offscreen. One useful piece of information,
to change the values in a combo box field, you just double click on the object field, and you'll get a
popup window where you can enter the data. For example, under "contact type" in this example, you
might want to add something else like quaternary contact or something else you might want to
highlight.
These forms are generic and could be used for anything, except to make them work the QGIS you need
to set them up so they output the right data to QGIS. That means you have to tell it what the attribute
name is you want to fill. For our purposes, that is done with a link to an object name. So take the
example of the "Contact Quality" field in this form. If I right click on that field, I get a pop up window like
this:
Select "Change objectName..." and you get a new dialog box:
29
It appears here with the name "QUALITY" because that has already been filled in. For entering
something new you MUST type in the name of an attribute field you want to fill with EXACTLY THE FULL
NAME OF THE ATTRIBUTE FIELD! Note, it is very very easy to make a typo here; it is case sensitive and
spaces are recognized. If you have the slightest error, it won't work. So always check these!
When you like your form, save it (better put it somewhere else if you don't want to overwrite what we
made for you). simple as that--then just link it in, as described above and life should be good.
WARNING--ALWAYS CHECK TO MAKE SURE YOUR FORM WORKS, AND THAT IT IS RECORDING DATA! IF
THERE IS A PROBLEM, SEE THE TROUBLESHOOTING GUIDE BELOW.
30
TROUBLESHOOTING A DATA ENTRY FAILURE FROM A FORM:
Unfortunately, the defaults do not always work in the data entry forms. If you find that some value is
not being recorded, try this operation. (this is one that will be hard to find on QGIS forums)
In the layer properties dialog, click the Fields tab. You should get this (with some variations we'll get to):
Note that the "Name" refers to an attribute field in the shapefile dbase file along with its data type,
length, etc. For us here, the key issue is the "edit widget" tab. By default qgis always leaves this tab
"line edit" unless specified as something else. Unfortunately, if you leave these tabs as default, you get
some strange behavior. "line edit" is essentially freeform data entry; thus, it is perfect for things like
STATNUM (station number) or SHORTNOTE (simple note entry as text) because you WANT to have these
fields be freeform entry. For entries with pulldown menus, however, this won't work and in fact, QGIS
usually won't even record the data if you use this default! (the exception seems to be when the "style"
uses an entry to draw something, in which case the default works, for reasons I don't pretend to
understand). SO:
31
The fields like "GEOLOGIST", "HOW LOCATED", etc. have been changed here from the default (line edit)
to "Unique values editable". Do the same with yours by clicking on the "edit widget" field for the value
you want to change, and you get a dialog box that allows you to change the data entry type. (note:
MAKE SURE YOU CLICK THE EDITABLE BOX!) Aside: Under DATERECORD it is tempting to choose
Calendar. It took me hours to figure out how to make this work. Look at the Station ui to see how I did
it.
Now the good news: In general, you shouldn't have to do this if you use our forms and layer definitions.
As a demonstration, hit the "Save Style" button. Navigate to some appropriate place and save the style.
You could now use that style, and you won't have to do this again. That is, after you have loaded the
appropriate shapefile you're working with, just hit the "load style" tab from the properties dialog, use
your style, and this "fields" problem will be done for you, along with any graphic styles you made. (we
will do this with the rest of the examples using style's we've already made; but you really need to know
this to keep out of trouble!!)
32