SlideShare uma empresa Scribd logo
1 de 34
Baixar para ler offline
QGIS Processing
Integration of Geoprocessing Tools in QGIS using Python
Anita Graser
About
Anita Graser
Scientist @ AIT Austrian Institute of Technology
QGIS Project Steering Committee
OSGeo Board of Directors
Moderator on GIS.Stackexchange.com
Author of „Learning QGIS“, „QGIS Map Design“ & „QGIS 2 Cookbook“
@underdarkGIS
QGIS Team
Developers Translators
Infrastructure
Managers
Community
Managers
Designers Users
Documentation
writers
Donors &
Sponsors
Project Steering Committee
Developermeeting, Linuxhotel Essen
QGIS History
OSGEOincubation,
IntroductionofPSC
Firstprofessionalusers
QGIS1.0(Kore)
QGIS2.0(Dufour)
QGIS.ORGAssociation
founded
QGIS3.0
Source of Search volume interests: https://trends.google.com/
FirstWindowsrelease
Developmentstartin2002
QGIS
QGIS Today
Most popular Open Source Desktop GIS
Second most popular GIS after ESRI ArcGIS
Available for: Linux, Windows, OSX (and Android)
Translated in > 40 languages
More than desktop: QGIS Server, web clients
(QWC2, LizMap), data collection solutions (QField,
Intramaps Roam)
Python in QGIS
Starting with release 0.9 (October 2007)
PyQGIS API depends on SIP & PyQt4
Used to
 Run commands from console
 Customize actions / tools
 Develop Plugins
 Develop stand-alone applications
http://docs.qgis.org/testing/en/docs/pyqgis_developer_cookbook/intro.html
QGIS Python Plugins
> 600 plugins http://plugins.qgis.org/plugins/
QGIS 2.x  Python 2.7 (Qt4/PyQt4)
QGIS 3.x  Python 3 (Qt5/PyQt5)
QGIS Processing Plugin
Processing Goals
Efficiency
integration of analytical capabilities by connecting to original binaries of
other software, such as SAGA, GRASS GIS, R, or ORFEO Toolbox
Modularity
consistent behavior across different tools & commonly-needed routines
Flexibility
algorithms can be reused in any of the framework’s graphical tools
Automatic GUI generation
based on the algorithm description
Processing: Hello World
##Learning QGIS=group
Processing: Hello World
##Learning QGIS=group
##input_layer=vector
##Learning QGIS=group
##input_layer=vector
my_layer = processing.getObject(input_layer)
print my_layer.name()
Processing: Hello World
Creating a Vector Layer
Behind the Scenes
QGIS Algorithms
OGR / GDAL
OGR / GDAL
Integration option 1: OGR / GDAL Python bindings
from osgeo import gdal , osr
from processing.algs.gdal.GdalAlgorithm import GdalAlgorithm
...
class ExtractProjection(GdalAlgorithm):
...
def processAlgorithm(self,progress):
rasterPath = self.getParameterValue(self.INPUT)
createPrj = self.getParameterValue(self.PRJ_FILE)
raster = gdal.Open(unicode(rasterPath))
crs = raster.GetProjection()
https://github.com/qgis/QGIS/blob/master/python/plugins/processing/algs/gdal/extractprojection.py
OGR / GDAL
Integration option 2: command line interface using Python’s subprocess
from processing.algs.gdal.GdalAlgorithm import GdalAlgorithm
from processing.algs.gdal.GdalUtils import GdalUtils
...
class ClipByExtent(GdalAlgorithm):
...
def processAlgorithm(self, progress):
out = self.getOutputValue(self.OUTPUT)
...
arguments = []
arguments.append(’-of’)
arguments.append(GdalUtils.getFormatShortNameFromFilename(out))
...
GdalUtils.runGdal([’gdal_translate’, GdalUtils.escapeAndJoin(arguments)],
progress)
https://github.com/qgis/QGIS/blob/master/python/plugins/processing/algs/gdal/ClipByExtent.py
GRASS & SAGA
Integration via command line interface
Main steps
1. Description of algorithm inputs and outputs
2. Input data preparation
3. Algorithm execution
4. Output handling
GRASS & SAGA
Algorithm description for GRASS v.voronoi
v.Voronoi
Creates a Voronoi diagram from an input vector layer
containing points.
Vector (v.*)
ParameterVector|input|Input points layer|0|False
ParameterBoolean|-l|Output tessellation as a graph|False
*ParameterBoolean|-t|Do not create attribute table|False
OutputVector|output|Voronoi diagram
https://github.com/qgis/QGIS/blob/master/python/plugins/processing/algs/grass7/description/v.voronoi.txt
advanced
R
Standard R syntax
Extended by additional header elements
##Vector processing=group
##showplots
##Layer=vector
##Field=Field Layer
hist(Layer[[Field]], main=paste("Histogram of",Field),
xlab=paste(Field))
Processing Commander
Batch Processing
Processing History Log
Processing Modeler Workflow Automation
Getting More Scripts
1. Extract characteristic points
2. Group by spatial proximity
3. Compute group centroids &
Voronoi cells
4. Segment trajectories according
to Voronoi cells
5. Count transitions from one cell
to another
https://anitagraser.com/2016/11/07/movement-data-in-gis-3-visualizing-massive-trajectory-datasets/
Ex1: Trajectory Generalization
Ex2: Edge Bundling
i.e. „fixing hairballs“
1. Cluster edges
2. Bundle similar edges
3. Visualize local bundle strength
http://dx.doi.org/10.3390/ijgi4042219
Plans
Processing
 Porting Processing core to C++
 Parallel processing support
