0% found this document useful (0 votes)
55 views

Learning QGIS - (1. Getting Started With QGIS)

Getting Started With QGIS

Uploaded by

hakim
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views

Learning QGIS - (1. Getting Started With QGIS)

Getting Started With QGIS

Uploaded by

hakim
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Chapter

1. Getting Started with QGIS


In this chapter, we will install and configure the QGIS geographic information system.
We will also get to know the user interface and how to customize it. By the end of this
chapter, you will have QGIS running on your machine and be ready to start with the
tutorials.

Installing QGIS
QGIS runs on Windows, various Linux distributions, Unix, Mac OS X, and Android.
Also, the QGIS project provides ready-to-use packages as well as instructions to
build from the source code at http://download.qgis.org. We will cover how to install
QGIS on two systems: Windows and Ubuntu, as well as how to avoid the most
common pitfalls.

Note
Further installation instructions for other supported operating systems are
available at http://www.qgis.org/en/site/forusers/alldownloads.html.

Like many other open source projects, QGIS offers you a choice between a stable
release version and the cutting-edge developer version, also called master or
testing. QGIS master/testing will contain the latest and greatest developments, but
be warned that on some days, it might not work as reliably as you want it to. For the
tutorials in this book, we will use the QGIS 2.6 stable release.

Installing QGIS on Windows


Copyright 2014. Packt Publishing. All rights reserved.

On Windows, we have two different options to install QGIS: the standalone installer
and the OSGeo4W installer. The standalone installer is one big file to download
(approximately 260 MB for the 64-bit version and 320 MB for the 32-bit version); it
contains a QGIS release and the Geographic Resources Analysis Support
System (GRASS) GIS in one package. The OSGeo4W installer is a small, flexible
installation tool that makes it possible to download and install QGIS and many more
OSGeo tools with all their dependencies. The main advantage of this over the
standalone installer is that it makes updating QGIS and its dependencies very easy.
You can always have access to both the current and the developer versions, if you
chose to, but of course, you are never forced to update. That is why I recommend
Graser, Anita. Learning QGIS, Packt Publishing, 2014. ProQuest Ebook Central, http://ebookcentral.proquest.com/lib/surrey/detail.action?docID=1886728.<br>Created from surrey on 2017-11-28 08:59:13.
that you use OSGeo4W. You can download the 32-bit and 63-bit OSGeo4W installers
from http://osgeo4w.osgeo.org (or directly from
http://download.osgeo.org/osgeo4w/osgeo4w-setup-x86.exe for the 32-bit version or
http://download.osgeo.org/osgeo4w/osgeo4w-setup-x86_64.exe if you have a 64-bit
version of Windows). Download the version that matches your operating system and
keep it! In the future, whenever you want to change or update your system, just run it
again.

Tip
Regardless of the installer you choose, make sure that you avoid special
characters such as German umlauts or letters from alphabets other than the
default Latin ones in the installation path, as they can cause problems later on, for
example, during plugin installation.

When the OSGeo4W installer starts, we get to choose between the Express
Desktop, Express Web-GIS, and Advanced installations. To install the QGIS
release version, we can simply select the Express Desktop option, and the next
dialog box will list the available desktop applications, such as QGIS, uDig, and
GRASS GIS. We can simply select QGIS, click on Next, and the download and
installation will start automatically. When the installation is finished, there will be
desktop shortcuts and start-menu entries for OSGeo4W and QGIS.

If we want to install QGIS master/testing, we need to go through the Advanced


installation. This installation path offers many options, such as Download without
installing and Install from Local Directory, which can be used to download all the
necessary packages on one machine to later install them on machines without
Internet access. It's usually not necessary to change the default settings, but if your
machine is, for example, hidden behind a proxy, you will be able to specify it here.
After the installer fetches the latest package information from OSGeo's servers, we
Copyright 2014. Packt Publishing. All rights reserved.

