Search icon CANCEL
Subscription
0
Cart icon
Cart
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Learning QGIS - Third Edition
Learning QGIS - Third Edition

Learning QGIS: Create great maps and perform geoprocessing tasks with ease, Third Edition

By Anita Graser
$15.99 per month
Book Mar 2016 210 pages 3rd Edition
eBook
$29.99 $20.98
Print
$38.99
Subscription
$15.99 Monthly
eBook
$29.99 $20.98
Print
$38.99
Subscription
$15.99 Monthly

What do you get with a Packt Subscription?

Free for first 7 days. $15.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing
Table of content icon View table of contents Preview book icon Preview Book

Learning QGIS - Third Edition

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. 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 different releases. For the tutorials in this book, we will use the QGIS 2.14 LTR version. The following options are available:

  • Long-term release (LTR): The LTR version is recommended for corporate and academic use. It is currently released once per year in the end of February. It receives bug fix updates for at least a year, and the features and user interface remain unchanged. This makes it the best choice for training material that should not become outdated after a few months.

  • Latest release (LR): The LR version contains newly developed and tested features. It is currently released every four months (except when an LTR version is released instead). Use this version if you want to stay up to date with the latest developments, including new features and user interface changes, but are not comfortable with using the DEV version.

  • Developer version (DEV, master, or testing): The cutting-edge DEV version contains the latest and greatest developments, but be warned that on some days, it might not work as reliably as you want it to.

Note

You can find more information about the releases as well as the schedule for future releases at http://www.qgis.org/en/site/getinvolved/development/roadmap.html#release-schedule.

For an overview of the changes between releases, check out the visual change logs at http://www.qgis.org/en/site/forusers/visualchangelogs.html.

