Sie sind auf Seite 1von 15

1/13/2016

A QGIS Plugin for


Multi Criteria
Analysis using AHP
SDSS Final Project Report

Instructor:
Dr. Ali Tahir
Group Members:
Muhammad Tayyab Mir
Syed Waleed Ali
Ayesha Tahir
Khadija Asim

ACKNOWLEDGEMENT
On the compilation of this report, we would like to express appreciation and deepest
gratitude to our instructor and FYP group supervisor Dr. Ali Tahir, for enlightening us with the
basic knowledge of this course (Spatial Decision Support Systems) and making us understand
the approaches to deal with multi criteria problems. Not only this but also encouraging us to
develop the requisite skills with in ourselves to discover and implement new and diverse tools
and technologies all over in this course as well as in the making of our Final Year Project.

Executive Summary
Introduction
The report is a framework for the integration of a QGIS python plugin for site selection
using multi criteria evaluation approach in the context of spatial decision support systems
(SDSS) and Geographical Information Systems (GIS) functionalities.

Purpose
The purpose of this report is to demonstrate the benefits of applying the Spatial Decision
Support System (SDSS) context for evaluating the suitability of an area (to place CCTV cameras
in our case). The multi criteria evaluation (MCE) prototype system is intended as QGIS plugin
for not only the regional planning but also for promoting group decision making that could
involve participants with different interests in the development of decision alternatives.

Conception
The SDSS allows the multiple participants to interact and develop an understanding of
the spatial data for assigning importance values to each factor.

Methodology
The approach started with a basic Site Selection Model as the theme and learning of
Python Geospatial Development, followed by the development of a complete plugin in QGIS,
with a user friendly graphical interface, based on the Analytical Hierarchy Processing (AHP) to
support multi criteria evaluation and implementation of Criterion Index Mapping. The project is
still in the state of development and required to be refined even more in order to be used for
complex and specific site selection problems.

Conclusion
Toolboxes or plugins for site selection supporting multi criteria evaluation techniques are
always valuable and that too for vector data models and in the open source environment such as
QGIS. The toolbox we developed has still got some deficiencies which if adjusted can lead
towards a complete and reliable system with the implementation of MCE for specific site
selection in the context of Spatial Decision Support Systems and GIS.

Introduction
Spatial Decision Support System (SDSS) is an interactive, computer-based system
designed to assist in decision making while solving a semi-structured spatial problem. It is a
system which models decisions and could be used to help identify the most effective decision
path. The system is explicitly designed to support a decision research process for complex spatial
problems. SDSS offers a complete framework for integrating database management systems with
analytical models, graphical display and tabular reporting capabilities along with the expert
knowledge of decision makers. Such systems can be viewed as spatial analogues of Decision
Support Systems (DSS) developed in operational research and management science to address
business problems.
Now to support a spatial decision research process, a geoprocessing system must
facilitate the introduction of new factors into analyses. The system also must enable its users to
change the relative importance of factors in analyses, both to evaluate the sensitivity of solutions
and to reflect different opinions and objectives for the solutions, through a user friendly
graphical interface. Finally, the system should be able to display the results of analyses in a
variety of ways that help users to understand them.
In our final year project, we are developing a platform that incorporates the video
surveillance system based on geospatial data, assigning each object a geolocation, for monitoring
that has the functions of data collection management, analysis and simulation using a spatiotemporal database and can generate alerts in real time or discover spatio-temporal patterns.
Which will enable the respective authorities and security personals to
o Quickly gain the perspective of the event occurred.
o Efficiently communicate the event to the nearest respective utility
o Ability to review new or past events associated with a location.
To maintain the integrity and reliability of such a system, it is necessary to position the
cameras smartly based on the analysis of multiple factors such as past crime rates, traffic flow,
road networks, and population density of that area and for that we developed a multi criteria
decision making tool (and named it SAMS) that could assist us in selecting the suitable sites for
the deployment of camera based on the factors mentioned before.
SAMS is a QGIS plugin, developed using python scripting, to support multi criteria
decision making based on the Analytical Hierarchy Processing (AHP) model and works on
Vector Data Models. The toolbox takes on the active layer as input, the user then choose the
fields which he/she want to consider for the respective decision making problem. Then the user
assigns his/her preference values to each field relative to every other field in the pair-wise
decision matrix. Based on these values respective weights as well as consistency indices are
calculated and assigned to layer and the results are then mapped representing the zones in the
range from very low to very high.

Literature Review
Spatial Decision Support Systems
A spatial decision support system (SDSS) is an intelligent information system that reduces
decision making time as well as improving the consistency and quality of the decisions (Cortes
2000). A SDSS can be either problem specific or situation and problem specific (Rizzoli and
Young 1997). Both are tailored to a specific problem, but the latter is generally limited to one
specific spatial location. Amongst Rizzoli and Youngs (1997) desirable features of an SDSS is
the ability to deal with spatial data and ability to be used effectively for diagnosis, planning,
management and optimization.

