Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
QGIS 2 Cookbook

You're reading from   QGIS 2 Cookbook Become a QGIS power user and master QGIS data management, visualization, and spatial analysis techniques

Arrow left icon
Product type Paperback
Published in Apr 2016
Publisher
ISBN-13 9781783984961
Length 390 pages
Edition 1st Edition
Tools
Arrow right icon
Authors (3):
Arrow left icon
Anita Graser Anita Graser
Author Profile Icon Anita Graser
Anita Graser
Víctor Olaya Ferrero Víctor Olaya Ferrero
Author Profile Icon Víctor Olaya Ferrero
Víctor Olaya Ferrero
Alex Mandel Alex Mandel
Author Profile Icon Alex Mandel
Alex Mandel
Arrow right icon
View More author details
Toc

Table of Contents (14) Chapters Close

Preface 1. Data Input and Output FREE CHAPTER 2. Data Management 3. Common Data Preprocessing Steps 4. Data Exploration 5. Classic Vector Analysis 6. Network Analysis 7. Raster Analysis I 8. Raster Analysis II 9. QGIS and the Web 10. Cartography Tips 11. Extending QGIS 12. Up and Coming Index

Using the Python console

QGIS has a built-in Python console, where you can enter commands in the Python programming language and get results. This is very useful for quick data processing.

Getting ready

To follow this recipe, you should be familiar with the Python programming language. You can find a small but detailed tutorial in the official Python documentation at https://docs.python.org/2.7/tutorial/index.html.

Also load the poi_names_wake.shp file from the sample data.

How to do it…

QGIS Python console can be opened by clicking on the Python Console button at toolbar or by navigating to Plugins | Python Console. The console opens as a non-modal floating window, as shown in the following screenshot:

How to do it…

Let's take a look at how to perform some data exploration with the QGIS Python console:

  1. First, it is necessary to get a reference to the active (selected in the layers tree) layer and store it in the variable for further use by running this command:
    layer = iface.activeLayer()
    
  2. After...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image