General
 Migration to Python 3
 PyQGIS API documentation improvements
User conference 2017 in August in Denmark
Contact
Anita Graser
anitagraser@gmx.at
@underdarkGIS
anitagraser.com

Mais conteúdo relacionado

Mais procurados

Viktor Turskyi - How to create a VR application with React
Viktor Turskyi - How to create a VR application with ReactViktor Turskyi - How to create a VR application with React
Viktor Turskyi - How to create a VR application with React
OdessaJS Conf
 
Git study notes
Git study notesGit study notes
Git study notes
Angus Li
 

Mais procurados (19)

Open source
Open sourceOpen source
Open source
 
JHipster Code 2020 keynote
JHipster Code 2020 keynoteJHipster Code 2020 keynote
JHipster Code 2020 keynote
 
Git hub
Git hubGit hub
Git hub
 
Presentation1
Presentation1Presentation1
Presentation1
 
Jumpstart into Swagger & OpenAPI (JS Edition) - GrazJS
Jumpstart into Swagger & OpenAPI (JS Edition) - GrazJSJumpstart into Swagger & OpenAPI (JS Edition) - GrazJS
Jumpstart into Swagger & OpenAPI (JS Edition) - GrazJS
 
Meet Qt 6.2 LTS - Ask Us Anything!
Meet Qt 6.2 LTS - Ask Us Anything!Meet Qt 6.2 LTS - Ask Us Anything!
Meet Qt 6.2 LTS - Ask Us Anything!
 
Introduction of Lambda
Introduction of LambdaIntroduction of Lambda
Introduction of Lambda
 
5 4955 v16-process platform v16 developer certification
5 4955 v16-process platform v16 developer certification5 4955 v16-process platform v16 developer certification
5 4955 v16-process platform v16 developer certification
 
Hacktoberfest 2021
Hacktoberfest 2021Hacktoberfest 2021
Hacktoberfest 2021
 
GIS_Day_2016
GIS_Day_2016GIS_Day_2016
GIS_Day_2016
 
Viktor Turskyi - How to create a VR application with React
Viktor Turskyi - How to create a VR application with ReactViktor Turskyi - How to create a VR application with React
Viktor Turskyi - How to create a VR application with React
 
Docker In 10 Minutes or 10 Slides
Docker In 10 Minutes or 10 SlidesDocker In 10 Minutes or 10 Slides
Docker In 10 Minutes or 10 Slides
 
Google Developer Day 2010 Japan: 「App Engine 開発者コミュニティ「appengine ja night」とフレ...
Google Developer Day 2010 Japan: 「App Engine 開発者コミュニティ「appengine ja night」とフレ...Google Developer Day 2010 Japan: 「App Engine 開発者コミュニティ「appengine ja night」とフレ...
Google Developer Day 2010 Japan: 「App Engine 開発者コミュニティ「appengine ja night」とフレ...
 
Git and GitGHub Basics
Git and GitGHub BasicsGit and GitGHub Basics
Git and GitGHub Basics
 
When JHipster meets Microsoft-JHipster and Microsoft products
When JHipster meets Microsoft-JHipster and Microsoft productsWhen JHipster meets Microsoft-JHipster and Microsoft products
When JHipster meets Microsoft-JHipster and Microsoft products
 
