Graphics Reference
In-Depth Information
Linking QGIS and Python
While QGIS itself is written in C++, it includes extensive support for Python programming.
A Python interpreter is built in, and can be used interactively via the Python Console, or to
run plugins written in Python. There is also a comprehensive API for querying and con-
trolling the QGIS application using Python code.
There are three ways in which you can use Python to work with the QGIS system:
Python Console : You can open this console, which runs the interactive Python in-
terpreter built into QGIS, allowing you to type in commands and see the results
immediately.
Python plugin : These are Python packages designed to be run within the QGIS
environment.
• E xternal applications : You can use the QGIS Python API in your own applica-
tions. This lets you use QGIS as a geospatial processing engine, or even build your
own interactive applications based on QGIS.
No matter how you use Python and QGIS, you will make extensive use of the QGIS
Python libraries, which are often referred to as PyQGIS . They provide a complete pro-
grammatic interface to the QGIS system, including calls to load data sources into layers,
manipulate the map, export map visualizations, and build custom applications using the
QGIS user interface. While an in-depth examination of the PyQGIS library will have to
wait until Chapter 3 , Learning the QGIS Python API , we will start dabbling with it right
away in the next section on the Python Console.
For the remainder of this chapter, we will examine each of the three ways in which you can
work with QGIS and Python.
Search WWH ::




Custom Search