Site Selection using Multi Criteria Evaluation


Site selection is an important and necessary issue for waste management in fast-growing regions.
Because of the complexity of waste management systems, the selection of the appropriate solid
waste landfill site requires consideration of multiple alternative solutions and evaluation criteria.
Based on actual conditions of the study area, we considered economic factors, calculated criteria
weights using the analytical hierarchy process (AHP), and built a hierarchy model for solving the
solid waste landfill site-selection problem in Beijing, China. A geographic information system
(GIS) was used to manipulate and present spatial data. All maps are graded from 1 (lowest
suitability) to 5 (highest suitability) using spatial information technologies. The candidate sites
were determined by aggregation based on the criteria weights. The candidate sites are divided by
best, good and unsuitable landfill areas. Best landfill areas represent optimal sites; good
landfill areas can be used as back-up candidate sites (Guiqin Wang et al.).

QGIS Python Plugin


Quantum GIS allows enhancement of its functionality using plugins. This was originally possible
only with C++ language. With the addition of Python support to QGIS, it is also possible to use
plugins written in Python. Great advantages over C++ plugins is the simplicity of distribution (no
compiling for each platform needed) and easier development. Many plugins covering various
functionality have been written since the introduction of Python support. Plugin installer allows
users to easily fetch, upgrade and remove Python plugins (Martin Dobias - PyQGIS
Documentation).
Introducing Python
Python was first released in 1991 by Guido van Rossum at CWI in the Netherlands. Yes, it is
named after Monty Pythons Flying Circus, which Guido loves. Its name also means that many
references from the movies and the show are sprinkled throughout examples, code, and
comments. Many of Pythons features have been cherry-picked from other languages such as
ABC, Modula, LISP, and Haskel. Some of these features include advanced things like
metaclasses, generators, and list comprehensions, but most programmers will only need the basic
types like lists, dictionaries, and strings that Python provides to get going. Although it is almost
thirteen years old, Python is currently at release 3.4.

Python Geospatial Development


Python provides many opportunities for integration within GIS computing systems. Cross
platform capabilities and ease of integration with other languages (C, C++, FORTRAN, and
Java) means that Python is most successful in the gluing of systems together. Because of the
fluid language design, the development of large-scale applications is also easily supported. There
are many libraries and tools already developed for working with GIS data in Python. The basics
are covered, including the manipulation of shapefiles, grids, and images, as well as more
sophisticated stuff like scripting of SDE and interaction with web services and database.

Existing Work
One existing plugin has been found that matches our toolbox named as Easy-AHP. And it is
worth mentioning that we had taken help from this plugin in the designing of the graphical
interface, since we were not quite familiar with the making of user interfaces using XML. The
major difference between this plugin and ours is that the mentioned plugin works for Raster
Datasets only and has no support for the Vector data models, whereas, we keeping the fact in our
mind that most of such data is in vector format, have designed the toolbox that works for vector
data models.

Methodology
The initial idea was to develop a site selection plugin for installation of CCTV cameras so as to
monitor an area with the video surveillance capabilities and for that we needed data such as past
crime rates for each area as well as traffic density of an area which unfortunately we did not get.
Therefore the toolbox has not been tested for that case. However, it had been tested to some
other datasets and observed to be working fine. Following is the detailed methodology along
with some of the difficulties that we faced during each step.

Procedure
The first step was to decide the platform for building the toolbox/plugin. After a couple
of discussions among the group members as well as with our supervisor we decided to stick with
the open source development environment, since we wanted to use this plugin in the future too
for our final year project as mentioned before, and therefore we used QGIS python plugin.
There is a helpful QGIS plugin named Plugin Builder which creates all the necessary files
and the boilerplate code for a plugin. We have used this plugin to initially build the files. We
initially have to provide it with the class name, plugin name and the module name and the path
where the files are being created. Once it creates the necessary files, the rest is on the developer
how he code these files and make the plugin work.
Plugins graphical interface was mainly designed in a software Qt Creator. Qt is a
software development framework that is used to develop applications that run on multiple
platforms such as Windows, Linux, Mac and various mobile operating systems. QGIS itself is
written using the Qt framework. Qt Creator is its utility for designing graphical interfaces using
drag and drop functionalities. We can select any type of widget for our interface and drop it over
the main window. The software itself generates the XML code of this drag and drop actions.
Once each widget is initialized it can then be used in Python scripts. Each widgets functionality
and linking to various operations is done in Python.
The main functionality of the toolbox is written in python. The first step here was to
include the necessary libraries to make the plugin work.

Majority of these libraries are pre included by the Plugin Builder such as PyQt4.QtCore, as
PyQt4.QtGui, resources, processing, SDSS_dialog, and qgis. The rest of the libraries were added
by us to use their functionalities. Plugin Builder initializes a class instance with basic variables
and functions for us beforehand as shown below.