10th php indonesia surabaya meetup
10th php indonesia surabaya meetup10th php indonesia surabaya meetup
10th php indonesia surabaya meetup
 
Git hub
Git hubGit hub
Git hub
 
Running a Project with Github
Running a Project with GithubRunning a Project with Github
Running a Project with Github
 
Git study notes
Git study notesGit study notes
Git study notes
 

Semelhante a QGIS Processing at Linuxwochen Wien / PyDays 2017

Location Analytics - Real Time Geofencing using Apache Kafka
Location Analytics - Real Time Geofencing using Apache KafkaLocation Analytics - Real Time Geofencing using Apache Kafka
Location Analytics - Real Time Geofencing using Apache Kafka
Guido Schmutz
 

Semelhante a QGIS Processing at Linuxwochen Wien / PyDays 2017 (20)

Using GDAL In Your GIS Workflow
Using GDAL In Your GIS WorkflowUsing GDAL In Your GIS Workflow
Using GDAL In Your GIS Workflow
 
Info gdal 20150915
Info gdal 20150915Info gdal 20150915
Info gdal 20150915
 
Open source based software ‘gxt’ mangosystem
Open source based software ‘gxt’ mangosystemOpen source based software ‘gxt’ mangosystem
Open source based software ‘gxt’ mangosystem
 
Gdal introduction
Gdal introductionGdal introduction
Gdal introduction
 
The Ring programming language version 1.9 book - Part 81 of 210
The Ring programming language version 1.9 book - Part 81 of 210The Ring programming language version 1.9 book - Part 81 of 210
The Ring programming language version 1.9 book - Part 81 of 210
 
Location Analytics - Real Time Geofencing using Apache Kafka
Location Analytics - Real Time Geofencing using Apache KafkaLocation Analytics - Real Time Geofencing using Apache Kafka
Location Analytics - Real Time Geofencing using Apache Kafka
 
ogr2gui - english version
ogr2gui - english versionogr2gui - english version
ogr2gui - english version
 
Graal The Quest for Source Code Knowledge
Graal  The Quest for Source Code KnowledgeGraal  The Quest for Source Code Knowledge
Graal The Quest for Source Code Knowledge
 
QT 프로그래밍 기초(basic of QT programming tutorial)
QT 프로그래밍 기초(basic of QT programming tutorial)QT 프로그래밍 기초(basic of QT programming tutorial)
QT 프로그래밍 기초(basic of QT programming tutorial)
 
FOSS4G 2010 PostGIS Raster: an Open Source alternative to Oracle GeoRaster
FOSS4G 2010 PostGIS Raster: an Open Source alternative to Oracle GeoRasterFOSS4G 2010 PostGIS Raster: an Open Source alternative to Oracle GeoRaster
FOSS4G 2010 PostGIS Raster: an Open Source alternative to Oracle GeoRaster
 
Geonode 2.0
Geonode 2.0Geonode 2.0
Geonode 2.0
 
2018 - Grupo QGIS Brasil e o lançamento do QGIS 3.4 LTR (Versão de Longo Prazo)
2018 - Grupo QGIS Brasil e o lançamento do QGIS 3.4 LTR (Versão de Longo Prazo)2018 - Grupo QGIS Brasil e o lançamento do QGIS 3.4 LTR (Versão de Longo Prazo)
2018 - Grupo QGIS Brasil e o lançamento do QGIS 3.4 LTR (Versão de Longo Prazo)
 
"Enabling Googley microservices with gRPC" Riga DevDays 2018 edition
"Enabling Googley microservices with gRPC" Riga DevDays 2018 edition"Enabling Googley microservices with gRPC" Riga DevDays 2018 edition
"Enabling Googley microservices with gRPC" Riga DevDays 2018 edition
 
Open Source GIS
Open Source GISOpen Source GIS
Open Source GIS
 
OGCE TeraGrid 2010 Science Gateway Tutorial Intro
OGCE TeraGrid 2010 Science Gateway Tutorial IntroOGCE TeraGrid 2010 Science Gateway Tutorial Intro
OGCE TeraGrid 2010 Science Gateway Tutorial Intro
 
GDG Cloud Taipei meetup #50 - Build go kit microservices at kubernetes with ...
GDG Cloud Taipei meetup #50 - Build go kit microservices at kubernetes  with ...GDG Cloud Taipei meetup #50 - Build go kit microservices at kubernetes  with ...
GDG Cloud Taipei meetup #50 - Build go kit microservices at kubernetes with ...
 
