PyQGIS

Develop your QGIS plugin

Licencia (CC BY-SA 3.0)

III QGIS User Conference
7 August 2017 - Nødebo

Luigi Pirelli

luipir@gmail.com

lpirelli@boundlessgeo.com

@Ginetto

Who am I

15 years working on Satellite Ground Segments for

Landsat, Cryosat, MODIS, Sentinel...

 

Since 2006 in QGIS/GRASS

QGIS Plugin y Core developer

 

 

Since 2015 part of Boundless Desktop Team

Commercial solution base on QGIS (and more)

 

 

Founder of GFOSS.it

Italian OSGEO Local Chapter

Coautor of "Mastering QGIS"

Reviewer

QGIS Python Programming Cookbook

More PyQGIS books

Beginner

Advanced

 

http://qgis.org/es/site/

Download

http://qgis.org/es/site/forusers/download.html

docker pull kartoza/qgis-desktop

docker pull kartoza/qgis-server

 

Example data: http://qgis.org/downloads/data/

QGIS

Free as Freedom - mainly GPL2

Open - Anyone can participate

Trasparent - PSC coordination list is also open

How to Participate

Issues - http://hub.qgis.org/issues

Helps - In ML o en freenode #qgis channel

Bug fix: https://github.com/qgis/QGIS/pulls

Translates - http://qgis.org/en/site/getinvolved/translate.html

other languages e.g QGIS-es: http://lists.osgeo.org/cgi-bin/mailman/listinfo/qgis-es

 

but best part is particpating to...

HACKMEETING

every 6 months

When your user group?

Having right vote on using QGIS funds... and more

 

QGIS is wrote in:

C++ (almos all)

Python (some core plugins)

Javascript (some parts in Plugin Manager)

www.openhub.net/p/qgis

C++ - http://qgis.org/api/

Python - http://qgis-python.kartoza.com/docs/

http://geoapis.sourcepole.com/qgispyapi/

https://webgeodatavore.github.io/pyqgis-samples/

 

Lenguages

Ask help to the QGIS

The core Python console

or

IPython Console plugin

by A.Pasotti

  • Exploring commands
    • help(...)
    • dir(...)
  • To test command
  • To test code

Help each other

Ice break

coding in python console

Plugins

95% of C++ API can be accessed by Python thanks to SIP wrappers

https://wiki.python.org/moin/SIP

 

PyQGIS Cookbook

http://docs.qgis.org/2.18/en/docs/pyqgis_developer_cookbook/

http://docs.qgis.org/testing/en/docs/pyqgis_developer_cookbook/

 

The better school is to install end read plugins code

Let's build a plugin

with QGIS Plugin Builder (versión 2.16)

What we need

  • Python editor (vi, Atom, Eric4, Eclipse, PyCharm,...)
  • Optional: if we need Graphical User Interface (GUI)
    • *.ui file editors (Qt Creator, Qt Designer)
    • Resource builder pyrcc4 (pyqt4-dev-tools)
  • Optional:
    • project builder "make" (build-essential)

Steps

 

  • Import plugin code project

 

  • Plugin structure

 

  • add instruction in self.run()

 

  • Do debug

 

A simple run() code

Plugins for QGIS2 and QGIS3

Luigi Pirelli

luipir@gmail.com

lpirelli@boundlessgeo.com

@ginetto

 

github.com/luipir 

www.linkedin.com/in/luigipirelli

gis.stackexchange.com/users/19667/luigi-pirelli

 

 

Licence: (CC BY-SA 3.0)

QGIS User Conf: PyQGIS - Develop your QGIS plugin

By Luigi Pirelli

QGIS User Conf: PyQGIS - Develop your QGIS plugin

Training to introduce in the QGIS Plugin development in Python using PyQGIS. Topics are: • Really short introduction into python (if necessary) and Class concept • Orienteering inside community resources for problem solving • How to configure a Development and debug environment • Introduction to PyQGIS, example to manage raster and vectors • How to run processing toolbox algorithm and integrate new ones • Anatomy of a QGIS plugin • Write simple plugin • Tips&Tricks to develop a plugin compatible with QGIS3 and QGIS2 Training condition: – Training duration would be of 4h – Would facilitate to do it on OSGeoLive latest version + dev tools e.g * 10.5 => QGIS 2.14 * (if available in august) 11 => QGIS 2.18 QGIS version is not critical for this training. Training can be done also not on OSgeoLIve platform leaving attenders to choose platform. In that case it’s necessary to have QGIS already installed + some dev tools. – Would speedup training a attender selection with a basic python knowledge, but it’s not strictly necessary

  • 2,913