Here, we only initialized variables like self.dlgMain, self.dlgStep1, etc (which are
actually the graphical interfaces for each step) and the rest is again done by the Plugin Builder.
The last line is for adding the plugin in the main toolbar of the QGIS. Once this is done, we
started the formal codding process, summarized as followed.

Firstly, we initialized 4 different steps in our toolbox namely Main, Step1, Step2,
Step3, each with a different interface (designed in the Qt Creator).
Once each interface was designed, the respective buttons and widgets were linked with
their functions (such as what happens when the user clicks the next button or back
button). Each window with its functionalities is explained below.
o Main

This window only entails the purpose and working of the plugin. Clicking the
next button will proceed to the next step while clicking the cancel button will
close the dialog box.
o Step1

This window shows the active layers fields in the Available Fields Column.
From where the user can select the fields of his/her interest which are then shown

in the Input Fields Column. Once the fields are selected, the user can click the
next button to proceed to the next step.
o Step2

In this step the decision matrix is shown with the fields, that user selected, at the
rows and columns of the matrix. Here the user assigns each field a value in the
range of (1-9) where 1 is equally preferred and 9 being highly preferred. Once the
values are assigned the user clicks the calculate button to generate the values of
Lambda, Consistency Index and Consistency Ratio, based on the values that user
assigned to each field. If the CR value is less than 0.1 the dialog box remains fine
and the user is good to proceed further, otherwise an alert is being generated that
lets the user know that the matrix is inconsistent and values need to be changed.
o Step3

This last window displays the respective weights against each field calculated
following the AHP model. If the user is satisfied with the weights then he can
click on the button Generate Map to see the map output of the results otherwise he
can click Back button to go back to the previous step and change the values of the
decision matrix.
As mentioned before, we have used pair wise comparison method in the making of our toolbox,
so the main part of the codding comprise of the comparisons of field values with each other and
managing and manipulating the decision matrix iteratively. Once the weights are calculated, a
new column is added (geoWSM) to the attribute table of the vector file which contains the
weighted sum of the fields and this column is then used in the mapping phase.
For mapping purpose, the column geoWSM is sorted from lowest to highest values and these
values are then classified in five different classes (namely: very low, low, medium, high, and
very high). Each class is then assigned a color (red for very low and green for very high) and
mapped. The areas with green color represents the most suitable areas while those with red color
are the least suitable areas. Below is the code snippet for map rendering function.

Resulting map of the above mentioned calculations is as followed.

Issues Faced
In the making of this toolbox there were plenty of challenges and obstacles in our way, some of
which were resolved and some of which forced us to change our course or way. Few of the many
issues we faced are listed below.

As planned earlier, we were not able to make this plugin up to the mark and ready to use
for our Final Year Project (Cameras Site Selection) in the given time constraint. Will
definitely work this out in the forthcoming vacations.
Availability of the required datasets which was the major reason of not achieving what
we wanted to.
Most irritating issues that we faced were indenting issues of Python.
One major issue was dealing with vector data in Multi Criteria Evaluation (MCE). Since,
very less work is done on this domain so very little help was present over the internet.
The error identified by QGIS compiler were mostly non comprehendible and took quite a
bit of time to get resolved.
Many small conceptual difficulties and other debugging issues were also faced.
One of the most annoying error in the QGIS environment was ClassFactoryError() and
after tackling it about tens of times we still are not sure about the reason of its occurrence
and the effective solution.
Version incompatibility issues were also there and the plugin that we have developed
works on the version of QGIS 2.8 or latter so to increase its effectiveness, we need to sort
this out and make our plugin work on every version of QGIS.

Determination and encouragement were two primary solutions to all these issues that bridged out
the obstacles and made our way to be somewhere from nowhere.
Our very survival depends on our ability to stay awake, to adjust to new ideas, to remain
vigilant and to face the challenge of change. -Martin Luther King Jr.

Conclusion
Working with python in QGIS environment with no background knowledge was a challenge and
quite a bit of learning as well. Provided the time, capacity and knowledge constraints we had for
this task we have tried to manage well to at least set up the base, of python development in an
open source environment, for now, which will be extended and refined in the future to a broader
and wider sense.
The plugin that we have developed in this course is still in its state of improvement and we are
determined to further extend this so that it can deal with Raster formats as well with increased
levels of reliability and consistency.
We would like to conclude this with a hope to get such opportunities ahead as well, for increased
knowledge, experience and bringing innovation in our work.

References
Integrating Geographical Information Systems and Multiple Criteria Decision Making Methods
PyQGIS Documentation-Release 1.4
Spatial Decision Support Systems
Building a Python Plugin
QGIS Learning Resources
An AHP Decision Model for Facility Location Selection

Das könnte Ihnen auch gefallen