A Desktop Analyst’s Guide to QGIS – Part 2: Beyond the Basics

المشرف العام

Administrator
طاقم الإدارة
If you haven’t already done so, take a look at part 1 of this blog series.* Having been a desktop GIS analyst for most of my career, I have an appreciation for the power behind proprietary desktop GIS applications.* But I also have come to the realization that 80% of users use only about 20% of the potential capabilities of desktop GIS.* With better license-free alternatives available in the open source community, I could not justify needing expensive proprietary desktop GIS applications when only 20% of my coworkers were getting the full value out of it.* It quickly became evident that QGIS was a solid alternative desktop GIS, and had complete feature parity for that 80% of functionality the majority of my coworkers were leveraging.* So the first part of this series focused on the simplicity and ease-of-use of QGIS by illustrating how to accomplish the 10 functions/workflows performed most often by desktop analysts.* Now part 2 will examine more in-depth capabilities that extend beyond core QGIS through the use of plugins, models and scripts.

One of the quintessential benefits of using open software is the massive community of developers and users who stand behind it.* This means more eyes checking the code for errors, and even more eyes looking to enhance the code and extend its capabilities. *Working at Boundless affords me the opportunity to connect with this community of developers, as I work alongside many of the steering committee members and core contributors of the software projects behind OpenGeo Suite.


Extending QGIS with Plugins

Proprietary desktop software is fairly WYSIWYG – what you see is what you get.* Since the source code is closed, additional functionality is usually only available through extensions you have to purchase for an additional cost.* QGIS on the other hand has an open source code base, and extending its functionality is limited only by your imagination (and your coding skills).* QGIS has a massive library of plugins written by fellow Boundless employees, QGIS developers and other independent users.* There are literally thousands of plugins available for use, ranging from coordinate conversion, to simplifying workflows, to connecting to specific data types and stores.* Plugins are made available to all QGIS users at https://plugins.qgis.org/, or directly inside of QGIS by using the Plugin dropdown.

As I continue my mission to educate and evangelize to organizations that QGIS is a worthy alternative to proprietary desktop GIS software, there are a few plugins I feel deserve to be highlighted.* The first increases QGIS ability to manipulate raster datasets.* The other two help connect the individual software applications into seamless workflows, making for an improved user experience, and are only available through the Enterprise Edition of OpenGeo Suite.

GDAL Tools Plugin

I am always shocked when someone asks me if QGIS supports imagery. Of course the answer is yes; raster datasets (to include imagery) are as much a part of GIS as points, lines and polygons.* I guess the part that shocks me is people thinking we would support a desktop GIS client that didn’t support imagery.* QGIS uses the GDAL library to read and write raster data formats, including ArcInfo Binary Grid, ArcInfo ASCII Grid, GeoTIFF, ERDAS IMAGINE, and many more.

If you aren’t familiar, GDAL stands for Geospatial Data Abstraction Library.* As noted on the GDAL website, GDAL is a translator library for raster and vector geospatial data formats that is released under an X/MIT style Open Source license by the Open Source Geospatial Foundation. In total, GDAL enables support for over 140 different raster formats, and over 80 different vector formats with the help of its brother OGR (now part of GDAL).

But more importantly QGIS also supports the management and manipulation of imagery as well.* The GDAL library consists of a set of command line programs, each with a large list of options. Users comfortable with running commands from a terminal may prefer the command line, with access to the full set of options. Example tools include raster management tools to query, re-project, warp and merge a wide variety of raster formats. *Also included are tools to create a contour (vector) layer, or a shaded relief from a raster DEM, as well as tool to make a VRT (Virtual Raster Tile in XML format) from a collection of one or more raster files.* But running the tools via a command line isn’t exactly simple for basic desktop analysts.* This is where the GDAL Tools plugin comes in.* It offers an easy-to-use GUI interface to the collection of GDAL tools, exposing only the most popular options as a series of drop down menus, tool dialogs and wizards.* It is a far more intuitive way to manipulate raster datasets, targeted at those users accustomed to using tools in ArcToolbox.* A full list of tools and their options are listed on the GDAL Tools website.