The Ring programming language version 1.8 book - Part 77 of 202
The Ring programming language version 1.8 book - Part 77 of 202The Ring programming language version 1.8 book - Part 77 of 202
The Ring programming language version 1.8 book - Part 77 of 202
 
Extended and embedding: containerd update & project use cases
Extended and embedding: containerd update & project use casesExtended and embedding: containerd update & project use cases
Extended and embedding: containerd update & project use cases
 
The Ring programming language version 1.7 book - Part 75 of 196
The Ring programming language version 1.7 book - Part 75 of 196The Ring programming language version 1.7 book - Part 75 of 196
The Ring programming language version 1.7 book - Part 75 of 196
 
Indiana University's Advanced Science Gateway Support
Indiana University's Advanced Science Gateway SupportIndiana University's Advanced Science Gateway Support
Indiana University's Advanced Science Gateway Support
 

Mais de Anita Graser

Mais de Anita Graser (20)

Trajectory Visualization in Notebook Environments @ GI_Salzburg 2022
Trajectory Visualization in Notebook Environments @ GI_Salzburg 2022Trajectory Visualization in Notebook Environments @ GI_Salzburg 2022
Trajectory Visualization in Notebook Environments @ GI_Salzburg 2022
 
Movement Data in GIS - Geobeer Lightning Talk, 2021-03-08
Movement Data in GIS - Geobeer Lightning Talk, 2021-03-08Movement Data in GIS - Geobeer Lightning Talk, 2021-03-08
Movement Data in GIS - Geobeer Lightning Talk, 2021-03-08
 
