[SoC] Final report: Web API plugin for QGIS Desktop

Kevin Stadler e0425926 at student.tuwien.ac.at
Mon Aug 21 04:02:23 PDT 2017


Title: Web API plugin for QGIS Desktop (software: QGIS + R)

Abstract: The goal of my project was to create a QGIS Desktop plugin
which allows other (‘mapping-deficient’) programming languages (in
particular R) to make use of QGIS' data processing and canvas
drawing/styling functionalities. The approach of exposing these
functions through a plugin also has the particular advantage that one
can freely mix of programmatic (command-line scripting) and
interactive/QGIS GUI manipulation of geospatial data, as well as
simplifying the passing of data between QGIS and R.
Since the central part of the QGIS plugin revolved around exposing
parts of the existing (Py)QGIS API in a programming
language-independent format (over a HTTP web interface), one of the
hardest challenges throughout the project was to be consistent in
naming functions of the Web API such that they reflected the existing
API (as far as that was possible given the sometimes quite
idiosyncratic original naming and function signatures). Regarding the
R package accessing this Web API, there was again a challenge in
designing it in a way that is both intuitive to R users while also
allowing easy transitioning for people used to working with QGIS'
iPython console, by sticking close to the original PyQGIS API naming
and syntax.

State of the art BEFORE GSoC:
As possibly the most advanced FOSS geospatial processing suite, QGIS
is primarily used interactively through its Qt GUI. Its functions and
processing components can also be accessed programmatically through
both a C++ and Python API, but at the expense of having to sacrifice
its full GUI interaction.
As a statistical programming language with a vast and diverse
(open-source) package ecosystem, R also provides access to (and allows
easy combination of) several libraries for reading, writing and
processing geospatial data (including the RQGIS package for
batch-execution of QGIS' processing algorithms). Being command-line
based comes at the expense of interactive components though, with
currently available browser-based geospatial rendering solutions
(leaflet/mapview in particular) being quite constrained in terms of
their scalability as well as data source access.

Added value of the project: there is now a working version of the QGIS
'networkapi' plugin which makes many of the most useful PyQGIS API
functions available over a HTTP interface, as well as a
well-documented 'qgisremote' R package which makes these functions
available to R. The package allows seamless transfer of vector and
raster data from R's memory to QGIS and back, as well as selecting and
importing data from all of the usual QGIS data sources.

Work still to be done: While the current version of the QGIS plugin +
R package provide working access to many of the most useful (data
passing/processing and styling) functions, both can still be extended
by many of the other PyQGIS API components (and *will* most likely
have to be extended in the light of the release of QGIS 3).

Permanent links to code, documentation and examples:

Project overview page which provides a component summary and screenshots:
https://qgisapi.gitlab.io

Repository for the QGIS plugin (all code after the initial plugin
skeleton contributed by me):
https://gitlab.com/qgisapi/networkapi

Repository for the R package (entirety of the code contributed by me):
https://gitlab.com/qgisapi/qgisremote

R package documentation (entirety of documentation contributed by me):
https://qgisapi.gitlab.io/qgisremote


More information about the SoC mailing list