Developing with QGIS: What’s 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
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?
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
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
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
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
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
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
Brief demo
Crayfish
Developing with QGIS: What’s Possible?
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
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
IntraMaps Roam - A Data Collection App by Nathan Woodrow, DMS
Example Standalone Applications
Developing with QGIS: What’s Possible?
N
Questions?
Developing with QGIS: What’s Possible?