Exploratory Analysis of Massive Movement Data (RGS-IBG GIScience Research Gro...
Exploratory Analysis of Massive Movement Data (RGS-IBG GIScience Research Gro...Exploratory Analysis of Massive Movement Data (RGS-IBG GIScience Research Gro...
Exploratory Analysis of Massive Movement Data (RGS-IBG GIScience Research Gro...
 
From Simple Features to Moving Features and Beyond? at OGC Member Meeting, Se...
From Simple Features to Moving Features and Beyond? at OGC Member Meeting, Se...From Simple Features to Moving Features and Beyond? at OGC Member Meeting, Se...
From Simple Features to Moving Features and Beyond? at OGC Member Meeting, Se...
 
Data-driven Trajectory Prediction in Maritime LBS
Data-driven Trajectory Prediction in Maritime LBSData-driven Trajectory Prediction in Maritime LBS
Data-driven Trajectory Prediction in Maritime LBS
 
Big Spatial(!) Data Processing mit GeoMesa. AGIT 2019, Salzburg, Austria.
Big Spatial(!) Data Processing mit GeoMesa. AGIT 2019, Salzburg, Austria.Big Spatial(!) Data Processing mit GeoMesa. AGIT 2019, Salzburg, Austria.
Big Spatial(!) Data Processing mit GeoMesa. AGIT 2019, Salzburg, Austria.
 
MovingPandas at PyDays Vienna 2019
MovingPandas at PyDays Vienna 2019MovingPandas at PyDays Vienna 2019
MovingPandas at PyDays Vienna 2019
 
QGIS das Opensource GIS at Linuxwochen Wien 2019
QGIS das Opensource GIS at Linuxwochen Wien 2019QGIS das Opensource GIS at Linuxwochen Wien 2019
QGIS das Opensource GIS at Linuxwochen Wien 2019
 
GIScience for Dynamic Transportation Systems, GIScience Colloquium, Universit...
GIScience for Dynamic Transportation Systems, GIScience Colloquium, Universit...GIScience for Dynamic Transportation Systems, GIScience Colloquium, Universit...
GIScience for Dynamic Transportation Systems, GIScience Colloquium, Universit...
 
QGIS Neuigkeiten @ AGIT2017
QGIS Neuigkeiten @ AGIT2017QGIS Neuigkeiten @ AGIT2017
QGIS Neuigkeiten @ AGIT2017
 
Landmark-based instructions for pedestrian navigation systems using OSM
Landmark-based instructions for pedestrian navigation systems using OSMLandmark-based instructions for pedestrian navigation systems using OSM
Landmark-based instructions for pedestrian navigation systems using OSM
 
Integrating Open Spaces into OSM Routing Graphs for Realistic Crossing Behavi...
Integrating Open Spaces into OSM Routing Graphs for Realistic Crossing Behavi...Integrating Open Spaces into OSM Routing Graphs for Realistic Crossing Behavi...
Integrating Open Spaces into OSM Routing Graphs for Realistic Crossing Behavi...
 
Neuigkeiten vom QGIS-Projekt - AGIT 2016
Neuigkeiten vom QGIS-Projekt - AGIT 2016Neuigkeiten vom QGIS-Projekt - AGIT 2016
Neuigkeiten vom QGIS-Projekt - AGIT 2016
 
Spatial Data Analysis & Visualization with QGIS - Vienna Data Science Meetup
Spatial Data Analysis & Visualization with QGIS - Vienna Data Science MeetupSpatial Data Analysis & Visualization with QGIS - Vienna Data Science Meetup
Spatial Data Analysis & Visualization with QGIS - Vienna Data Science Meetup
 
Better Urban Travel Time Estimates Using Street Network Centrality #Eurocarto15
Better Urban Travel Time Estimates Using Street Network Centrality #Eurocarto15Better Urban Travel Time Estimates Using Street Network Centrality #Eurocarto15
Better Urban Travel Time Estimates Using Street Network Centrality #Eurocarto15
 
Time Manager Vortrag vom QGIS-DE Anwendertreffen 2015
Time Manager Vortrag vom QGIS-DE Anwendertreffen 2015Time Manager Vortrag vom QGIS-DE Anwendertreffen 2015
Time Manager Vortrag vom QGIS-DE Anwendertreffen 2015
 
Time Manager Workshop vom QGIS-DE Anwendertreffen 2015
Time Manager Workshop vom QGIS-DE Anwendertreffen 2015Time Manager Workshop vom QGIS-DE Anwendertreffen 2015
Time Manager Workshop vom QGIS-DE Anwendertreffen 2015
 
Improving Navigation: Automated Name Extraction for Separately Mapped Pedestr...
Improving Navigation: Automated Name Extraction for Separately Mapped Pedestr...Improving Navigation: Automated Name Extraction for Separately Mapped Pedestr...
Improving Navigation: Automated Name Extraction for Separately Mapped Pedestr...
 
Routing mit OSM - #AGIT2015
Routing mit OSM - #AGIT2015Routing mit OSM - #AGIT2015
Routing mit OSM - #AGIT2015
 
QGIS jenseits von zwei Dimensionen - KAGIS-Fachtagung 2015
QGIS jenseits von zwei Dimensionen - KAGIS-Fachtagung 2015QGIS jenseits von zwei Dimensionen - KAGIS-Fachtagung 2015
QGIS jenseits von zwei Dimensionen - KAGIS-Fachtagung 2015
 

Último

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Último (20)

Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 

QGIS Processing at Linuxwochen Wien / PyDays 2017

Notas do Editor

  1. Starting from 0.9 release, QGIS has optional scripting support using Python language. We’ve decided for Python as it’s one of the most favourite languages for scripting. PyQGIS bindings depend on SIP and PyQt4.
  2. Starting from 0.9 release, QGIS has optional scripting support using Python language. We’ve decided for Python as it’s one of the most favourite languages for scripting. PyQGIS bindings depend on SIP and PyQt4.
  3. Starting from 0.9 release, QGIS has optional scripting support using Python language. We’ve decided for Python as it’s one of the most favourite languages for scripting. PyQGIS bindings depend on SIP and PyQt4. http://docs.qgis.org/testing/en/docs/pyqgis_developer_cookbook/intro.html
  4. GDAL (Geospatial Data Abstraction Library) is a translator library for raster and vector geospatial data formats. Traditionally, GDAL used to focus on the raster part of the library and OGR the vector part for simple features. Starting with GDAL 2.0, both parts have been integrated more tightly. Multiple applications, such as QGIS, use this library for reading and writing spatial data. It implements a single raster abstract data model and vector abstract data model for all supported formats. Additionally, GDAL comes with a variety of command line utilities for data translation and processing [19]. The GdalOgrAlgorithmProvider integrates GDAL-based algorithms into the Processing framework, as illustrated in Figure 10. Individual algorithms extend the GdalAlgorithm or OGRAlgorithm class and have been implemented using two different mechanisms: calling the GDAL/OGR Python bindings or using the GDAL command line interface.
  5. When GDAL/OGR Python bindings exist for a function, the corresponding GdalAlgorithm or OGRAlgorithm calls GDAL/OGR, as shown in the example in Listing 3, which uses GDAL to extract projection information from an input file.
  6. Other algorithms, such as warp, translate, contour or clipping (see Listing 4), are called directly using the command line interface. All algorithms in the GDAL provider that call GDAL tools on the command line rely on the GdalUtils.runGdal() method. This method takes care of preparing the command line based on the parameter values, as well as the platform being used. It also handles the output created by the GDAL algorithms and provides progress indication and logging of output content.
  7. Both SAGA and GRASS GIS offer a great number of algorithms, and their executables are included in most QGIS packages, so there is no need to install them separately to have this functionality available. Although both SAGA and GRASS GIS can be called from Python using their corresponding Python APIs, Processing uses their command line interfaces, since these have proven to provide more stability (at least at the time of the initial implementation) and allowed for a quicker implementation of a large number of algorithms. As shown in Figure 11, Processing currently supports SAGA Versions 2.1.2, 2.1.3 and 2.1.4 through the SagaAlgorithm212, SagaAlgorithm213 and SagaAlgorithm214 classes implemented in the saga package, respectively. Similarly, GRASS 6 and 7 are supported through the grass and grass7 packages, as shown in Figure 12. More specifically, SAGA and GRASS GIS integration is achieved using four main steps: description of algorithm inputs and outputs, input data preparation, algorithm execution and output handling. Descriptions of the algorithm inputs and outputs are necessary to automatically create the GUI, run the algorithm, as well as to know which outputs will be generated. This information is stored in a separate file for each algorithm. The location of these description files can be accessed using SagaUtils.sagaDesriptionPath() and GrassUtils.grassDescriptionPath(), respectively. Both SAGA and GRASS provide methods to describe their algorithms. These methods simplify the integration, since it is not necessary to create the algorithm description files manually. Listing 5 shows an example description for the GRASS GIS v.voronoi algorithm, which features one input and one output, as well as two configuration parameters. The second integration step is the preparation of the input datasets. This is necessary since SAGA and GRASS GIS use their own formats for vector and raster data, and layers in popular formats that are supported by QGIS cannot be directly used by them. Therefore, Processing takes care of converting layers into the required formats before calling the algorithm. This provides a seamless integration into QGIS, allowing the user to use data, even if it is stored in a format that is not natively supported by SAGA or GRASS GIS. Additionally, in the case of vector layers, the data conversion can also make SAGA and GRASS GIS aware of feature selections by converting only the selected features before calling the algorithm. In the third integration step, the algorithm is executed using either the original input layer (if the data type is natively supported) or the converted layers. The final and fourth integration step is the handling of outputs. Processing receives the output generated by SAGA/GRASS GIS and adds it to the current QGIS project. If the output format specified by the user is not supported by SAGA/GRASS GIS, Processing will take care of converting the output before loading the layer. For instance, SAGA does support conversion from its native raster format into TIFF format, but cannot produce a TIFF file directly. Therefore, if the user specifies a TIFF output, it is necessary to first create a native SAGA raster layer, which can then be converted to TIFF by calling the SAGA conversion algorithm. Depending on the format, data conversions for both input and output are performed using functions provided by QGIS or the external application. Conversions using SAGA/GRASS GIS require several calls to the application. Therefore, all calls necessary to convert data and run the algorithm are written to a script file using SagaUtils.createSagaBatchJobFileFromSagaCommands() and GrassUtils.createGrassBatchJobFileFromGrassCommands(), respectively, which is then executed in one go.
  8. R is a system for statistical computation and graphics. It consists of a language plus a run-time environment to run programs stored in script files [22]. The R project also provides packages, functions, classes and methods for handling spatial data [23]. Processing integrates R into QGIS, enabling users to run R scripts from within QGIS and use QGIS layers as inputs. Figure 13 shows the classes of the r package. Similar to the SAGA/GRASS GIS integration, R integration includes data conversion routines for inputs and outputs, and it runs R on the command line using RUtils.executeRAlgorithm(). The main difference is that the RAlgorithmProvider does not offer any predefined algorithms. Instead, it enables the users to create their own algorithms, which can be written using a built-in text editor and can be stored and used in future sessions. The location of the R scripts can be accessed using RUtils.RScriptsFolder(). R scripts in Processing use the standard R syntax extended by additional header elements (represented by code lines starting with double hashes ##), which provide the information Processing needs to understand the context, as well as the inputs and outputs of the algorithms. An example using R to compute and display a histogram is given in Listing 6.
  9. https://anitagraser.com/2016/11/07/movement-data-in-gis-3-visualizing-massive-trajectory-datasets/
  10. http://dx.doi.org/10.3390/ijgi4042219