14
Developing with QGIS: What’s Possible? Lutra Consulting

QGIS UK: Developing with QGIS - What is possible (Lutra Consulting)

Embed Size (px)

DESCRIPTION

From Pete Wells an overview of the modular structure of QGIS under the hood and the different ways of interacting with the functionality exposed by the API through Python. Includes a list of examples and plugins developed for QGIS with Python.

Citation preview

Page 1: QGIS UK: Developing with QGIS - What is possible (Lutra Consulting)

Developing with QGIS: What’s Possible?

Lutra Consulting

Page 2: QGIS UK: Developing with QGIS - What is possible (Lutra Consulting)

Its internal arrangement

QGIS

Developing with QGIS: What’s Possible?

● QGIS is very modular

● The QGIS you see is a wrapper

around these libraries:

● QgsGui

● QgsAnalysis

● QgsCore

N

Page 3: QGIS UK: Developing with QGIS - What is possible (Lutra Consulting)

What are they?

Python Bindings

● Intermediate layer

● Expose functionality to Python

● Allow functionality to be loaded as a

python module

● Advantages of using Python (over C++):

● Quicker to develop (less lines)

● Code is portable

N

Developing with QGIS: What’s Possible?

Page 4: QGIS UK: Developing with QGIS - What is possible (Lutra Consulting)

Interaction

Plugins

Developing with QGIS: What’s Possible?

● Plugins can be C++ or

Python

● QgisInterface class

provides 'point of

attachment' for plugins

● Only functionality exposed

via QgisInterface can be

used by plugins

● Functionality of

QgisInterface actually

implemented in QGIS

Application

● Plugins 'attach' here

N

Page 5: QGIS UK: Developing with QGIS - What is possible (Lutra Consulting)

Using QgisInterface

Plugins

Developing with QGIS: What’s Possible?

● QgisInterface object facilitates interaction with QGIS through Python:

● Determining layer count

● Loading layers

● Accessing loaded layers

● Accessing features and their geometry

● Etc.

N

Page 6: QGIS UK: Developing with QGIS - What is possible (Lutra Consulting)

GUI library example

Plugins

Developing with QGIS: What’s Possible?

● The GUI library provides a number of GUI elements.

● For example the familiar CRS selector:

N

Page 7: QGIS UK: Developing with QGIS - What is possible (Lutra Consulting)

Core library example

Plugins

Developing with QGIS: What’s Possible?

● The Core library allows us to work with:

● Layers

● Features

● Geometry

● Projections

● Rendering

● Measurement

● Expression engine

● Snapping

● Spatial indexing

N

Page 8: QGIS UK: Developing with QGIS - What is possible (Lutra Consulting)

InaSAFE - Indonesian Scenario Assessment for Emergencies

Example Plugins

Developing with QGIS: What’s Possible?

● A QGIS Plugin that produces realistic natural hazard impact scenarios (e.g. Tsunami).

● Allows for better planning, preparedness and response activities.

● Conceived and initially developed by the Indonesia's National Disaster Management

Agency (BNPB) and the Australian Government.

● Developed by Linfiniti (Tim Sutton)

N

Page 9: QGIS UK: Developing with QGIS - What is possible (Lutra Consulting)

Crayfish

Example Plugins

Developing with QGIS: What’s Possible?

● Plugin for displaying time-varying flood model results

● Used to easily communicate flood risk

● Supports a variety of flood model results including TUFLOW and ISIS 2D

● Developed by Lutra Consulting

N

Page 10: QGIS UK: Developing with QGIS - What is possible (Lutra Consulting)

Brief demo

Crayfish

Developing with QGIS: What’s Possible?

Page 11: QGIS UK: Developing with QGIS - What is possible (Lutra Consulting)

How, Why and When?

Standalone Applications

Developing with QGIS: What’s Possible?

● What is it?

● Simply a program that uses the

QGIS libraries (just like QGIS!)

● Python or C++

● Why? / When?

● When complete flexibility is

required

● When a plugin on top of all of

QGIS is overkill

N

Page 12: QGIS UK: Developing with QGIS - What is possible (Lutra Consulting)

What's possible?

Standalone Applications

Developing with QGIS: What’s Possible?

● Command-line python scripts for automating tasks

● E.g. Using the QGIS Core library to batch-process some shapefiles

● E.g. Extracting and manipulating feature information

● E.g. Batch-printing a number of similar maps

● More complex, graphical applications

● E.g. QGIS Browser

● E.g. A dedicated navigation tool which:

● Reads vector data

● Displays images using the MapCanvas

● Routes between points

● E.g. A dedicated surveying application ...

N

Page 13: QGIS UK: Developing with QGIS - What is possible (Lutra Consulting)

IntraMaps Roam - A Data Collection App by Nathan Woodrow, DMS

Example Standalone Applications

Developing with QGIS: What’s Possible?

N

Page 14: QGIS UK: Developing with QGIS - What is possible (Lutra Consulting)

Questions?

Developing with QGIS: What’s Possible?