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)

Made with Slides.com