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

QGIS UK User Group - Developing with QGIS (Lutra)

  • Upload
    qgis-uk

  • View
    4.688

  • Download
    8

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 User Group - Developing with QGIS (Lutra)

Developing with QGIS: What’s Possible?

Lutra Consulting

Page 2: QGIS UK User Group - Developing with QGIS (Lutra)

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 User Group - Developing with QGIS (Lutra)

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 User Group - Developing with QGIS (Lutra)

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 User Group - Developing with QGIS (Lutra)

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 User Group - Developing with QGIS (Lutra)

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 User Group - Developing with QGIS (Lutra)

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 User Group - Developing with QGIS (Lutra)

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 User Group - Developing with QGIS (Lutra)

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 User Group - Developing with QGIS (Lutra)

Brief demo

Crayfish

Developing with QGIS: What’s Possible?

Page 11: QGIS UK User Group - Developing with QGIS (Lutra)

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 User Group - Developing with QGIS (Lutra)

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 User Group - Developing with QGIS (Lutra)

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

Example Standalone Applications

Developing with QGIS: What’s Possible?

N

Page 14: QGIS UK User Group - Developing with QGIS (Lutra)

Questions?

Developing with QGIS: What’s Possible?