Setting up QGIS for Precision Agriculture GIS: Free Software

QGIS rivals ArcGIS as desktop GIS software especially within Precision Agriculture. The difference is that QGIS is Open Source and therefore free to use for personal and commercial use. Open Source has many other advantages. If you are familiar with ArcGIS you should give QGIS a go.

If you run Windows I recommend installing using the OSGeo4W installer. Run the ‘Desktop Express Install’.

‘Out of the box’ QGIS is very capable. But it is not until you install a few powerful plugins that it’s real potential is revealed. So far the plugins I use on a daily basis are: SEXTANTE and Table Manager. SEXTANTE is not much good to me without SAGA. Together these make available a comprehensive list of common Vector and Raster GIS algorithms. Optionally install TauDEM and Orfeo (I have installed these but not yet used them).

Setting up SEXTANTE in QGIS 1.8 (Windows 7 & 8)

Install Sextante Plugin (In QGIS: Plugins > Fetch Python Plugins).

So SEXTANTE has access to the SAGA algorithms it needs to be downloaded and installed: SAGA.

Configure SAGA in SEXTANTE (In QGIS: Analysis > SEXTANTE options > SAGA), insert SAGA folder and check Activate box.

Similar to SAGA, download and install TauDEM 5.0.6 & MPICH2 (make sure you follow install instructions on the download page).

Configure TauDEM in SEXTANTE (In QGIS: Analysis > SEXTANTE options > TauDEM), insert MPICH2 bin directory, TauDEM command line tools folder and check Activate box.

Install Table Manager

Plugins > Fetch Python Plugins

Search for Table Manager and click Install.

With these two plugins, especially SEXTANTE, QGIS becomes extremely capable.


My first QGIS plugin: BigButtons

I’ve recently started playing around with QGIS plugins on my Windows 8 (and 7) machines. After working through the initial process which I discussed here I had a go at making my own (very) simple plugin.

The purpose of the plugin was to allow easy access to zoom and pan functions for a touch screen laptop such as my Panasonic Toughbook.

I use the BigButton plugin in conjunction with QGIS Tracker and OpenLayers. I mounted a GPS on a quad bike with my Toughbook and went out to record a trip with live Google Maps underneath. This worked to a point.

Warning: Using these three plugins together is riddled with bugs. Just the ones I notice from 10 minutes use include:

  • BigButtons will not work properly while QGIS Tracker is Tracking GPS Location as it is programmed to keep the marker centered. Once tracking is stopped BigButtons functions as normal.
  • As the marker direction from QGIS Tracker changes in reference to the GPS bearing the Google Satellite from OpenLayers plugin will go white underneath.
  • BigButtons ‘Cycle Layer’ currently only works if you have all layers in a single group – and even then can do some strange things – needs work!

Download QGIS Plugin tested on Windows with QGIS 1.8: BigButtons-Experimental

Photo of my quick and dirty GPS setup on quad bike:

Flood water satellite image NW NSW & SW QLD

If you were wondering where the agmapsonline homepage image comes from – this is it. A  Landsat5 image captured on 23-03-2010. We have had two floods that have exceeded this flood level since.

Notice that the cotton paddocks remain completely protected. In fact you will find many cotton farmers still irrigating during large flood events. Other areas where the water spreads out is useful for filling moisture profiles and dropping valuable nutrients.

This is not a ‘true colour’ image. Of the three layered bands used to create the image I have only used one colour band and that is blue. The other bands used to produce the image are near infrared (NIR) and short wave infrared (SWIR). The SWIR, NIR and Blue bands are applied to the red and green and blue scales respectively to produce the image that you see.

This combination shows up healthy vegetation as bright green and water as blue (even though inland water is generally brown). Learn more about this here.

Click on image to view it full size.

Full Season Chickpeas Photo Log

Here is another photo log from a couple years ago. Chickpeas, once introduced as a break crop from a crop rotation dominated by cereals (i.e. wheat and barley) is now just as important and can be just as profitable as wheat and barley. Although chickpea varieties are getting better all the time they are still susceptible to water logging and disease due to too much rain. The variety used in this season was ‘Jimbour’. We have now switched to ‘Hat-Trick’.

The season was set up to be a bumper crop with great crop establishment and moisture profile but then it just kept on raining and we ended up with a lot of plant and not many peas in the pods due to water logging, disease and wind. Enjoy viewing some of the hardships of farming.

The video is me harvesting chickpeas, but not this particular crop.

Creating Python QGIS Plugins in Windows 8

After being fresh out of Udacity CS101 – Computer Science course I wanted to put my new Python skills to use. QGIS supports plugins programmed in Python so I thought I would give that a go. What I realised is that there is a missing link between an introduction to programming and how to apply it! After several hours I was able to complete a simple plugin and get it working, with a GUI – all in Windows 8.

Here are the steps I followed:

1. Install QGIS 1.8 using OSGeo4W. Select ‘Express Desktop Install’. I installed all packages even though we won’t be using them all. It is worth having.

2. Download and Install Monkey Studio IDE.

Optional: Download QGIS APIs for auto-complete. You can add these to Monkey Studio by going to Edit > Settings. In ‘Source APIs’ select Python as language and add all the .api files. I sources these files here but stored them on my server in case the drop box goes missing.

3. The first Plugin I made was called Zoom to Point. I used instructions from a book excerpt available here. Chapter 15 – GIS Scripting, starting at page 270.

I was able to follow the instructions with the following additional tips:

  • Windows 8 QGIS plugin directory is located at


  • QT Designer is built into Monkey Studio. When you need to edit ui_zoomtopoint.ui launch Monkey Studio, then open this file to edit it.
  • Run the command line commands in the OSGeo4W console which should be on your desktop from Step 1. Navigate to your plugin directory e.g.

cd C:Users[username].qgisPythonPluginsZoomToPoint

pyrcc4 -o resources.qrc

pyuic4 -o ui_zoomtopoint.ui

  • On page 284-285 there is code which you will need to copy over to your file. For me lines 41 and 42 produced an error. I was able to fix this by replacing them with:
41     x = dlg.ui.xCoord.toPlainText()
42     y = dlg.ui.yCoord.toPlainText()
  • In the file (around line 27) I changed ‘import resources_rc’ to ‘import resources’. Otherwise I get an error in QGIS.
  • Every time you make a change to your plugin you need to restart QGIS. There is a plugin called Plugin Reloader that speeds this up allowing you to reload plugin with restarting QGIS.
  • Be very careful manually copying code. Most of my errors came from incorrectly copying code!

I hope that saves some others a few hours starting out. I have just scratched the surface and am looking forward to building some handy QGIS plugins as time allows.

Some more tips as I go:

  • For some reason if I create my Class name (ie when creating plugin template in Plugin Builder) in all lower case it does not build properly with pyuic4. If you have this same problem try using CamelCase and see if that makes a difference – it did for me.

Topography maps for drainage, Part 1

Recently I’ve been looking at elevation data collected from our Trimble FMX GPS system we use in our tractor.

I imported the logs from this years planting operation. We plant on a swath width of 12m so the data resolution is quite good. The data logs are then transformed into a digital elevation model or DEM and then interpolated to create smoother surface. From the DEM, so far I have developed a contour map and an exaggerated 3 dimensional surface.

Exaggerated 3D surface – note that it is twisted 90 degrees to the below contour map. You are looking from the western side of the paddock.
Contours 20cm

You may have noticed from these diagrams that this paddock has quite interesting topography. A couple of places in this paddock water fails to drain freely which can sometimes lead to water logging. My next step is to identify these sinks.

Software used is the freely available QGIS with GRASS & SAGA extensions available at