QGIS, Open Source GIS & R
Today’s post is by Kurt Menke, the owner of Bird’s Eye View GIS, a GIS consultancy. Kurt also wrote the book Mastering QGIS. In my latest course (Shapefiles for R Programmers) I briefly introduce people to QGIS. Kurt’s post below gives you a roadmap for learning more.
I come to this blog from a slightly different, but related, perspective. I am a GIS specialist. I run my own GIS consulting business, Bird’s Eye View GIS, out of Albuquerque, NM. I’ve have been a user and advocate of open source GIS for a long time. I’ve long been aware of the power of R and have dabbled in it from time to time. I discovered Ari and his great Learn to Map Census Data in R course via Twitter back in February. When I saw his free course, I thought it would be a great opportunity to get more comfortable with R.
What I want to do here, is briefly introduce all of you R users to QGIS, the leading free and open source (FOSS) desktop GIS. I’ll also cover some QGIS resources. R and QGIS can be a beautiful marriage. What began in 2002 as a simple data viewer has evolved into a fully functional GIS package, with a very dedicated and active user community. Currently a new version of QGIS is released every four months! Due to this rapid release schedule, a long-term release (LTR) version is created each spring. The LTR works better for productions environments. QGIS is multi-platform, running on Windows, Mac and Linux. There is also an Android version, and withcrouton it can be installed on a Chromebook!
Under the hood, QGIS leverages several other FOSS packages. One of those (GDAL/OGR), allows it to read 42 vector file formats and 88 raster formats! It can also connect to several spatial databases including: PostgreSQL/PostGIS, SpatiaLite, Microsoft SQL Server and Oracle. If that weren’t enough it can connect to OGC web services such as: WMS, WCS and WFS. The image below shows the basic layout and a map of total population by county. The basemap is being streamed from CartoDB. This particular population dataset is a shapefile. QGIS has fantastic cartographic capabilities including some that are not available in any other GIS package: Blending Modes and Live Layer Effects.
Spatial Analysis with QGIS
I know R users are a technical group, so I’m happy to say QGIS also has a robust set of geoprocessing functionality. The Processing Toolbox, (shown on the right above) has both native QGIS tools for processing spatial data, along with tools from numerous other FOSS providers, including R!
NOTE: R needs to be installed on your computer and the PATH has to be correctly set up in the Processing menu -> Processing Options settings.
The image below shows the Toolbox with the R section highlighted.
You can write your own R scripts, and there is an online R scripts collection for QGIS. To access that, simply open the Get R scripts from on-line scripts collection tool. This opens the Get scripts and models dialog shown below. Here you can choose the scripts you’d like to install and click OK.
Once a script is loaded you can run it like any other tool, or open it in the QGIS Script Editor. Below the histogram script from the QGIS collection is open.
The Processing framework also includes a graphical modeler. This allows you to set up an entire workflow from simple to complex. A model can include any datasets and tools from any provider, including other models. The model below is a site selection model for a heliport in Corpus Christi.
Models can also be saved as Python scripts. QGIS has a Python console giving you another powerful scripting environment to work with. There’s obviously a lot to learn here.
Phew! There is way more to QGIS than I can do justice to in a blog post. So below I’m going to give you some information on resources.
QGIS Resources (#shamelessplug)
One way I’ve become involved in the QGIS community is writing curricula and authoring two books on QGIS. Two years ago, myself and several colleagues authored the GeoAcademy, which is the first ever GIS curriculum based on a national standard – the U.S. Department of Labor’s Geospatial Competency Model (GTCM). The GTCM consists of the knowledge, skills and abilities needed to be a working GIS professional. The GeoAcademy consists of 5 complete college courses.
- Introduction to Geospatial Technology Using QGIS
- Spatial Analysis Using QGIS
- Data Acquisition and Management Using QGIS
- Cartography Using QGIS
- Remote Sensing Using QGIS
This winter I converted the curriculum to fit into a convenient workbook format with Locate Press. The book is called Discover QGIS. and is hot off the presses. I mentioned how fast QGIS is developing. Originally written for QGIS 2.4, the GeoAcademy material in this workbook has been updated for use with QGIS 2.14. It therefore represents the most up-to-date version of the GeoAcademy curriculum.
At the moment the digital version of the book is available as aPreview Edition. Purchasing this ebook, entitles you to the full version when it is released. We are just working on a few formatting issues.
Prior to this I authored Mastering QGIS with Packt Publishing. This is a more thorough treatment of QGIS. Beyond these two books there are many other resources including:
- Online User Manual
- Other books such as QGIS Map Design, Learning QGIS and the QGIS 2 Cookbook.
With this extremely short introduction I encourage you to download QGIS and begin experimenting. It is fantastic software. Meanwhile I have a lot of R to learn! See you in the twittersphere (@geomenke)