Installing QGIS on Windows

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 280 MB); it contains a QGIS release, the Geographic Resources Analysis Support System (GRASS) GIS, as well as the System for Automated Geoscientific Analyses (SAGA) 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 installer over the standalone installer is that it makes updating QGIS and its dependencies very easy. You can always have access to both the current release and the developer versions if you choose to, but, of course, you are never forced to update. That is why I recommend that you use OSGeo4W. You can download the 32-bit and 64-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 (for details, refer to https://en.wikipedia.org/wiki/ISO_basic_Latin_alphabet) 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 Express Desktop Install, Express Web-GIS Install, and Advanced Install. To install the QGIS LR version, we can simply select the Express Desktop Install option, and the next dialog will list the available desktop applications, such as QGIS, uDig, and GRASS GIS. We can simply select QGIS, click on Next, and confirm the necessary dependencies by clicking on Next again. Then the download and installation will start automatically. When the installation is complete, there will be desktop shortcuts and start menu entries for OSGeo4W and QGIS.

To install QGIS LTR (or DEV), we need to go through the Advanced Install option, as shown in the following screenshot:

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 and later install them on machines without Internet access. We just select Install from Internet, as shown in this screenshot:

When selecting the installation Root Directory, as shown in the following screenshot, avoid special characters such as German umlauts or letters from alphabets other than the default Latin ones in the installation path (as mentioned before), as they can cause problems later on, for example, during plugin installation:

Then you can specify the folder (Local Package Directory) where the setup process will store the installation files as well as customize Start menu name. I recommend that you leave the default settings similar to what you can see in this screenshot:

In the Internet connection settings, it is 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:

Then we can pick the download site. At the time of writing this book, there is only one download server available, anyway, as you can see in the following screenshot:

After the installer fetches the latest package information from OSGeo's servers, we get to pick the packages for installation. QGIS LTR is listed in the desktop category as qgis-ltr (and the DEV version is listed as qgis-dev). To select the LTR version for installation, click on the text that reads Skip, and it will change and display the version number, as shown in this screenshot:

As you can see in the following screenshot, 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 you've clicked on Next, the download and installation starts automatically, just as in the Express version.

You have probably noticed other available QGIS packages called qgis-ltr-dev and qgis-rel-dev. These contain the latest changes (to the LTR and LR versions, respectively), which will be released as bug fix versions according to the release schedule. This makes these packages a good option if you run into an issue with a release that has been fixed recently but the bug fix version release is not out yet.

Tip

If you try to run QGIS and get a popup 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 on Ubuntu

On Ubuntu, the QGIS project provides packages for the LTR, LR, and DEV versions. At the time of writing this book, the Ubuntu versions Precise, Trusty, Vivid, and Wily are supported, but you can find the latest information at http://www.qgis.org/en/site/forusers/alldownloads.html#debian-ubuntu. Be aware, however, that you can install only 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 super user rights, as you will need them to save your edits. One option is to use gedit, which is installed in Ubuntu by default. To edit the sources.list file, use the following command:

sudo gedit /etc/apt/sources.list

Tip

Downloading the example code

You can download the example code files for this book from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Make sure that you add only one of the following 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 LR version. To install the QGIS LR release on Trusty, add the following lines to your file:

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

    Note

    If necessary, replace trusty with precise, vivid, or wily to fit your system. For an updated list of supported Ubuntu versions, check out http://www.qgis.org/en/site/forusers/alldownloads.html#debian-ubuntu.

  2. The second option is to install QGIS LTR by adding the following lines to your file:

    deb     http://qgis.org/debian-ltr trusty main
    deb-src http://qgis.org/debian-ltr trusty main
    
  3. The third option is to install QGIS DEV by adding these 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.

  4. The fourth option is to install QGIS LR with updated dependencies, which are provided by the ubuntugis repository. Add these lines to your file:

    deb     http://qgis.org/ubuntugis trusty main
    deb-src http://qgis.org/ubuntugis trusty main
    deb     http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu trusty main
    
  5. The fifth option is QGIS LTR with updated dependencies. Add these lines to your file:

    deb     http://qgis.org/ubuntugis-ltr trusty main
    deb-src http://qgis.org/ubuntugis-ltr trusty main
    deb     http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu trusty main
    
  6. The sixth option is the QGIS master with updated dependencies. Add these lines to your file:

    deb     http://qgis.org/ubuntugis-nightly trusty main
    deb-src http://qgis.org/ubuntugis-nightly trusty main
    deb     http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu trusty main
    

Note

To follow the tutorials in this book, it is recommended that you install QGIS 2.14 LTR with updated dependencies (the fifth option).

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

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key 3FF5FFCAD71472C4

Note

By the time this book goes to print, the key information might have changed. Refer to http://www.qgis.org/en/site/forusers/alldownloads.html#debian-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

Running QGIS for the first time


When you install QGIS, you will get two applications: QGIS Desktop and QGIS Browser. If you are familiar with ArcGIS, you can think of QGIS Browser as something similar to ArcCatalog. It is a small application used to preview spatial data and related metadata. For the remainder of this book, we will focus on QGIS Desktop.

By default, QGIS will use 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 (for the sake of completeness, I have enabled all toolbars in Toolbars, which is in the View menu). I like to place some toolbars on the left and right screen borders to save vertical screen estate, especially on wide-screen displays.

Additionally, we will activate the file browser by navigating to View | Panels | Browser Panel. It will provide us with quick access to our spatial data. At the end, the QGIS window on your screen should look similar to the following screenshot:

Next, we will activate some must-have plugins by navigating to Plugins | Manage and Install Plugins. Plugins are activated by ticking the checkboxes beside their names. To begin with, I will recommend the following:

  • Coordinate Capture: This plugin is useful for picking coordinates in the map

  • DB Manager: This plugin helps you manage the SpatiaLite and PostGIS databases

  • 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 analysis 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:

Introducing the QGIS user interface


Now that we have set up QGIS, let's get accustomed to the interface. As we have already seen 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 once we have loaded some layers (which we will do in the upcoming Chapter 2, Viewing Spatial Data). To the left of each layer entry, you can see a preview of the layer style. Additionally, we can use layer group to structure the layer list. The Browser Panel (on the right-hand side in the following screenshot) provides us with 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 Coordinate, map Scale, and the (currently inactive) project coordinate reference system (CRS), for example, EPSG:4326 in this screenshot:

Next, there are multiple toolbars to explore. If you arrange them as shown in the previous section, the top row contains the following toolbars:

  • File: This toolbar contains the tools needed to Create, Open, Save, and Print projects

  • Map Navigation: This toolbar contains the pan and zoom tools

  • Attributes: These tools are used to identify, select, open attribute tables, measure, and so on, and looks like this:

The second row contains the following toolbars:

  • Label: These tools are used to add, configure, and modify labels

  • Plugins: This currently only contains the Python Console tool, but will be filled in by additional Python plugins

  • 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

  • Raster: This toolbar includes histogram stretch, brightness, and contrast control

  • Vector: This currently only contains the Coordinate Capture tool, but it will be filled in by additional Python plugins

  • Web: This is currently empty, but it will also be filled in by additional Python plugins

  • Help: This toolbar points to the option for downloading the user manual and looks like this:

On the left screen border, we place the Manage Layers toolbar. This toolbar contains the tools for adding layers from the vector or raster files, databases, web services, and text files or create new layers:

Finally, on the right screen border, we have two more toolbars:

  • 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, which look like this:

Tip

All digitizing tools (except the Enable advanced digitizing tools button) are currently inactive. They will turn active only 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 Toolbar, for example, you will still be able to add layers using the Layer menu.

As you might have guessed by now, QGIS is highly customizable. You can increase your productivity by assigning shortcuts to the tools you use regularly, which you can do by going to Settings | Configure Shortcuts. Similarly, if you realize that you never use a certain toolbar button or menu entry, you can hide it by going 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 clutter and save screen estate, as shown in the following screenshot:

Finding help and reporting issues


The QGIS community offers a variety of different community-based support options. These include the following:

Tip

Before contacting the community support, it's recommended to first take a look at the documentation at http://docs.qgis.org.

If you prefer commercial support, you can find a list of companies that provide support and custom development at http://www.qgis.org/en/site/forusers/commercial_support.html#qgis-commercial-support.

If you find a bug, please report it because the QGIS developers can only fix the bugs that they are aware of. For details on how to report bugs, visit http://www.qgis.org/en/site/getinvolved/development/bugreporting.html.

Summary


In this chapter, we installed QGIS and configured it by selecting useful defaults and arranging the user interface elements. Then we explored the panels, toolbars, and menus that make up the QGIS user interface, and you 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 in order to create our first map.

Left arrow icon Right arrow icon

Key benefits

  • Learn how to work with various data and create beautiful maps using this easy-to-follow guide.
  • Give a touch of professionalism to your maps both for functionality and look and feel with the help of this practical guide.
  • A progressive hands-on guide that builds on a geo-spatial data and adds more reactive maps by using geometry tools.

Description

QGIS is a user-friendly open source geographic information system (GIS) that runs on Linux, Unix, Mac OS X, and Windows. The popularity of open source geographic information systems and QGIS in particular has been growing rapidly over the last few years. Learning QGIS Third Edition is a practical, hands-on guide updated for QGIS 2.14 that provides you with clear, step-by-step exercises to help you apply your GIS knowledge to QGIS. Through clear, practical exercises, this book will introduce you to working with QGIS quickly and painlessly. This book takes you from installing and configuring QGIS to handling spatial data to creating great maps. You will learn how to load and visualize existing spatial data and create data from scratch. You will get to know important plugins, perform common geoprocessing and spatial analysis tasks and automate them with Processing. We will cover how to achieve great cartographic output and print maps. Finally, you will learn how to extend QGIS using Python and even create your own plugin.

What you will learn

[*] Install QGIS and get familiar with the user interface [*] Load vector and raster data from files, databases, and web services [*] Create, visualize, and edit spatial data [*] Perform geoprocessing tasks and automate them [*] Create advanced cartographic outputs [*] Design great print maps [*] Expand QGIS using Python

Product Details

Country selected

Publication date : Mar 10, 2016
Length 210 pages
Edition : 3rd Edition
Language : English
ISBN-13 : 9781785880339
Category :

What do you get with a Packt Subscription?

Free for first 7 days. $15.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing

Product Details


Publication date : Mar 10, 2016
Length 210 pages
Edition : 3rd Edition
Language : English
ISBN-13 : 9781785880339
Category :

Table of Contents

13 Chapters
Learning QGIS Third Edition Chevron down icon Chevron up icon
Credits Chevron down icon Chevron up icon
About the Author Chevron down icon Chevron up icon
About the Reviewer Chevron down icon Chevron up icon
www.PacktPub.com Chevron down icon Chevron up icon
Preface Chevron down icon Chevron up icon
1. Getting Started with QGIS Chevron down icon Chevron up icon
2. Viewing Spatial Data Chevron down icon Chevron up icon
3. Data Creation and Editing Chevron down icon Chevron up icon
4. Spatial Analysis Chevron down icon Chevron up icon
5. Creating Great Maps Chevron down icon Chevron up icon
6. Extending QGIS with Python Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Empty star icon Empty star icon Empty star icon Empty star icon Empty star icon 0
(0 Ratings)
5 star 0%
4 star 0%
3 star 0%
2 star 0%
1 star 0%
Top Reviews
No reviews found
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is included in a Packt subscription? Chevron down icon Chevron up icon

A subscription provides you with full access to view all Packt and licnesed content online, this includes exclusive access to Early Access titles. Depending on the tier chosen you can also earn credits and discounts to use for owning content

How can I cancel my subscription? Chevron down icon Chevron up icon

To cancel your subscription with us simply go to the account page - found in the top right of the page or at https://subscription.packtpub.com/my-account/subscription - From here you will see the ‘cancel subscription’ button in the grey box with your subscription information in.

What are credits? Chevron down icon Chevron up icon

Credits can be earned from reading 40 section of any title within the payment cycle - a month starting from the day of subscription payment. You also earn a Credit every month if you subscribe to our annual or 18 month plans. Credits can be used to buy books DRM free, the same way that you would pay for a book. Your credits can be found in the subscription homepage - subscription.packtpub.com - clicking on ‘the my’ library dropdown and selecting ‘credits’.

What happens if an Early Access Course is cancelled? Chevron down icon Chevron up icon

Projects are rarely cancelled, but sometimes it's unavoidable. If an Early Access course is cancelled or excessively delayed, you can exchange your purchase for another course. For further details, please contact us here.

Where can I send feedback about an Early Access title? Chevron down icon Chevron up icon

If you have any feedback about the product you're reading, or Early Access in general, then please fill out a contact form here and we'll make sure the feedback gets to the right team. 

Can I download the code files for Early Access titles? Chevron down icon Chevron up icon

We try to ensure that all books in Early Access have code available to use, download, and fork on GitHub. This helps us be more agile in the development of the book, and helps keep the often changing code base of new versions and new technologies as up to date as possible. Unfortunately, however, there will be rare cases when it is not possible for us to have downloadable code samples available until publication.

When we publish the book, the code files will also be available to download from the Packt website.

How accurate is the publication date? Chevron down icon Chevron up icon

The publication date is as accurate as we can be at any point in the project. Unfortunately, delays can happen. Often those delays are out of our control, such as changes to the technology code base or delays in the tech release. We do our best to give you an accurate estimate of the publication date at any given time, and as more chapters are delivered, the more accurate the delivery date will become.

How will I know when new chapters are ready? Chevron down icon Chevron up icon

We'll let you know every time there has been an update to a course that you've bought in Early Access. You'll get an email to let you know there has been a new chapter, or a change to a previous chapter. The new chapters are automatically added to your account, so you can also check back there any time you're ready and download or read them online.

I am a Packt subscriber, do I get Early Access? Chevron down icon Chevron up icon

Yes, all Early Access content is fully available through your subscription. You will need to have a paid for or active trial subscription in order to access all titles.

How is Early Access delivered? Chevron down icon Chevron up icon

Early Access is currently only available as a PDF or through our online reader. As we make changes or add new chapters, the files in your Packt account will be updated so you can download them again or view them online immediately.

How do I buy Early Access content? Chevron down icon Chevron up icon

Early Access is a way of us getting our content to you quicker, but the method of buying the Early Access course is still the same. Just find the course you want to buy, go through the check-out steps, and you’ll get a confirmation email from us with information and a link to the relevant Early Access courses.

What is Early Access? Chevron down icon Chevron up icon

Keeping up to date with the latest technology is difficult; new versions, new frameworks, new techniques. This feature gives you a head-start to our content, as it's being created. With Early Access you'll receive each chapter as it's written, and get regular updates throughout the product's development, as well as the final course as soon as it's ready.We created Early Access as a means of giving you the information you need, as soon as it's available. As we go through the process of developing a course, 99% of it can be ready but we can't publish until that last 1% falls in to place. Early Access helps to unlock the potential of our content early, to help you start your learning when you need it most. You not only get access to every chapter as it's delivered, edited, and updated, but you'll also get the finalized, DRM-free product to download in any format you want when it's published. As a member of Packt, you'll also be eligible for our exclusive offers, including a free course every day, and discounts on new and popular titles.