get to pick the packages for installation. QGIS master/testing is listed in the desktop
category as qgis-dev. To select it for installation, click on the text that reads Skip,
and it will change and display the version number. The installer will automatically
select all the necessary dependencies (such as GDAL, SAGA, OTB, and GRASS),
so we don't have to worry about this. After clicking on Next, the download and
installation starts automatically, just like in the Express version. The dialog will look
like the following screenshot:

Graser, Anita. Learning QGIS, Packt Publishing, 2014. ProQuest Ebook Central, http://ebookcentral.proquest.com/lib/surrey/detail.action?docID=1886728.<br>Created from surrey on 2017-11-28 08:59:13.
If you try to run QGIS and get a pop up that says, The procedure entry point
<some-name> could not be located in the dynamic link library <dll-name>.dll, it
means that you are facing a common issue on Windows systems: a DLL conflict. This
error is easy to fix; just copy the DLL file mentioned in the error message from
C:\OSGeo4W\bin\ to C:\OSGeo4W\apps\qgis\bin\ (adjust the paths if necessary).

Installing QGIS on Ubuntu


Copyright 2014. Packt Publishing. All rights reserved.

On Ubuntu, the QGIS project provides packages for both the release and developer
versions. At the time of writing this book, the Ubuntu versions Precise, Saucy, and
Trusty, are supported, but you can find the latest information at
http://qgis.org/en/site/forusers/alldownloads.html#ubuntu. Be aware, though, that you
can only install one version at a time. The packages are not listed in the default
Ubuntu repositories. Therefore, we have to add the appropriate repositories to
Ubuntu's source list, which you can find at /etc/apt/sources.list. You can open the
file with any text editor.

Make sure that you have superuser rights, as you need them to save your edits. One
Graser, Anita. Learning QGIS, Packt Publishing, 2014. ProQuest Ebook Central, http://ebookcentral.proquest.com/lib/surrey/detail.action?docID=1886728.<br>Created from surrey on 2017-11-28 08:59:13.
option is to use gedit, which is installed on Ubuntu by default. To edit the
sources.list file, use the following command:

sudo gedit /etc/apt/sources.list

Make sure that you add only one of the following four package-source options to
avoid conflicts due to incompatible packages. The specific lines that you have to add
to the source list depend on your Ubuntu version.

1. The first option, which is also the default one, is to install the current version. To
install the QGIS release on Trusty Tahr, add the following lines to your file:
deb http://qgis.org/debian trusty main
deb-src http://qgis.org/debian trusty main

If necessary, replace trusty with saucy or precise to fit your system. For an
updated list of supported Ubuntu versions, visit http://download.qgis.org.

2. The second option is to install the QGIS master, which is currently available for
trusty, saucy, utopic, and precise. Add the following lines to your file:

deb http://qgis.org/debian-nightly trusty main


deb-src http://qgis.org/debian-nightly trusty main

Tip
The preceding versions depend on other packages such as GDAL and proj4,
which are available in the Ubuntu repositories. It is worth mentioning that
these packages are often quite old.
Copyright 2014. Packt Publishing. All rights reserved.

3. The third option is to install the QGIS release version with updated
dependencies, which are provided by the ubuntugis repository. Add the following
lines to your file:
deb http://ppa.launchpad.net/ubuntugis/ubuntugis-
unstable/ubuntu trusty main
deb-src http://ppa.launchpad.net/ubuntugis/ubuntugis-
unstable/ubuntu trusty main

4. The fourth option is the QGIS master with updated dependencies. Add the
following lines to your file:
deb http://qgis.org/ubuntugis-nightly trusty main
deb-src http://qgis.org/ubuntugis-nightly trusty main
Graser, Anita. Learning QGIS, Packt Publishing, 2014. ProQuest Ebook Central, http://ebookcentral.proquest.com/lib/surrey/detail.action?docID=1886728.<br>Created from surrey on 2017-11-28 08:59:13.
deb http://ppa.launchpad.net/ubuntugis/ubuntugis-
unstable/ubuntu trusty main