While you always have the full GDAL library available to you through the command line, this plugin makes it very easy to access some of the most commonly used raster and vector tools without intimidation factor of remembering command line syntax.

OpenGeo Explorer Plugin

One of the many benefits to using the Boundless version of OpenGeo Suite are the extra goodies that our team has created to make working with the software easier.* I can’t think of a better example of this than the OpenGeo Explorer plugin.


I love the fact that OpenGeo Suite provides a database, a server and a front end to work with, but I have never been a fan of having to opening three separate applications in order to administer each of them.* But not so fast, my friend (said in my best Lee Corso impression)!* This is where the OpenGeo Explorer plugin comes in, giving you the ability to configure the separate components of OpenGeo Suite from directly inside of QGIS!* You can prepare and style data, publish datasets to GeoServer, or stuff datasets into PostGIS all without leaving the application you are most comfortable using.
There is both an integrated catalog view and a tabbed view depending on your preference.* You can toggle this option, and many others, in the OpenGeo Explorer settings menu.

Perhaps you are the GIS Server administrator for your organization.* This plugin gives you the ability to publish symbolized layers from your QGIS document directly into GeoServer with a simple right-click > Publish to GeoServer.

Maybe you are managing the organization’s geodatabase, and need an easier method to add/drop tables or rename layers already inside PostGIS.* Or, maybe you want to import a .csv file of point locations into your PostGIS geodatabase.* The OpenGeo Explorer plugin can help with that too…

Bottom line, the OpenGeo Explorer plugin gives you the ability to author cartographic content inside QGIS and then publish it directly to GeoServer and PostGIS without ever leaving QGIS.* It’s a great timesaver, and makes the concept of publishing web mapping services super easy for even the most novice desktop GIS users.* If you are interested in learning more about the OpenGeo Explorer plugin, have a look at the documentation and tutorial on the Boundless QGIS page.

Web App Builder Plugin

The last plugin I want to highlight is the QGIS Web App Builder plugin.* Imagine if you will (said in my best Don LaFontaine “In a world…” impression) a world where you don’t have to write a single line of code to create your own custom OpenLayers 3 application.* Then imagine you could build that application with datasets you configure and symbolize from right inside of QGIS.* Mind blown yet?* Well believe it, creating an OL3 app has never been this easy before.
If you haven’t already done so, take a few minutes and read Building an OpenLayers 3 Web App Without Writing Code which my colleague Aaron Miller posted last week.* It’s a phenomenal primer and walkthrough for the capabilities inside this plugin.* So as to not repeat ourselves, I won’t walk through the plugin here, but I am going to focus on what the plugin means to desktop users.

As an analyst, there was no better feeling than seeing my work in a briefing or being asked to present it in front of decision makers.* For me, this usually meant plotting 24” x 36” paper “wall maps”, or exporting my work as “happy snaps” and putting them into a PowerPoint slide.* But static products just don’t have the same bang-for-the-buck as dynamic content.* Not to mention static products usually require someone to explain them (namely the analyst who created them).* But presenting your results as a web map or web application means I can simply share the URL to the application, and anyone can easily pan, zoom and click around to explore layers of information and analytical results.* And remember, web applications are dynamic.* Basemaps are cached for fast panning and zooming, layers will update as features are added or removed, and best of all, you can use a myriad of widgets against the data in the application.* You can measure objects, gazetteer search place names, query attributes and much, much more.* And with the help of the Web App Builder plugin, you no longer need to be a developer to share your work as a dynamic web application.* But you don’t have to take my word for it, try it yourself and see just how easy it is to create your very own app in just a couple minutes.

Extending QGIS with Models & Scripts

A lot of work inside a Desktop GIS is data manipulation; changing formats, importing tables, reprojecting, clipping, buffering, filtering by some attributes, etc.* Many times I find myself performing the same workflows over and over again, just on a different dataset in a different part of the world.* The tools in the GIS are great, but they are simple, sometimes low-level functions which have to be strung together with other tools to satisfy the needs of my workflow.* And this, my friends, is where models and scripts come in.