After choosing the repository, we will add the qgis.org repository's public key to our
apt keyring. This will avoid warnings that you might otherwise get when installing from
a non-default repository. Run the following command in the terminal:

gpg --keyserver keyserver.ubuntu.com --recv DD45F6C3


gpg --export --armor DD45F6C3 | sudo apt-key add

Note
By the time this book goes into print, the key information might change. Refer to
http://qgis.org/en/site/forusers/alldownloads.html#ubuntu for the latest updates.

Finally, to install QGIS, run the following commands:

sudo apt-get update


sudo apt-get install qgis python-qgis qgis-plugin-grass
Copyright 2014. Packt Publishing. All rights reserved.

Graser, Anita. Learning QGIS, Packt Publishing, 2014. ProQuest Ebook Central, http://ebookcentral.proquest.com/lib/surrey/detail.action?docID=1886728.<br>Created from surrey on 2017-11-28 08:59:13.
Running QGIS for the first time
When you install QGIS, you get two applications: QGIS Desktop and QGIS
Browser. If you are familiar with ArcGIS, you can think of QGIS Browser as similar
to ArcCatalog. It is a small application to preview spatial data and related metadata.
For the remainder of this book, we will focus on QGIS Desktop.

By default, QGIS uses the operating system's default language. To follow the tutorials
in this book, I advise you to change the language to English by going to Settings |
Options | Locale. On the first run, the way the toolbars are arranged can hide some
buttons. To be able to work efficiently, I suggest that you rearrange the toolbars. I
like to add some toolbars on the left and right screen borders to save vertical screen
estateespecially on wide screen displays.

Additionally, we activate the file browser by going to View | Panels | Browser. It


provides us with a quick access to our spatial data. In the end, the QGIS window on
your screen should look similar to the following screenshot:
Copyright 2014. Packt Publishing. All rights reserved.

Graser, Anita. Learning QGIS, Packt Publishing, 2014. ProQuest Ebook Central, http://ebookcentral.proquest.com/lib/surrey/detail.action?docID=1886728.<br>Created from surrey on 2017-11-28 08:59:13.
Next, we activate some must-have plugins by going to Plugins | Manage and Install
Plugins. Plugins are activated by ticking the checkboxes beside their names. To
begin with, I recommend the following:

Coordinate Capture: This plugin is useful to pick coordinates in the map


fTools: This plugin offers vector analysis and management tools
GdalTools: This plugin offers raster analysis and management tools
Processing: This plugin provides access to many useful raster and vector
analyses tools as well as a model builder for task automation

To make it easier to find specific plugins, we can filter the list of plugins using the
Search input field at the top of the window, which you can see in the following
screenshot:
Copyright 2014. Packt Publishing. All rights reserved.

Graser, Anita. Learning QGIS, Packt Publishing, 2014. ProQuest Ebook Central, http://ebookcentral.proquest.com/lib/surrey/detail.action?docID=1886728.<br>Created from surrey on 2017-11-28 08:59:13.
Introducing the QGIS user interface
Now that we have set up QGIS, let's get accustomed to the interface! As we already
saw in the screenshot presented in the Running QGIS for the first time section, the
biggest area is reserved for the map. To the left of the map, there are the Layers
and Browser panels. In the following screenshot, you can see how the Layers panel
looks like once we have loaded some layers (which we will do in the upcoming
chapter Viewing Spatial Data). To the left of each layer entry, you can see a preview
of the layer style. Additionally, we can use layer groups to structure the layer list.
The Browser panel (shown in the following screenshot) provides us with a quick
access to our spatial data, as you will soon see in the following chapter.

Below the map, we find important information such as (from left to right) the current
map Coordinates, map Scale, and the (currently inactive) project coordinate
reference system (CRS), for example, EPSG:4326 in the following screenshot:

Next, there are multiple toolbars to explore. If you arrange them as shown in the
previous section, the top row will look like this:
Copyright 2014. Packt Publishing. All rights reserved.

The first row contains the following toolbars:

File: This toolbar contains the tools to create, open, save, and print projects
Manage Layers: This toolbar contains the tools to add layers from the vector or
raster files, databases, web services, and text files or create new layers
Database: Currently, this toolbar only contains DB Manager, but other database-
related tools (for example, the OfflineEditing plugin, which allows us to edit
offline and synchronize with databases) will appear here when they are installed
Graser, Anita. Learning QGIS, Packt Publishing, 2014. ProQuest Ebook Central, http://ebookcentral.proquest.com/lib/surrey/detail.action?docID=1886728.<br>Created from surrey on 2017-11-28 08:59:13.
Help: Toolbar points to the option to download the user manual

The second row of toolbars looks like this:

The second row contains the following toolbars:

Map Navigation: This contains the pan and zoom tools


Attributes: These tools are used to identify, select, open attribute tables,
measure, and so on
Label: These tools are used to add, configure, and modify labels

On the left screen border, we will add the following toolbar:

Raster: This toolbar includes histogram stretch, brightness, and contrast control
Vector: This currently only contains the Coordinate Capture tool, but it will be
filled by additional Python plugins
Plugins: This is currently empty, but will be filled by additional Python plugins
Web: This is currently empty, but will be filled by additional Python plugins

Finally, on the right screen border, we find the following toolbar:

Digitizing: The tools in this toolbar enable editing, basic feature creation, and
editing
Advanced Digitizing: This toolbar contains the undo/redo option, advanced
editing tools, the geometry-simplification tool, and so on
Copyright 2014. Packt Publishing. All rights reserved.

Tip
All digitizing tools are currently inactive. They will only turn active once we start
editing a vector layer.

Toolbars and panels can be activated and deactivated via the View menu's Panels
and Toolbars entries as well as by right-clicking on a menu or toolbar, which will
open a context menu with all the available toolbars and panels. All the tools on the
toolbars can also be accessed via the menu. If you deactivate the Manage Layers
Graser, Anita. Learning QGIS, Packt Publishing, 2014. ProQuest Ebook Central, http://ebookcentral.proquest.com/lib/surrey/detail.action?docID=1886728.<br>Created from surrey on 2017-11-28 08:59:13.
toolbar, for example, you will still be able to add layers using the Layer menu.

QGIS is highly customizable. You can increase your productivity by assigning


shortcuts to the tools you use regularly, by navigating to Settings | Configure
shortcuts. Similarly, if you find that you never use a certain toolbar button or menu
entry, you can hide it by navigating to Settings | Customization. For example, if you
don't have access to an Oracle Spatial database, you might want to hide the
associated buttons to remove the clutter and save the screen estate, as shown in the
following screenshot:
Copyright 2014. Packt Publishing. All rights reserved.

Graser, Anita. Learning QGIS, Packt Publishing, 2014. ProQuest Ebook Central, http://ebookcentral.proquest.com/lib/surrey/detail.action?docID=1886728.<br>Created from surrey on 2017-11-28 08:59:13.
Summary
In this chapter, we installed QGIS and configured it by selecting useful defaults and
arranging the user-interface elements. Finally, we explored the panels, toolbars, and
menus that make up the QGIS user interface and learned how to customize them to
increase productivity. In the following chapter, we will use QGIS to view spatial data
from different data sources such as files, databases, and web services.
Copyright 2014. Packt Publishing. All rights reserved.

Graser, Anita. Learning QGIS, Packt Publishing, 2014. ProQuest Ebook Central, http://ebookcentral.proquest.com/lib/surrey/detail.action?docID=1886728.<br>Created from surrey on 2017-11-28 08:59:13.

You might also like