Processing Modeler

If you are familiar with ArcGIS for Desktop, you are probably aware of (if not intimately familiar with) ModelBuilder; the graphical user interface for connecting individual processes together into orchestrated workflows.* But did you know that QGIS also offers a ModelBuilder-like capability?* It’s called Processing Modeler and it’s available inside the Processing Toolbox of QGIS.
As you would expect, the processing modeler gives you the ability to string together independent processes into complete workflows.* In the example below, I built a model to automate selecting points which fall within a polygon.* This is a task I run daily, so rather than run tools and configure parameters each morning, I simply set up the workflow one time and run the tool as many times as needed.
Due to their visual nature, Models are a great first step into more advanced tool creation with scripting.* For some, scripting can be a bit intimidating, but the visual canvas that the Processing Modeler affords obfuscates the idea you are writing code behind the scenes.* Models are also a great way to learn about the individual tools available in the QGIS Processing Toolbox.

You can learn more about the QGIS processing framework and Processing Modeler in the QGIS 2.0 documentation.

Scripting with PyQGIS

Keeping in the spirit of QGIS customizability and extensibility, for those of you looking for more fine-grained control over your automated tasks, or looking for a way to ‘glue’ together processes from different applications, then Python and the PyQGIS module are the way to go.* Python is an easy-to-learn, yet very powerful scripting language used extensively in the geospatial community.* Both ArcGIS for Desktop and QGIS use Python as their language of choice for the creation of automation scripts and for extending their processing frameworks with custom capabilities.* So if you want to spend the time to learn a scripting language, Python is probably your best bet.

There are several ways you can interact with python scripting inside of QGIS.* The first (and arguably the easiest) is to interact with Python via the Python Console.* This is a built in window for executing simple Python commands against data in your QGIS project.* In the example below, I print out the name of the streams inside a stream feature class.
Of course you can also take it a step further and create standalone Python scripts which can be shared and imported into any QGIS instance.* To do this, simply use the Create new script function from the Processing toolbox.* It will open the script editor where you can begin to write your code.
In the example below I created a python script which will convert polygons to lines.* Shout out to PurpleLinux for the code snippet.* They have tons more to browse and help get you started.

Not only can standalone scripts be saved and shared amongst other QGIS users, but they can be used to call external applications, incorporate 3rd-party Python modules, develop custom functions and more.* This is where the true power of scripting with PyQGIS comes into play.* There are a lot of great tutorials and reference guides out there for getting started with PyQGIS, a few are listed below:

Python Plugins

Finally, for those wanting to take their Python skills to the next level, you can even create plugins for QGIS using Python.* Plugins allow for more control over the user interface and user experience, and can be exposed as buttons and drop-down menus directly on the QGIS GUI. As an example, the MGRS Coordinates plugin provided by Boundless leverages the Python support in QGIS.

In comparison with classic plugins written in C++ these should be easier to write, understand, maintain and distribute due the dynamic nature of the Python language.* Python plugins are listed together with C++ plugins in QGIS plugin manager.* The best place to get started with Python plugins would be the QGIS Documentation about developing plugins.

Wrapping it up

The goal of this blog series was to illustrate that QGIS satisfies the needs for both the casual and the advanced desktop user. *It contains that 80% of functionality which the majority of desktop GIS users use on an everyday basis, without the high cost of proprietary desktop GIS solutions.* But QGIS also has a vast community of open source contributors who continue to build advanced functionality to satisfy the power users too.* The model and scripting framework means users can create automated workflows to save time, and then share those workflows between other analysts.* Finally, the ability to create plugins means there is virtually no limit to what functionality can be built inside of QGIS.* Now more than ever QGIS is the ideal desktop application for your hybrid GIS environment.

The post A Desktop Analyst’s Guide to QGIS – Part 2: Beyond the Basics appeared first on Boundless.



أكثر...
 
أعلى