You are on page 1of 126

DEVELOPMENT OF THE RURAL

STATISTICAL SUSTAINABILITY
FRAMEWORK TOOL

Erandika Oshan Manawadu


BEng, Computer Systems

Submitted in fulfilment of the requirements for the degree of


Master of Information Technology (Research)

School of Computer Science


Faculty of Science and Technology
Queensland University of Technology
June 2011
To my parents

for their endless

support and encouragement


i

Keywords

Decision Support Systems, Geographic Information Systems, Mapguide, Open


Source, Rural Sustainability, Spatial Decision Support Systems, Triple Bottom Line,
Web Based, Web 2.0, Web User Interface.

Development of the Rural Statistical Sustainability Framework Tool i


iii

Abstract

It is important to promote a sustainable development approach to ensure that


economic, environmental and social developments are maintained in balance.
Sustainable development and its implications are not just a global concern, it also
affects Australia. In particular, rural Australian communities are facing various
economic, environmental and social challenges. Thus, the need for sustainable
development in rural regions is becoming increasingly important. To promote
sustainable development, proper frameworks along with the associated tools
optimised for the specific regions, need to be developed. This will ensure that the
decisions made for sustainable development are evidence based, instead of subjective
opinions.

To address these issues, Queensland University of Technology (QUT), through


an Australian Research Council (ARC) linkage grant, has initiated research into the
development of a Rural Statistical Sustainability Framework (RSSF) to aid
sustainable decision making in rural Queensland.

This particular branch of the research developed a decision support tool that
will become the integrating component of the RSSF. This tool is developed on the
web-based platform to allow easy dissemination, quick maintenance and to minimise
compatibility issues. The tool is developed based on MapGuide Open Source and it
follows the three-tier architecture: Client tier, Web tier and the Server tier. The
developed tool is interactive and behaves similar to a familiar desktop-based
application. It has the capability to handle and display vector-based spatial data and
can give further visual outputs using charts and tables. The data used in this tool is
obtained from the QUT research team. Overall the tool implements four tasks to help
in the decision-making process. These are the Locality Classification, Trend Display,
Impact Assessment and Data Entry and Update. The developed tool utilises open
source and freely available software and accounts for easy extensibility and long-
term sustainability.

Development of the Rural Statistical Sustainability Framework Tool iii


v

Table of Contents

Keywords .................................................................................................................................................i
Abstract ................................................................................................................................................. iii
Table of Contents .................................................................................................................................... v
List of Figures ...................................................................................................................................... vii
List of Tables .........................................................................................................................................ix
List of Abbreviations..............................................................................................................................xi
Statement of Original Authorship ....................................................................................................... xiii
Acknowledgments ................................................................................................................................. xv
CHAPTER 1: INTRODUCTION ....................................................................................................... 1
CHAPTER 2: LITERATURE REVIEW ........................................................................................... 7
2.1 Decision Support Systems (DSS) ................................................................................................ 7
2.1.1 Impact Assessment ........................................................................................................... 8
2.2 Sustainability and Decision Support Systems .............................................................................. 9
2.3 Geographic Information Systems (GIS)..................................................................................... 11
2.4 Spatial Decision Support Systems (SDSS) ................................................................................ 11
2.5 Web SDSS and Web interfaces .................................................................................................. 13
CHAPTER 3: TECHNOLOGY AND DATA .................................................................................. 19
3.1 MapGuide Open Source ............................................................................................................. 20
3.2 Data and Database...................................................................................................................... 22
3.2.1 Spatial Data..................................................................................................................... 24
3.2.2 Spatial Data for the User Interface ................................................................................. 25
3.3 Charts ......................................................................................................................................... 25
3.4 Mapguide maestro...................................................................................................................... 25
3.5 Summary......................................................................................................................... 26
CHAPTER 4: THE APPROACH ..................................................................................................... 27
4.1 MapGuide Setup ........................................................................................................................ 28
4.2 Implementation .......................................................................................................................... 30
4.3 Decision Support Extension ....................................................................................................... 31
4.4 Interface Design ......................................................................................................................... 32
4.4.1 Map Building .................................................................................................................. 33
4.4.2 Chart Display .................................................................................................................. 37
4.4.3 Task Display ................................................................................................................... 39
4.5 Database Design ........................................................................................................................ 40
4.6 Task Design ............................................................................................................................... 43
4.7 Summary .................................................................................................................................... 49
CHAPTER 5: RSSF TOOL ............................................................................................................... 51
5.1 Interface ..................................................................................................................................... 51
5.2 System Tasks and operation....................................................................................................... 54
5.2.1 Locality Classification .................................................................................................... 55
5.2.2 Trend Display ................................................................................................................. 58
Development of the Rural Statistical Sustainability Framework Tool v
vi

5.2.3 Impact Assessment ......................................................................................................... 59


5.2.4 Data Update .................................................................................................................... 62
5.2.5 Decision Support ............................................................................................................ 65
5.3 Task Implementation ................................................................................................................. 65
5.3.1 Classification .................................................................................................................. 66
5.3.2 Trend Display ................................................................................................................. 71
5.3.3 Impact Assessment ......................................................................................................... 72
5.3.4 Data Entry and Update ................................................................................................... 73
5.4 Summary .................................................................................................................................... 76
CHAPTER 6: DISCUSSION AND CONCLUSIONS ..................................................................... 77
6.1 Outcomes and Future Work ....................................................................................................... 78
BIBLIOGRAPHY ............................................................................................................................... 83
APPENDICES ..................................................................................................................................... 87
Appendix A: Locality Classification Source Code .................................................................... 87

vi Development of the Rural Statistical Sustainability Framework Tool


vii

List of Figures

Figure 1: The Architecture of MapGuide Open Source (MapGuide, 2010) .......................................... 21


Figure 2: FDO Provider Architecture (Rieksp, 2007) ........................................................................... 23
Figure 3: Integration Process Flowchart ............................................................................................... 27
Figure 4: MapGuide Open Source Directory Structure ......................................................................... 29
Figure 5: Java Source Code for Loading the Web Layout .................................................................... 31
Figure 6: MapGuide Maestro Desktop Application .............................................................................. 34
Figure 7: MapGuide Maestro Map Definition....................................................................................... 36
Figure 8: MapGuide Maestro Interface Layout Setup ........................................................................... 36
Figure 9: Expanded Task List ............................................................................................................... 39
Figure 10: Task List Setup in MapGuide Maestro ................................................................................ 40
Figure 11: Project Database Structure ................................................................................................... 42
Figure 12: Eclipse Project Directories................................................................................................... 44
Figure 13: Task Structure and Overview .............................................................................................. 47
Figure 14: Tomcat Console for Debugging ........................................................................................... 48
Figure 15: Finalised Interface of the Tool ............................................................................................. 52
Figure 16: Street Level Detail for Chinchilla with the Locality Outline ............................................... 53
Figure 17: Locality Feature Selection as Input...................................................................................... 56
Figure 18: Final Output of the Task ...................................................................................................... 57
Figure 19: Trend Display Interface ....................................................................................................... 58
Figure 20: Final Output of the Task for One Particular Selection ......................................................... 59
Figure 21: Interface for Impact Assessment Task ................................................................................. 61
Figure 22: Visualising Changes with Bar Charts .................................................................................. 62
Figure 23: Interface for the Update Data Task ...................................................................................... 62
Figure 24: Items Placed in the Empty Select Boxes.............................................................................. 64
Figure 25: Table Format of Data ........................................................................................................... 64
Figure 26: Data Structure for Locality Classification ........................................................................... 68
Figure 27: Area Rule Tag Template ...................................................................................................... 69

Development of the Rural Statistical Sustainability Framework Tool vii


ix

List of Tables

Table 1: Comparison of Alternative Web GIS Technology .................................................................. 19


Table 2: Tools Used in Development .................................................................................................... 26
Table 3: System Tasks and Functionality.............................................................................................. 55
Table 4: Tasks and Source Files ............................................................................................................ 65

Development of the Rural Statistical Sustainability Framework Tool ix


xi

List of Abbreviations

AJAX Asynchronous JavaScript and XML


API Application Programming Interface
ARC Australian Research Council
DERM Department of Environment and Resource Management
DSS Decision Support Systems
EER Extended Entity-Relationship
ESRI Environmental Systems Research Institute
FDO Feature Data Object
GIS Geographic Information Systems
GSR Growing Sustainable Regions
GUI Graphical User Interface
ISR Institute for Sustainable Resources
JDBC Java Database Connectivity
KS Knowledge System
LGA Local Government Area
LS Language System
MCDM Multi Criteria Decision Making
MGROOT C:\Program Files\MapGuideOpenSource2.0
NBN National Broadband Network
OS Open Source
PNG Portable Network Graphics
PPS Problem Processing System
PS Presentation System
PUP Projection For Urban Planning
QLD Queensland
QUT Queensland University of Technology
RSSF Rural Statistical Sustainability Framework
SCA Strategic Choice Approach
SDF Autodesk Spatial Data Format
SDSS Spatial Decision Support Systems
SHP ESRI Shapefile Format
SQL Structured Query Language
TNS The Natural Step
WCED Commission on Environment and Development
WFS Web Feature Service
WMS Web Map Service

Development of the Rural Statistical Sustainability Framework Tool xi


xiii

Statement of Original Authorship

The work contained in this thesis has not been previously submitted to meet
requirements for an award at this or any other higher education institution. To the
best of my knowledge and belief, the thesis contains no material previously
published or written by another person except where due reference is made.

Signature: _________________________

Date: _________________________

Development of the Rural Statistical Sustainability Framework Tool xiii


xv

Acknowledgments

My special thanks are to my principal supervisor, Dr Tony Sahama, for his


support and guidance through my research project. I would like to thank my
associate supervisor, Dr Evonne Miller, for giving direction to my research. I would
also like to thank the Director of the Institute for Sustainable Resources, Professor
Peter Grace, for his support and funding of my candidature. Lastly, I would like to
extend my gratitude to all the research assistants and technical staff involved in this
project for their hard work and support.

Development of the Rural Statistical Sustainability Framework Tool xv


Chapter 1: Introduction

Sustainable development, defined as the development that meets the needs of


the present without compromising the ability of future generations to meet their own
need(WCED, 1987), is an essential concept that is vital to the survival of our planet
and its inhabitants. Today, in this fast growing and highly industrialised world, it is
this concept that policy-makers are struggling to promote. The problem with our
conventional model of development is that it has traditionally been somewhat one
sided, tending only to focus on the economic growth. Development in this model was
seen as a way to modernise society to become technically sophisticated and
urbanised, typically ignoring the social and environmental aspects (Baker, 2006). In
contrast, the sustainability development paradigm specifies a more all encompassing
approach where it aims to fulfil human material and non-material needs, advance
social equity, expand organisational effectiveness and build human and technical
capacity towards sustainability (Roseland, 2000). Essentially it is an effort to
integrate environmental, economic and social considerations into the development
process, as these factors are very much interdependent.

The concept of integrating economic, environmental and social considerations


into development is termed the Triple Bottom Line (TBL). This was first introduced
by John Elkington in his book Cannibals with Forks: the Triple Bottom Line of 21st
Century Business (Elkington, 1998). An Example of this shift towards Triple Bottom
line based development model is the corporate interest in adaptation of social impact
assessment. With the advent of TBL reporting large business are judged by their
economic, environmental and social impact (Elkington, 1998). The article, Defining
the Social Dimension of Triple Bottom Line for the Australian Dairy Industry from
Evonne Miller, Laurie Buys and Bruce Rich, provide three reasons why corporations
had chosen to follow such a path (Miller, Buys & Rich, 2006). First is the societal
expectation and public opinions for implementing environmental and social
initiatives. Second, the underline financial benefit reaped as a result of the positive
placement of an organisation within the community through successful
environmental and social initiatives. Thirdly, the ability to improve investor

Chapter 1: Introduction 1
2

satisfaction and organisation reputation through the publicity gained from TBL
reporting.

The challenge in promoting TBL development is not only to think, discuss and
consider environmental and social impacts but also to device means to measure and
monitor them (McKenzie, 2004). Evonne miller et al, also argues that even though
there is an awareness of the importance of TBL, the instruments for analysis and
reporting are often nonexistent and inadequate. One example of such tool presented
in their paper, is the ability of an organisation to develop a database to measure,
monitor and evaluate their social contribution. Such a database tool, as they points
out could be used to reveal whether the majority of workers with an organisation
have children, which can influence the origination decision to provide childcare
facilities and/or education scholarships to retain staff and to improve organisational
reputation (Miller et al., 2006).

Seeing the importance in addressing environmental and social problems, the


United Nations convened the Brundtland Commission (formerly World Commission
on Environment and Development) in 1983. The report, Our Common Future (or the
Brundtland Report), published by the Brundtland Commission identifies four key
links between the economic, social and environmental entities. It argues that
environmental stresses are linked with one another, environmental stresses and
patterns of economic development are linked with one another, environmental and
economic problems are linked with social and political factors and that these
influences operate both within and between nations (WCED, 1987). Good
illustrations of these links are provided in Susan Bakers book, Sustainable
Development, where she argues that the interdependent links within environmental
stresses are apparent when deforestation leads to soil erosion which in turn can lead
to silting of rivers and lakes. A good example of the link between environmental
stresses and patterns of economic development is the use of coal for electricity
production, resulting in greenhouse gas emissions, which in turn results in climate
change. The links between economic, environmental, political and social factors are
apparent through the rapid growth of population, which puts pressure on the scarce
resources and the physical environment. This in turn can be related to the traditional
position of women in society; improving their role in social, political, economic and

2 Chapter 1: Introduction
3

education sectors of society can lead to the reduction in birth rate and the population
growth (Baker, 2006).

Clearly, sustainability is a real and imminent issue: if the world continues its
current course of development into the future, it is estimated that it would require
two or more planets to fulfil its needs (Sundblad & Pullen, 2010). Without proper
sustainable development, the resources of the world are spread unevenly among
people; currently, it is estimated that 80 percent of the worlds resources are used by
only 20 percent of the people (Sundblad & Pullen, 2010). If the remaining 80 percent
of the people are also aspiring for a similar lifestyle as that of the wealthy, then this
change would place the world resource demands well over full capacity. This kind of
varied resource distribution can exist among countries, states, cities and urban and
rural regions and it does not lead to equity and social harmony, which is important in
achieving long-term sustainability. Also as the population and economy grows, it
puts pressure on limited land allocation and employment, with greenhouse gas
released from homes and factories adding to global warming and environmental
degradation (Inter-Ministerial Committee on Sustainable Development, 2009).
These are all the more reasons to quickly accommodate and promote a sustainable
development paradigm.

To promote sustainability a balanced set of economic, environmental and


social benefits must be delivered. Sustainable development is not purely a scientific
endeavour, however, it also has an ethical and political dimension (Turnhout,
Hisschemller & Eijsackers, 2007). Thus, the indicators developed for sustainability
need to be developed with a combined influence of the political, ethical and scientific
knowledge. The Natural Step (TNS) Framework specifies four principal conditions
that lead to a sustainable society. It states that substances extracted from Earths crust
must not accumulate in nature; substances produced by society must not accumulate
in nature; the physical productivity and diversity of nature must not be deteriorated
and resources must be used fairly and effectively to meet human needs (Robert,
Daly, Hawken & Holmberg, 1997).

Similarly, the development paradigm specified in the well known Brundtland


Report, suggests a number of activities that can be used to promote sustainable
development. These include the changing of the quality of growth (making it less
material and energy intensive and more equitable in its impact), reducing population

Chapter 1: Introduction 3
4

growth to sustainable levels, addressing the environmental problems of intensive


agriculture, maintaining biodiversity for moral, ethical, cultural, aesthetic, scientific
and medical reasons, establishing safe and sustainable energy pathways, promoting
the ecological modernisation of industry, learning to produce more with less, and
developing settlement strategies to guide urbanization (WCED, 1987).

Critically, sustainable development and its implications are not just a global
concern but also affect Australia. In particularly, the rural communities in Australia
face various economic, environmental and social challenges. According to the
Australian Institute of Health and Welfare (AIHW, 2008), there is strong evidence to
suggest that rural Australians generally experience: poorer health, lower education
standards, fewer employment opportunities, and lower wages, than their city
counterparts. Eversole (2004) argues that the increasing shift toward corporate
farming and the providing of local retail by national and international retail chains is
creating a development gap in rural communities. The economic security of the rural
regions depends on the efficient, sustainable use of local resources and the
availability of new knowledge and new strategies for investment and adjustment
(Rogers & Walker, 2005).

To justify sustainable development activities, and to ensure their progress and


performance, it is essential to have the appropriate planning, monitoring and
reporting tools that embed accurate econometric and statistical analysis (Hardi &
DeSouza-Huletey, 2000). The need for such reporting, monitoring and reviewing to
help achieve targets, guide towards goals and determine necessary changes is also
reflected in the final Action Area of the Local Agenda 21 process (DEWHA,
1992). The effectiveness of the above tools and analysis in turn depend on how close
the data are to the real world context (Hardi & DeSouza-Huletey, 2000). Therefore, it
is also important to improve the data collection and interpretation. Appropriate
methods need to be designed and put in place for local authorities to collect and
maintain their own data. The linking of different data sources and the creation of a
database to archive all existing sources of sustainable data will provide an
opportunity to review existing work in the future (Hardi & DeSouza-Huletey, 2000).

To address these issues, Queensland University of Technology (QUT),


through an Australian Research Council (ARC) linkage grant has initiated the
Growing Sustainable Regions (GRS) Project. The GRS project aims to develop a

4 Chapter 1: Introduction
5

Rural Statistical Sustainability Framework (RSSF) along with the associated tools
that will aid the rural planning and development decision-making processes. The
framework targets rural communities in South-West Queensland.

The problem that is addressed in this particular branch of research is the


development of the tool that incorporates and operates within this rural statistical
support framework. The research teams initial consultations with regional council
decision makers revealed their difficulty in obtaining resources and information that
supported informed decision making, and the inaccessibility and poor organisation of
different datasets and data sources. Therefore the main aim of the tool is to address
this gap in data for the rural decision maker. It is anticipated that the decisions
supported through this tool will contribute to the sustainable development of rural
Queensland, taking in to account all aspects of the triple bottom line. To achieve this
the tool need to support a wide spectrum of decision making, including farming and
mining decisions, land allocation and development decisions as well as policy
decisions. This tool will be mainly aimed at the rural planners and policy decision
makers. A subset of the tool will also be available for general public decision
making. This aspect of the tool will aim to answer question such as: what is the most
suitable rural location to live in? Where is the closest school/hospital? Addressing
these kinds of decisions is made easy when all the necessary data is gathered and
presented in a convenient manner, which is the main concern for the rural decision
maker at this stage.

The tool will initially focus on two specific locations: the Western and
Southern Downs regions. Given the fact that the tool is focusing on the rural context,
it will need to be accessed from remote locations. As a result, traditional desktop-
based software would be difficult to use in this situation. Therefore, it is proposed
that the tool be developed on a web-based platform, as it will provide good
dissemination capability and will allow quick update and maintenance of the system
in multiple different remote locations. Also, the decision makers that use this tool
need to be able to easily specify and visualise data that reflects on the spatial context.
This means the system needs to utilise maps and layers to display information. It is
also a factor to consider that the decision makers and planners that use this tool are
not heavily technically inclined; thus, the tool needs to be user friendly and

Chapter 1: Introduction 5
6

interactive and easy to understand and use without requiring too much setting up and
configuration.

In order to answer the proposed problem, the research will focus on developing
a web-based spatial decision support system (SDSS). The main characteristic of a
SDSS is that it is normally implemented for limited problem domain, facilitates the
use of analytical and statistical modelling, utilises a graphical interface to provide
information to decision makers and can be easily modified and adapted to the
decision makers style (Densham & Goodchild, 1989). A SDSS needs to have a good
graphical interface, together with interactive capabilities, as it needs to deal with
raster and vector-based data. With the availability of web 2.0 technologies it is now
easier to give web applications similar interactive capabilities to that of desktop
applications. Overall this research aims to achieve three goals:

1. To develop an interactive web-based user interface and decision support


facilities for the tool.

2. To develop the necessary database backend of the tool and facilitate data
retrieval, modification and addition.

3. Consider future extensions and the integration of analytical and statistical


models to form a complete web-based spatial decision support system.

The scope of the research includes the design and development of web
interfaces, and online decision-making tools that support Geographic Information
Systems (GIS) to facilitate sustainable development of rural regions.

6 Chapter 1: Introduction
Chapter 2: Literature Review

This section documents the literature for this research. The purpose of this
literature review is to investigate Decision Support Systems (DSS) for sustainable
rural development, that augment Geographic Information Systems (GIS) and
interactive web interfaces and to explore how these integrate to form a coherent
spatial decision support system. This new paradigm of the research is an emerging
trend in the DSS arena. Hence, it would become possible to identify the research gap
that exists and to justify the research in this domain. It would also help to identify
and retrieve knowledge available in the literature that will help in the implementation
process to support the research problem.

2.1 DECISION SUPPORT SYSTEMS (DSS)

The conception of decision support systems dates back to 1969 (Yukui &
Sheng, 2009). The purpose of this first DSS developed in 1969, called REVEAL,
was to help mangers solve daily problems that arose in the organisation environment.
Decision Support Systems are defined as computer-based information systems
designed to support decision makers interactively in thinking and making decisions
about relatively unstructured problems (Dutta, 2000, p. 2).

In 1981, Robert Bonczek, Clyde Holsapple, and Andrew Whinston developed a


framework to understand the development of DSS (Power, 2007). In this framework,
they identified four aspects that are common to DSS. These are a language system
(LS) to specify all the input to the DSS, a presentation system (PS) for all the output
of the DSS, a knowledge system (KS) for all the information the DSS has, and a
problem processing system (PPS), a software module for the computation of
outcomes of the DSS (Power, 2007).

There are several different modules and versions of DSS. These include group
decision support systems, intelligent decision support systems, distributed decision
support systems, data support centres, strategic decision support systems (Yukui &
Sheng, 2009). Group decision support systems combine together communication,
computer and decision support technologies. They are utilised in situations where
personal decision making is limited. An intelligent DSS is the integration of artificial

Chapter 2: Literature Review 7


8

intelligence with a DSS. It has capabilities such as machine learning, knowledge


representation, natural language understanding and pattern recognition. Distributed
decision support systems are computer networks which comprises of physically
dispersed information processing nodes. A data support centre is a collection of
advanced information technologies adopted by decision support groups. A DSS
utilised to make strategic decisions relating to a country, region, enterprise is known
as a strategic decision support system.

2.1.1 IMPACT ASSESSMENT

Impact assessment is an important process for decision making. The purpose of


impact assessment is to explain the objectives of a proposal, the risks to be
addressed and the options for delivering the objectives. In doing so it should make
transparent the expected costs and benefits of the options for the different bodies
involved, such as other parts of government and small businesses. (NAO (National
Audit Office), 2002). As the International Association of Impact Assessment simply
states, It is the process of identifying the future consequences of a current or
proposed action (Jesus, 2009). Impact assessment process is a good way to analyse,
compare and verify the consequences of possible policy options (EU (European
Union), 2011). It can be used to assess the impact of projects and policies on the
environment, society and economy. This helps to promote economically viable,
socially equitable and environmentally friendly project and policy outcomes
(Convention on Biological Diversity, 2011).

Impact assessment process follows similar a methodology to that of physical


and natural sciences (Jesus, 2009). A simple impact assessment process illustrated in
the book, Environmental and Social Impact Assessment (Vanclay & Bronstein, 1995)
includes three steps. The first step involves the identification of the impacts that will
result from a certain project or policy. This could be obtained through experience,
knowledge or through documentation that specifies the impacts for a given project.
The next step in the impact assessment process is to predict changes of the resulting
impacts. This may require analytical and statistical modelling or specialist
knowledge. The last and the most difficult step is to analyse and evaluate the
predicted impacts. Given the importance and difficulties of impact assessment, it
could be argued that a good decision support system should provide a way to

8 Chapter 2: Literature Review


9

automate the impact assessment process and to integrate a sound method to evaluate
its outcomes.

2.2 SUSTAINABILITY AND DECISION SUPPORT SYSTEMS

The Brundtland Commission, formally the World Commission on Environment


and Development, defines sustainable development as the development that meets
the needs of the present without compromising the ability of future generations to
meet their own need (WCED, 1987). Decision making for sustainable development
requires a range of environmental, economic, political, social, ethical and other
indicators to be taking into consideration. In addition it requires a mixture of
quantitative, qualitative, precise and imprecise, subjective and objective data (Hersh,
1999). These factors need to be well integrated to generate meaningful results.

There are two main approaches to decision making: the classical and
naturalistic approach (Hersh, 1999). According to Hersh, these two approaches are
not entirely suitable for sustainable decision making. The classical approach requires
objective, qualitative and precise data which is not always possible to obtain. The
naturalistic approach depends on the expertise of the experienced users which could
be outdated and not geared towards sustainability. In this research, however, it
would be appropriate to use classical approach to sustainable decision making as it
provides an organised framework for structuring all available data and analysing and
providing justification for tradeoffs (Hersh, 1999). In essence, it is objective as the
analysis is performed with measurable phenomena instead of speculation, and
statistical evidence can be produced to justify the courses of action taken. One
limitation of this method is that it is not always easy to obtain all the data necessary
for decision making.

An interesting idea put forward by Hersh is the implicit nature of sustainable


decision making. He states that when we use an explicit decision-making process to
solve implicit problems, we can make wrong assumption about the prior decisions
required to arrive at an explicit statement of alternatives. This is very clear in the
case of solving traffic congestion problems. When relieving traffic congestion it is
usually attributed to the choice of route taken but that means we have assumed the
solution would be to build a new road, whereas it could be because of the increase in

Chapter 2: Literature Review 9


10

private vehicles and the lack of public transportation such as buses and trains. This is
also why multi criteria decision making (MCDM) tends to not be appropriate for
sustainable decision making as it targets problems with an explicitly stated course of
actions (Hersh, 1999).

There are four categories of sustainable decision-making tools: information


handline tools, modelling and simulation, MCDM and life cycle and green tools
(Hersh, 1999). These have varied application in sustainable decision making. One
such application of decision-making tools is in the planning and management of
water resources. The decisions made here include long term policy planning,
appropriate use of waterways and management of crises such as floods and droughts.
Modelling and simulation of rainfall patterns can provide decision makers with
information about fresh water availability and the regions where droughts and
flooding likely to occur. Databases with information on the rainfall pattern and local
demand and use of water are important in aiding decision makers in this area (Hersh,
1999).

DSS also have applications in energy planning and management (Hersh, 1999).
Simulation and modelling in this area can be used to evaluate the effect of different
policies and changes such as regulation of emission through the investigation of
hypothetical scenarios. This can also be used to predict the long term availability of
different energy resources and the development of new technologies (Hersh, 1999).

Water and sanitation planning is also important in sustainable development.


Tornqvist and colleagues (Tornqvist, Norstrom, Karrman & Malmqvist, 2008)
recently published a framework that would allow sustainable development and
planning in water and sanitation. The proposed framework is basically a modification
of the strategic choice approach (SCA) which consists of four planning modes:
shaping, designing, comparing and choosing. Tornqvist et al. (2008) appended an
extra initial mode to the SCA, called the awareness raising mode. This is to state the
seriousness of the issue and to gain wider focus and support of the system.

The degree of effectiveness of the decision-making tool varies with the


application it is used in. This is evident from Tornqvists research, where they
categorised various systems in terms of their usefulness to the decision-making
process and explained how tools such as checklists are important in the initial

10 Chapter 2: Literature Review


11

shaping mode and more complicated software tools are useful in the comparing
mode of the planning process (Tornqvist et al., 2008).

2.3 GEOGRAPHIC INFORMATION SYSTEMS (GIS)

The main focus of this research is on the spatial context of decision making. To
be able to manipulate and visualise spatial data is an important feature when making
decisions in the spatial context. Spatial data are pieces of information describing
quantitative and/or qualitative properties that refer to space (Belussi, 2007, p. 1). In
data modelling terms, spatial information has more than two dimensions thus,
decision making is informative and precise. Spatial data can be attributes of a set of
objects such as the path of a highway or a technical drawing of an engine (Belussi,
2007). In the case of a path, the object would be two lines and the attribute is the
length. Spatial data can also be a function of space location such as temperature, for
example how temperature varies according to space (Belussi, 2007).

GIS technology can be used to help with the manipulation and visualisation of
the spatial data. Cowen, Cundall, Helmunn and Richers (1996, p. 1064) defines a
function of a GIS as the ability to automatically synthesize existing layers of
geographic data and to update a database of spatial entities. As a result of the high
technical complexity of GIS technology, its availability has traditionally been limited
to government and public administrations. This is true even in the western
industrialised society (Caldeweyher, Jinglan & Pham, 2006) and the lack of
availability of GIS to the general public has caused some to label it as elitist and anti-
democratic technology and has motivated communities with spatial analysis needs
to turn to GIS vendors or universities for assistance. Unfortunately, in the long run,
this approach is not sustainable (Caldeweyher et al., 2006).

2.4 SPATIAL DECISION SUPPORT SYSTEMS (SDSS)

A SDSS is to some extent an integration of DSS and GIS technology. This idea
was first proposed in the paper from Densham and Goodchild (1989). Cowen
(Cowen et al., 1996, p. 1065) defines a SDSS as a decision support system
involving the integration of spatially referenced data in a problem-solving
environment. In 1980, Keen identified the characteristics of a SDSS as follows: it is
normally implemented for a limited problem domain; facilitated by the use of
analytical and statistical modelling; utilises a graphical interface to provide

Chapter 2: Literature Review 11


12

information to decision makers and can be easily modified and adapted to the
decision makers style (Densham & Goodchild, 1989). The advantage of a SDSS
over a GIS is that it provides a framework for incorporating analytical modelling
capabilities and database facilities to improve decision making.

A number of different groups of SDSS exist. These can be classified according


to their two main components: GIS and decision making (Malczewski, 2006).
According to Malczewski, in terms of the GIS component a SDSS can be broken
down to raster versus vector data, explicit and implicit spatial criteria and explicit
and implicit spatial alternatives. In terms of decision making there are two main
classifications: multi-objective and multi-attribute decision analysis. When it comes
to developing the model, the most popular choice in SDSS is the weighted
summation model (Malczewski, 2006). This is mostly due to the increased
complexity in sustainable decision making and the necessity to take into account
multiple objectives (Li, Yingyi & Li, 2009).

A user interface for a SDSS would consist of a GIS with maps, layers and other
topological data and it would be extended to provide and facilitate additional
decision-making tasks such as modelling and display of statistical data. A SDSS has
wide applications, the user interfaces of these tend to differ as a result of the features
they choose to implement. In 2007, Dye and Shaw (2007) developed a GIS-based
Spatial Decision Support System (SDSS) for tourism purposes. The aim of the
system they developed was to help users in locating facilities in the Great Smokey
National Park. In particular, it helps the user to find an optimised path through the
park based on the users preferences and constrains. The user interface of this system
collects constraints and preference, such as travel mode, travel distance, points of
interest and park facilities, from the user. This information is then passed on to the
processing unit of the application which calculates and finds the most suitable trails.
The system then plots the trails on a map and displays it to the user. It also displays
additional textual information describing the found trails. The system is designed to
be used from the computers located at the visitor information centre of the national
park.

Location planning is an important aspect in sustainable development. In 1997,


Sikder and Yasmin (1997) proposed a spatial decision support system (SDSS) for
location planning. The main objective of the research was to develop a decision

12 Chapter 2: Literature Review


13

support system to help decision makers find optimum locations to build additional
amenities for existing or new settlements. The interface of the developed systems has
the capability to add/delete amenities at any location and calculate optimum solutions
and perform spatial and statistical queries by clicking on graphical objects on the
screen.

In 2009, Li et al. (2009) developed a SDSS for land use and structure
optimisation. The main purpose of this was to figure out what land areas are most
suitable for what kind of development. The user interface of the proposed system
was developed using C# for Windows XP operating system. It uses the proprietary
ArcGIS for the display and analysis of geographic data. The user interface integrates
all the modules in the system and provides the users with access to various
calculation models. It uses various geographic maps, layers and charts to display
result to the user.

There are certain similarities that exist with all the interfaces of these systems,
the most obvious is that they all utilise some sort of map to display the data and the
results. This can be identified as a key feature of a SDSS. The main limitation of all
of these systems is that their interfaces are desktop based and hence have very low
dissemination capabilities. In the case of the system developed for tourism purposes,
this would limit the access of customers accessing from home or overseas.

2.5 WEB SDSS AND WEB INTERFACES

Evidently the concept of DSS have been around for a quite while. After the
beginning of the internet in 1995 for mass commercialisation and the introduction of
the HTML 2.0 specifications with support for form and table tags, there was a
serious interest in developing DSS on web-based platforms (Power, 2007). In more
recent years, with the advent of web 2.0 and its capability to explicitly represent and
visualise information (Chavarriaga & Macias, 2009), the internet has become an
attractive platform to develop applications with rich user interfaces. Compared to
desktop application interfaces, the web platform also provides a similar look and
feel. There exists the capability to add menus, toolbars, pop up windows and context
menus into todays web applications. With the increase in internet bandwidth and
technologies such as AJAX (Asynchronous JavaScript and XML), the
responsiveness of the web applications are not second to their desktop counterparts.

Chapter 2: Literature Review 13


14

Given the similarity between web-based and desktop platforms for application
development, a web-based SDSS has a number of advantages over a desktop-based
system (Wu, Zhang, Chen & Dou, 2008). Web-based SDSS provide faster update of
information. Information can be updated by multiple groups of people spread across
multiple locations. This is vital for real-time systems that depend on data as it
becomes available. As the web-based system uses a client-server model, it provides
wider access to many users at the same time. This significantly increases the
dissemination of the system. Also since multiple users have access to the same
system, the maintenance and update of the system can be achieved much more easily.
Web-based systems only require a browser to use. With todays widespread
availability of internet access, it can be argued that majority of the non-technical
users are familiar with using a web-browser and have used at least some kind of web-
based application such as Facebook, MySpace, YouTube or Webmail. However, one
key limitation of a web-based system is the heavy load on the server which can result
in low bandwidth and time outs. Spreading the system across multiple servers could
alleviate this with some compromise regarding the maintenance and update
capability. Taking all these factors into consideration, a web-based implementation
of a SDSS will allow more effective and productive use of the system in the hands of
the non-technical users.

In Australia a good example of an online decision support tool is the Bureau of


Meteorology web site. It provides map based services for climate and weather that is
widely used in the community, including in rural areas. Google Earth, Google Maps
and Bing Maps are a few other widely popular online map based decision making
tools.

Bell, Dean, and Blake (2000) developed a web-based special decision support
system for urban planning. They utilised a practical land use model to develop the
projection for urban planning (PUP). The users access the model using a web-based
graphical interface and specify the scenarios using a HTML form. Upon submitting
the form the information is passed to the PUP model where the necessary calculation
and forecasting is performed. The use of forms in the GUI to some extent limits the
interactive capability of the interface when compared with the user directly
visualising the possible inputs, i.e. on a map. The result of the model is sent to the
browser to be displayed to the user. The system utilised a 3D animation feature

14 Chapter 2: Literature Review


15

called VRML for the purpose of visualising the results. The VRML animations can
be played using a browser embedded plug-in. In terms of the visualisation aspect the
system is capable of generating forecast for population growth, stock and
construction and stock and consumption. Even though this research focuses on the
urban context, some features of the interface are complementary to the rural context
as well. The use of 3D animation for visualisation of results would help to increase
the interactivity of the system. However, such high-end graphics capabilities come
with a big performance requirement and therefore will reduce the responsiveness of
the system. Also the fact that this will require a browser plug-in means that the end
user will need to fiddle around to get the system to a working state. All these add to
poor dissemination and reduce the user friendliness of the tool.

A similar tool was developed by Stimson in 2007 for benchmarking the socio-
economic performance in Queensland local government (Stimson & Shyy, 2007).
Stimson also argues that a major advantage of a web-based SDSS is that it is
platform independent and therefore it is more accessible and relevant to a wide range
of audiences. The prototype he developed provides a customised GIS, spatially
optimised model and a user interface and visualisation facilities. The system uses a
proprietary ESRI (Environmental Systems Research Institute) map objects internal
map server. The client interface is built using a java applet. The paper gives a good
overview of how the user can interact with the interface. It shows how the user can
compare and classify different map regions in terms of economic development and
employment. However, it could be argued that the user interface consists of too many
forms with a lot of drop-down choice boxes which are not very responsive and hence
may be tedious for a non-technically inclined user. This design limits the interactivity
of the system, and of course, this prototype system does not specifically focus on the
rural context and sustainable development.

A more interactive prototype web-based SDSS developed by Caldeweyher et


al. (2006) is the open source GIS-based web community information system
(Caldeweyher et al., 2006). Its purpose is that it empowers grassroots through GIS
technology (Caldeweyher et al., 2006, p. 1). This web-based system is built with
open source software and as a result of this it is meant to be affordable and readily
available to the general population. The system in its final stage has the capability to
display a map and add layers to it, such as population data and index of education

Chapter 2: Literature Review 15


16

and occupation. It also consists of a classification wizard which can help the user
to associate different styles, patterns and symbols with the layers. The system has the
capability to generate charts to display time series data. Limitations of the system are
that it does not consist of a fully automated layer addition and classification feature
and also the map generation parameters are hard coded which limits the way users
can visualise data and may not necessarily be in accordance with the users
requirements. Also, if the developer had implemented a time series slider function to
the system, which the user can move to travel through different time periods and
simultaneously receive updates of relevant data on the map, it would have improved
the interactivity and the usability of the system. To some extent, the lack of
interactive capability in this system can be attributed to under utilisation of proper
web 2.0 techniques such as AJAX technology. However improper and over
utilisation of AJAX could also reduce the responsiveness of the tasks due to complex
calculation and connection speed limitations.

In 2008, Wang developed a web-based SDSS for the purpose of flood


forecasting and flood risk mapping (Wang & Cheng, 2008). An interesting feature of
this proposed SDSS is that it combines together various databases from different
organisations to obtain real-time data and aims to provide the user with
comprehensive support for distributed information retrieval, analysis and modelling.
Wang does not publish much information on the interactive capability of the system,
suggesting that he did not focus much on this aspect, as the targeted users of this
system would be technically inclined personnel.

More specific work on user interface development for web GIS was conducted
by Bhalla et al (2002). Bhallas system is developed to be simple and to
accommodate users with no GIS-based query skills. Bhalla utilised an option-based
interface to perform object and path navigation to capture user intent. These inputs
are later converted to SQL (Structured Query Language) statements and passed to the
database to retrieve the appropriate information. The system interface works by
asking the user to choose a GIS object, such as a river. Once this is selected it
provide the users with options to choose conditions for the object: to display a list of
relevant objects from the database, to combine it with another object, for example a
road object to see what roads intersect a river, or to display attributes of an object.
As the interface is designed to be simple, it lacks the more sophisticated interactive

16 Chapter 2: Literature Review


17

capabilities and it follows more of a traditional sequential command-line style of user


interaction, rather than the more intuitive graphical user interaction style, where the
user is presented with all the tools and objects of the program.

Through the existing literature, it is possible and promising to extract and get
an idea of the basic components of a web-based Spatial Decision Support System.
Usually this type of system consists of a database tier, server tier and client tier. The
database tier is the place where all the information necessary for the system is
located. In a SDSS they are two types of data, spatial and attribute (Wu et al., 2008).
Spatial data consists of raster and vector-based geographic data such as layers and
maps (Malczewski, 2006) which need to be stored and handled differently to
attribute data such as population and health data. The server tier is responsible for
the main logic of the system. This is where the calculating models of the system fit
in. Muracevic and Orucevic (2008) describe a high level platform called MapGuide
open source that helps to develop interactive web-based GIS. This software provides
a repository and a mapserver that has the capability to handle and serve spatial data
and also it provides customisable and extendable client-side viewers that can be used
to display spatial and attribute data and obtain user input interactively.

Compared to online Mapping tools such as Google and Bing Maps, MapGuide
open source provides a higher level of interactivity. On top of this it provides a well
structured architecture to build web based applications. It is possible to create simple
static map based web site using Google Maps for example. However this could be
too limiting when providing advanced decision making capability.

Chapter 2: Literature Review 17


Chapter 3: Technology and Data

The system developed through this research aims to be sustainable in the long
term, therefore it is beneficial to utilise open source and freely available software and
technologies as much as possible. Open source software allows developers to make
their own modifications to the software rather than waiting for a proprietor to do
what is best for everyone. This ensures that the appropriate future extensions and/or
modifications can be made to the system in a timely manner without having to look
for new alternative technologies (Kavanagh, 2004). Todays open source software
provides good out-of-the-box functionality, performance and reliability comparable
to their proprietary counterparts (Wheeler, 2007). Therefore, the money that would
have been spent on the technology can be used instead on more developer time. In
this project, open source software is used throughout the development of the system,
except in one occasion when modifying some of the spatial data files. This is
documented in section 4.4.1.

MapServer MapGuide Open Source Geoserver

Pros
Matured software (1990) Easy web-based configuration Easy web-based
configuration
WMS, WFS Standards WMS, WFS Standards WMS, WFS Standards
Data Formats: Vector and Data Formats: Vector and Raster Data for Formats: Vector
Raster and Raster
Common database support Common database support MySQL, Common database support
MySQL, PostgreSQL PostgreSQL MySQL, PostgreSQL
Active development Active development Support for mapping
interface
Support for 3 different mapping
interfaces. AJAX, DWF and Fusion
Free Map authoring tools: Web
Studio and MapGuide Maestro
Cons

No inherent client interface. Made open source quite recently Not widely known
(2006)
Table 1: Comparison of Alternative Web GIS Technology

Chapter 3: Technology and Data 19


20

The system that is developed here needs to be able to handle the serving and
display of raster and vector-based maps. For this purpose a number of open source
technologies have been considered. The selected map server/renderer should be easy
to use, quick to develop in and provide good documentation and support. The
considered alternatives include MapServer, MapGuide Open Source (OS) and
Geoserver. Table 1 evaluates these technologies.

As shown in Table 1, all the compared alternatives support standard spatial


data formats and online map servers. They also support the use of popular relational
databases for accessing spatial data. Among them, MapServer is the oldest and
MapGuide OS is the youngest technology. Out of these alternatives, only MapGuide
provides client interface development facilities through AJAX, DWF and Fusion.
This helps to significantly speed up the development process.

After evaluation, MapGuide Open Source is chosen as the preferred map


server/renderer, as it provides a set of tools to define, create and serve maps as well
as tools for the development of the client interface. Further, it is open source
software and is currently active in development, with good documentation and
forums for help and support.

3.1 MAPGUIDE OPEN SOURCE

The availability of web 2.0 technologies makes it easier to develop web


applications with interactive capabilities similar to that of desktop applications.
MapGuide Open Source harnesses these new technologies and takes the development
of web-based GIS to a new level. It provides good interactive capabilities in the
manipulation of spatial data and allows the integration of many popular vector data
formats. However, there is still much to be explored and developed along the lines of
MapGuide OS and other web GIS when it come to their application as a decision
support tool.

20 Chapter 3: Technology and Data


21

MapGuide Open Source is developed on the basic three-tier web application


architecture. That is the client tier, web tier and the server tier. Figure 1 below shows
the architecture of MapGuide Open Source.

Figure 1: The Architecture of MapGuide Open Source (MapGuide, 2010)

The client tier is where the user accesses the system. This is where all the
vector map data is rendered. The user accesses this through a standard web browser.
MapGuide OS provides two viewers that can be used to integrate the user interface
into a web browser. These are the DWF and Ajax viewers. Both of these viewers
provide a general interface with the capability to extend and develop using a
common JavaScript API. Therefore the interfaces developed for either of the two
viewers are portable across the two different technologies.

The Ajax viewer is fully implemented in HTML, CSS, JavaScript and XML.
Therefore, it does not require anything extra to be downloaded or installed and it is
naturally supported by all major browsers such as Internet Explorer, Firefox and
Safari. DWF viewer, on the other hand is a proprietary plug-in based on Microsofts

Chapter 3: Technology and Data 21


22

ActiveX control technology and it only works in Internet Explorer. In this project, we
use the AJAX viewer for its native support of all major browsers which requires no
setting up or configuration by the user. This improves the dissemination capability of
the tool.

The web tier is where the application logic of the system is specified. The core
of MapGuide is developed using PHP and it runs on the freely available Apache
server. However, the developers are not limited to just using the PHP language.
MapGuide supports development and provides APIs for three different languages:
PHP, ASP.NET and Java. Development using Java or ASP.Net provides good
structure to the code as these follow the object-oriented paradigm well. MapGuide
also support three different servers in developing the application logic: the Apache
server for development using PHP, Apache Tomcat server for development using
Java/JSP and the Microsoft IIS server for development using ASP.NET. In this
project we use the Java and Tomcat combination as they are freely available and can
also be easily ported to different systems due to operating system independence.

Finally the server tier is where the data is stored. This data includes attribute
data as well as spatial data. MapGuide uses a separate MapGuide server to serve the
vector data. It provides seven different services: Site Service, Resource Service,
Drawing Service, Feature Service, Mapping Service, Rendering Service, and Tile
Service. The MapGuide server communicates with the web server via MapGuide
API (Application Programming Interface). This API is available in all three
supported languages; in our case we use the MapGuide Java API.

3.2 DATA AND DATABASE

There is a significant amount of data that is required for this project. Most of
this data has been collected by other researchers in the project team for developing
the RSSF. The data was collected based on its relevance to sustainability, focussing
on three key aspects: social, economical and environmental. For each of these
aspects, there are number of sustainability indicators that determined what data was
to be collected, as well as the availability of data.

Once the necessary attribute data is obtained, it needs to be classified into


tables with appropriate relations and stored on a database server. This process applies
normalisations to the data and helps to remove any duplication and keep the data in

22 Chapter 3: Technology and Data


23

an easily (and quickly) retrievable format. For database development, two freely
available options are MySQL and PostgreSQL. Both of these database servers
provide support for spatial data. For this project MySQL is chosen as the preferred
database server. MySQL is an open source relational database management system
with a large community base. It is the most popular freely available database used in
the world and therefore it is easy to obtain help and support through many forums
and mailing lists. The current QUT development servers already support
development using MySQL, without the need for further setting up and
configuration.

Figure 2: FDO Provider Architecture (Rieksp, 2007)

MySQL also supports the handling of spatial data through its spatial extension.
MapGuide provides the Feature Data Objects (FDO) data access technology to
connect to MySQL and access this spatial data. The architecture of the FDO provider
is depicted in Figure 2. The purpose of FDO is to provide a means to access spatial
data from different spatial storages and formats. In terms of support for storages it is
not just limited to MySQL. The FDO, through various different providers, supports
connections to Oracle Spatial, SQL Server, ArcSDE ODBC, OpenGIS Web Map
Service (WMS), Web Feature Service (WFS) and various different raster formats. In

Chapter 3: Technology and Data 23


24

addition to this it also supports using the ESRI Shapefile format (SHP) and the
Autodesk Spatial Data Format (SDF). SHP is a very popular spatial vector data
format developed and regulated by ESRI and is to the most extent considered an
open standard. SHP is an industry standard format and thus most of the spatial data
that is available and useful for this project is in this format. MapGuides support of
this format through the FDO provider is therefore very beneficial.

3.2.1 SPATIAL DATA

Other than attribute data, the system also requires spatial data, that is, raster
and vector-based geographical data. Raster data is simply images of maps such as
satellite imagery or drawings with a projected coordinate system. On the other hand
vector geographical data consists of points, lines and polygons to represent geometric
features. These carry with them a coordinate system and scales. They usually come
in table format, specifying the values that make up the shapes in relation to their
position in space. Since vector geographical data uses numerical means to represent a
map we need to use a GIS viewer to visualise these data. A GIS viewer processes the
vector data and renders it to an image. As a result, the maps generated in this way do
not lose quality when zoomed in, because a new image can be generated for this new
zoom level with an expanded scale.

Usually one particular spatial data file (for example a SHP file) consists of a set
of features, such as the geometry and location of all the rivers and lakes in
Queensland with each lake or river being the feature. Such a collection of features is
termed a layer. Combining these layers together forms a map. As mentioned
previously, spatial data is represented using lines, points and polygons and may need
to be customised in terms of the colour, font size, line thickness, transparency and by
omission of certain features.

To perform such map building it is essential to have an authoring tool.


MapGuide Open Source comes with a limited edition web-based map authoring tool
that is provided for use with map authoring. We experimented with this tool to define
and connect maps and found it to be error prone and not functioning as intended.
After further investigation we found a different tool called MapGuide Maestro that is
developed as part of the MapGuide project as an open source map authoring tool. We
found this tool to be very useful. MapGuide Maestro can also be used to extend the

24 Chapter 3: Technology and Data


25

MapGuide Ajax interface layout. It can be used to adjust the size of the columns, to
enable or disable certain buttons or panels and to add new tasks to the application.

3.2.2 SPATIAL DATA FOR THE USER INTERFACE

To start the user interface construction, spatial data for the study area needs to
be obtained. Here, it needs to be shown on a map of the Queensland region relative
to other areas, to reflect the rural context. A number of layers need to be created to
represent the different interests within these regions such as locality boundaries, land
use mappings and dams and lakes. For this project all the spatial data used is in SHP
vector format. We purchased this data from the Department of Environment and
Resource Management (DERM). The ordered package was sent to us in a DVD and
it included general purpose maps, Land vegetation and water maps and property
information data.

It was proposed to initially develop the system for one specific rural location as
it can later be easily expanded to more areas by integrating more data. The chosen
areas were the Western and Southern Downs Local Government Areas. From the
DERM spatial dataset, the necessary data files relating to these areas were chosen
and included in a map package as described in section 4.4.1.

3.3 CHARTS

To visualise data and calculated results, it is important that the system is


capable of plotting and displaying charts. For this purpose we use a free Java
charting package called JFreeChart. JFreeChart provides a well documented API that
supports creating many different charts. It is well suited for applications that are
developed for the desktop as well as the web (Gilbert, 2009).

3.4 MAPGUIDE MAESTRO

The map resources needed for MapGuide are specified as XML documents.
MapGuide Maestro provides a graphical tool to create and customise these
documents. It also automatically validated these XML documents against an
appropriate schema definition. It can be used to create connection to spatial data,
create Layers, define maps and modify the MapGuide client interface (layout). Using
MapGuide Maestro we created a map package for our tool. This package was then

Chapter 3: Technology and Data 25


26

placed in the package directory of the mapguide server from where it was served and
rendered on the client tire.

3.5 SUMMARY

The technologies used in this research are mostly open source and freely
available options. For map rendering and serving we used MapGuide Open Source. It
follows the common three-tier architecture for web-based application development:
server tier, web tier and client tier. The server tier features the MapGuide server and
our chosen database platform, which is MySQL. For the web-tier development we
used the Java/Tomcat combination. A customised version of the MapGuide AJAX
viewer is used as the client tier. To support chart generation we used the JFreeChart
Java library. Using the MapGuide Java API, we created the application logic to link
the MapGuide AJAX viewer with the MapGuide server and the MySQL database.
The specifics of this are described in the following chapters.

For better quality and easy integration we utilised vector-based spatial data.
The spatial data is directly stored on the server library, avoiding the need to
transform it on to a relational database. It is modified, manipulated and connected to
the MapGuide server using the MapGuide Maestro desktop application. Table 2
gives a summary of the main technologies used.

Tool Use Source


MapGuide Open Map
http://mapguide.osgeo.org/
Source server/renderer
Map definition
MapGuide
and interface http://trac.osgeo.org/mapguide/wiki/maestro
Maestro
customisation
http://www.esri.com/industries/apps/educati
ArcGIS Clip vector data
on/offers/promo/index.cfm
Chart generation
JFreeChart http://www.jfree.org/jfreechart/
with Java
Data storage and
MySQL http://www.mysql.com/downloads/
retrieval
Table 2: Tools Used in Development

26 Chapter 3: Technology and Data


Chapter 4: The Approach

The technologies described above are set up and integrated to initially form the
basic system. Subsequently new tasks were added to this system to further extend
and customise the functionality to form the final system. This section gives an
overview of the MapGuide installation. Figure 3 below shows an abstract flow chart
of the integration process. A detailed description about our approach is specified in
the following sections.

SHP
ClippedSHP
Map ArcGIS
Data
Data

MapGuide
Maestro
MapPackage

WebTier

ApplicationLogic
MapGuide
SpatialServer MapGuideJSPCode
CustomTasks

ClientTier
ServerTier Libraries
WebBrowser
MapGuide AJAXViewer
MySQLConnector
JreeChart

MySQLDatabase
Classes

DatabaseAccess
DatabaseConnection

Attribute
Data

Figure 3: Integration Process Flowchart

Chapter 4: The Approach 27


28

4.1 MAPGUIDE SETUP

Setting up MapGuide on a Windows system is fairly straight forward.


MapGuide comes with a standard installer for installing and setting up the MapGuide
server and the appropriate web server. This installer creates two sub directories under
the MapGuide root directory (<MGROOT>) [C:\Program Files\MapGuideOpenSource2.0]:
the Server and WebServerExtensions directories.

As previously mentioned, for this project we use the Tomcat web server
extension. The web extension here forms the web tier of the application architecture
described previously. Within the web extensions directory is the Apache server,
Tomcat server and the PHP installation that is required for the core operation of
MapGuide. Alongside this is the root directory of the application (AppRoot) named
www. This directory consists of all the Java/JSP and PHP files necessary to generate
the basic interface and render the maps on the clients browser. New files can be
added here or the existing ones modified to extend the behaviour and appearance of
the application. All the files necessary for our tool are placed in this directory under a
new directory called rssfTool. In addition to the basic interface, MapGuide also
provides a client-based site administration facility written in PHP. The files
necessary for this are also located under [<MGROOT>\www\] mapadmin directory.

The installer configures the Apache server to be setup on port 8008. The
Apache server is the main access point to the tool. Since we are using Java/JSP to
develop the application the Java version of the application files and the newly added
extensions and tasks to the application are all forwarded to the Tomcat server. The
AppRoot directory, www, itself is given the alias mapguide in the Apache
configuration, to be referred to as such when used in an URL. For example when
referring to the main file of the application using a web browser the following URL
will be used: serveraddress:8008/mapguide/rssfTool/ajaxviewerRSSF.jsp. All of the above
configurations are performed using the configuration file, httpd.conf, located in the
conf directory of the Apache installation.

The Server sub directory, among the two that were mentioned at the beginning,
is for the MapGuide server installation. This is where the packages of spatial data are
uploaded to. This, together with the MySQL database server, forms the server tier.
The Figure 4 shows the directory structure of MapGuide open source 2.0 and the
associated tiers.

28 Chapter 4: The Approach


29

MapGuideOpen
Source2.0

Server
ServerTier

Packages

WebServerExtensions

Tomcat

bin

lib

www

mapadmin

mapagent

mapviewerjava
ClientTier
viewerfiles

rssfTool
WebTier
WEBINF

Figure 4: MapGuide Open Source Directory Structure

Chapter 4: The Approach 29


30

4.2 IMPLEMENTATION

To implement our tool, we first installed the MapGuide open source 2.0
package (MgServerSetup-2.0.2.3011.exe), as described above, on our development
machine. The default installation included the MapGuide spatial server and the
MapGuide client Ajax interface. During the installation process, we opted for
installing the Apache Tomcat web server extension for our web tier. This was so that
we could develop custom extensions to MapGuide using Java/JSP.

To familiarise ourselves with MapGuide, we obtained a sample spatial data


package from MapGuide website. This package was called Sheboygan.mgp and it
was in MapGuide specific Map Package (.mpg) file format. Following the
MapGuide Getting Started Guide, we added the spatial data and configured the
system for initial use. According to the guide, we placed the sample spatial data in
the following directory: [<MGROOT>\Server\Packages]. To load this data to MapGuide
spatial repository, we browse to the following URL:
http://localhost:8008/mapguide/mapadmin/login.php. From there using the default
username and password (Administrator and admin respectively) we logged into
MapGuide Site Administrator application. Once logged in, we browsed to Manage
Packages from the left menu and clicked on the radio button next to
Sheboygan.mgp and clicked on Load Package.

According to MapGuide documentation, the following directory made up the


applications web tier: [<MGROOT>\WebServerExtensions\www\]. This directory also
consisted of the Java/JSP files used to generate the client tier. These file were placed
in the mapviewerjava directory. These JSP files used HTML and JavaScript
templates to generate the client interface. All of these templates were located in the
[<MGROOT>\WebServerExtensions\www\] viewerfiles directory. MapGuide also provided
sample Java files (javaviewersample.zip) that can be used to load the sample data and
the MapGuide application on a web browser. To test these sample files, we copied
them to the [<MGROOT>\ WebServerExtensions\www\] javaviewersample directory. The
ajaxviewersample.jsp file, provided in the sample, showed us exactly how to load
MapGuide application on a web browser. The sample of the required Java source
code is presented in Figure 5.

30 Chapter 4: The Approach


31

<%
// Initialize a JSP session and register a variable to hold the
// session id, then initialize the Web Extensions, and connect
// to the site, and create a session.
InitializeWebTier();
MgUserInformation userInfo = new MgUserInformation("Anonymous", "");
MgSite site = new MgSite();
site.Open(userInfo);
String sessionId = site.CreateSession();

String webLayout =
"Library://Samples/Sheboygan/Layouts/SheboyganJsp.WebLayout";

%>

Figure 5: Java Source Code for Loading the Web Layout

The source code in Figure 5 demonstrates how to point to the SheboyganJsp


layout in the Sheboygan map package that we had uploaded. It does this by
specifying the appropriate resource identifier to the webLayout variable. After we
have become familiarised with mapguide in this way, we modified and extended it to
apply to our particular problem.

4.3 DECISION SUPPORT EXTENSION

Due to the limited time frame of this research and the limited availability of
data, the decision support aspect was scoped appropriately. It was decided that this
research will only focus on the integration and presentation of data for decision
support. The research and development of statistical and econometric modelling were
considered out of scope but a possible extension to the tool, which could be
incorporated in the future. The research approach focused on the overall architecture
of the system and how different components could be integrated. Under these
constraints the resulting tool can be categorised as an Information Handline Tool
according to Hershs classification of decision support systems (Hersh, 1999).
According to the planning process described by Tornqvist, this tool would be useful
in the Awareness Raising and Shaping Modes of the planning process (Tornqvist
et al., 2008).

To aid in the decision making and planning process we developed and


integrated four tasks into the MapGuide package. The ability to process spatial input
and to visualise output on maps, was considered an important feature for a spatial
decision support tool (Caldeweyher et al., 2006). To provide such processing
capability to the tool, we developed the locality classification task. The purpose of

Chapter 4: The Approach 31


32

this task was to categorically display localities on the map, that falls above or below
a specified standard or threshold value for a given core indicator. This could be used
to easily identify performance gaps and differences between localities. The ability to
generate and display time series charts was also considered an important feature for
the proposed decision support tool. This was a key requirement for the rural council
decisions makers. Another important feature that was addressed during our
discussions was the ability to perform impact assessment. This feature involves
predicting how a change in a particular core indicator value, for a certain locality or
an area, affects the localities main services. Therefore it required advanced analysis
and modelling capabilities and as this research did not focus on this aspect, the task
we developed only focused on the input retrieval, processing and display. The
appropriate modelling and analysis capability were decided to be developed and
integrated to the task in the future work.

To develop the system we followed the client-server architecture as described


in the technology and data section. It utilised an incremental software development
method, where the system was broken down into smaller parts and each of these
were designed, developed and tested separately and later incorporated together to
form the complete system. This allowed the outcomes of the project to be
continuously available to us and also made it easier to incorporate any late
requirement changes. Overall to apply MapGuide and to develop the tool we went
through the following progressive stages:

Spatial data gathering and customising

MapGuide AJAX Interface customising

Database Development

Developing and integrating the four tasks

The following sections give detailed discussion of our approach in each of these
stages.

4.4 INTERFACE DESIGN

To apply MapGuide to our particular case, we first start off designing the
interface. As MapGuide Ajax viewer comes with the ability to display and interact
with spatial data, it required no additional development from us with regards to this.

32 Chapter 4: The Approach


33

What we did was to integrate the spatial data for the regions that this tool was
intended to be used in. We obtained this spatial data from the Department of
Environment and Resource Management (DERM, 2010). The spatial data obtained
from DERM was in Shapefile (shp) format. In order to use this spatial data with
MapGuide we performed a map building process.

4.4.1 MAP BUILDING

As mentioned in the spatial data section, spatial data formats (in our case the
SHP format) can be modified, manipulated and combined into a map package using
MapGuide Maestro. It is important to keep the size of each data file to a minimum,
as much as possible as this tool will ultimately need to be accessed via the internet,
and given the lower bandwidth of the internet (in particularly, for local councils in
rural growing regions) the size of the data determines the load time of the tool.
However the spatial data obtained from DERM covered the whole of Queensland.
Using all of this data made the application unnecessarily slower. Therefore, we made
a separate copy of some of these SHP files to only include the data for the Western
and Southern Downs regions. We used ArcGIS to do this.

To restrict the spatial data, to the Western and Southern Downs regions, we
used a full copy of the Local Government Area (LGA) layer and removed all other
LGAs on that layer. This new layer was then placed on top of other SHP layer files
that we were interested in customising, to extract the relevant portions using the
clipper tool provided in ArcGIS. This was the only occasion proprietary software
was used in the development of the tool. As mentioned, ArcGIS was only used at the
initial stage of the development for minor data processing purposes. Once the spatial
data was put into the appropriate form we continued to use those data without
depending on ArcGIS.

To start the map package creation process, in MapGuide Maestro, we created a


root element for our map package called QLD. Within this root element there are
four sub elements: Data, Layer, Layout and Maps. This structure is common to all
map packages. The data sub element consists of all the spatial data files. For our
spatial dataset we utilised the following data: outline of QLD (Queensland), Local
Government Area Boundaries, Locality Boundaries, Dams and Lakes, Land Use
Mapping, Place Names and Property Boundaries. Figure 6 shows a screenshot of
MapGuide Maestro application. The column on the left side of the figure shows the

Chapter 4: The Approach 33


34

element structure used in the map building process. This particular example depicts
the LGA Boundary spatial connection and all the necessary data files associated with
that connection.

Figure 6: MapGuide Maestro Desktop Application

For each of these datasets we created a layer. To these layers an appropriate


colour scheme was added to the area and boundary of the features. Also the layers
Dams and Lakes and Land Use Mapping were disabled from being displayed in the
initial view and the user was given the option to enable it through the layer selection
panel. The layers that were deemed not essential in the initial loading were disabled
in this way, later giving the user the option to turn them on if they so wish to. With
this approach we improved the load time and data accessibility efficiency of the
application. The transparencies of the layers were also organised with MapGuide
Maestro. Initially, we designed the map so that on the first load of the application the
user only sees the LGA boundaries and their respective names. When the user zooms
in to a certain level, the locality boundaries were revealed. Zooming in further
revealed the property boundaries. Given the above scenario, the LGA boundaries
layer needs to be seated above the locality boundaries layer. When the zoom level
had reached a certain point, the LGA boundaries layer was made fully transparent. It
was important to do this in this way because it allowed us to keep the LGA borders
visible while also displaying the Localities. This avoided any confusion as to which
region (LGA) each of these localities belonged to, especially for the Localities that
were closer to the LGA border.

34 Chapter 4: The Approach


35

Defining the Map and Layout


After we had set up the layers (for each of the spatial datasets), we defined the
map. A map was defined by stacking up all the layers in a pre-planned appropriate
order. As mentioned before this information was necessary to determine which layer
needed transparency. As a result map definition and layer definition were performed
in parallel. In map definition, we also specified groups for each of the layers in the
map. The LGA Boundaries, Locality Boundaries and QLD Outline were placed in
the Base Map Group. A separate group was created for Land Use Mapping. The
Dams and Lakes layer was placed under Features and finally the Properties group
was populated with Property Layers for the Western and Southern Downs regions.
Figure 7 shows the map definition screen in MapGuide Maestro.

Chapter 4: The Approach 35


36

Figure 7: MapGuide Maestro Map Definition

Figure 8: MapGuide Maestro Interface Layout Setup

In MapGuide Maestro we also created a layout for the web application. This
was specified under the Layouts element. The layout we created was based on the
default layout template. We named it simpleJsp. We edited this layout to increase the
width of the task display area to 450 Pixels, as we found the default value to be too
small. Figure 8 shows the screen for MapGuide Maestro layout setup. After we have
completed map definition in MapGuide Maestro, all of the map resources (the SHP

36 Chapter 4: The Approach


37

spatial data, layer, layout and map definition files) were then exported to a map
package.

We then placed this package in the package directory of the MapGuide server.
To load this package we used the site administrator facility (Site Administrator is
accessed using a web browser by pointing it to the URL:
serveraddress:8008/mapguide/admin/login.php). Once logged in, we select Manage
Packages from the left menu. The package that was placed on the package directory
appeared under load packages in the newly loaded web page. We selected this
package and clicked on Load Package. Once this was completed, all the spatial
data within the package could be accessed via the web tier and rendered on the client
tier.

Instead of connecting all the SHP files directly via MapGuide Maestro as
described above, we could also load all the spatial data to the MySQL database, and
then connect it to MapGuide application using MapGuide Maestro and its MySQL
FDO provider. This approach was not pursued as this data is likely to remain
relatively static and therefore placing them on a relational database would create an
unnecessary overhead due to database connection and querying. Instead, we use
MySQL to simply store all the attribute data belonging to environmental, economic
and social categories for each of the regions.

4.4.2 CHART DISPLAY

As the interface of the tool was used for decision support purposes it therefore
required the capability to present statistical data. A good way to visualise statistical
data is by using charts. Therefore, we extended the MapGuide AJAX interface to
facilitate this.

Initially, it was designed to display the charts on a pop up window. However,


this was somewhat obstructive and a better alternative was investigated to have the
chart displayed on top of the map itself. After looking through the code for the
MapGuide AJAX viewer, we discovered a method to place a chart as an overlay on
the map. MapGuide AJAX viewer displays map data on its HTML map frame as
images. These images are stacked on top of each other with the CSS Z-index.
Therefore, we created a CSS DIV element (called chart) with the Z-index higher
than that of MapGuides highest overlay on its map frame.

Chapter 4: The Approach 37


38

MapGuide uses HTML templates to generate the AJAX interface. We added an


extra JavaScript function called toggleContent() to the template ajaxmappane.templ
located in [<MGROOT>\WebServerExtensions\www\] viewerfiles. This function was
designed to attach a chart image to the chart DIV element we created. As we did
not need to see a chart in the normal operation of the tool, the chart display was
handled dynamically at runtime.

As indicated in the Technology and Data section, we used JfreeChart for chart
generation. To use JfreeChart, we downloaded the latest JfreeChart Java library
(jfreechart-1.0.13.jar) (Gilbert, 2009). We then placed this file in the
[MGROOT\WebServerExtensions\www\WEB-INF\] lib directory of our tomcat web tier.
With JfreeChart, we generated charts as PNG images on the server. Each of our Java
based tasks, which generated a chart as output, was designed to generate the code
necessary to embed that chart on to a web page. This was, to use the newly created
chart image name and location, to generate a HTML image tag and store it in a Java
String variable. We use Ajax to transfer this string, as an output, back to the request
initiated JavaScript function in the client tier. When this function receives the
response, it passes it to our toggleContent() JavaScript function which retrieves the
appropriate tag from the MapGuides map frame and attaches the code (the chart
image) to it.

The toggleContent() function we created also serves another purpose this


was to toggle the chart overly on and off. To perform the toggle operation the
toggleContent() function was invoked through a linked image near the border of the
map frame, located at the bottom of the task window (refer to Figure 20 in section
5.2.2). This image represented an arrow which when pointed towards the map frame
indicated that the chart overlay was expanded and shown to the user (when in the
opposite direction, it indicated the overlay was contracted or minimised). We linked
this image so that when the user clicked on it, the toggleContent() function was
called with an empty string as input. The empty string was important here to
distinguish the toggle operation from the initially described code embedding
operation. Each time toggleContent() function was called with an empty string, we
used a Boolean toggle variable, to alternate the visibility of the HTML overlay
element, from visible to hidden. This made it appear as if the chart was being
minimised and maximised.

38 Chapter 4: The Approach


39

4.4.3 TASK DISPLAY

The custom tasks for this application were populated on the task display area.
An available list of the tasks can be viewed by clicking on the task icon located on
the top right corner of the task display area. When this icon was clicked, a call was
made to OpenTaskMenu() JavaScript function which was provided as part of the
MapGuide JavaScript API. This function was specified in the HTML code located in
the task frame [<MGROOT>\ WebServerExtensions \www\viewerfiles\taskframe.templ]. Once
the application was generated on the web browser, the OpenTaskMenu() function
toggled the task list i.e. it slides it open just so that there was enough space to display
all of the available tasks. This is depicted in Figure 9. The default MapGuide
behaviour was to hide the task list in the initial load. The user must click on the
Tasks button to unfold the list and this list was retracted back after a set amount of
time. This made it difficult for the user to locate the tasks and thus reduced the
usability and efficiency of the tool. Therefore, we modified the OpenTaskMenu()
function to add an initial slide operation when the tool loads and to disable the timed
retraction of the task list.

Figure 9: Expanded Task List

Chapter 4: The Approach 39


40

The specific tasks that need to appear in this list were added to the simpleJsp
layout that we created in MapGuide Maestro. In MapGuide Maestro, we specified a
task with a name and a link to the file that needed to be invoked to perform the task.
Figure 10 shows an example of this for the locality classification task. As we used
the Java web extension for our web tier all of the tasks were developed in this
language.

Figure 10: Task List Setup in MapGuide Maestro

4.5 DATABASE DESIGN

The Majority of the attribute data for this project was available to us in Excel
format. The researches involved in collecting the data had organised the data in to a
simple and easy to use structure. This data was categorised as per the environmental,
economic and social categories. Each of these categories consisted of a set of themes,
each of these themes consisted of a set of issues and a particular issue had number of
core indicators.

We designed the database to represent this hierarchical structure of the data.


We decided to create five main tables: categories, themes, issues, coreindicators and
regions. To develop the database model we used MySQL workbench 5.1 OSS. In
MySQL workbench, we created a new schema called isr. To this schema, we added
the above five tables. For each of these tables we created a unique ID column, which
was setup as the primary key, alone with the other relevant columns. We also

40 Chapter 4: The Approach


41

specified a UNIQUE constraint on each of the name columns of the tables, to


prevent duplication of data. Once the tables were all setup, we created an Extended
Entity-Relationship (EER) diagram in MySQL using these tables.

In the EER diagram we specified the relationship between each of these tables.
The set of region names for which the data in the table belong to were stored in the
regions table. We specified the regions and the coreIndicators tables to have a
many-to-many relationship as one region can have multiple coreIndicators and one
coreIndicator can belong to many regions. This relationship was specified using the
intermediate table coreIndicatorsData. The coreIndicatorsData table also stored the
year to which a specific core indicator data belong to. To prevent duplication of data
in the coreindicatorsdata table, we specified a combined UNIQUE constrain on the
RegionsID, CoreIndicatorsID and Year columns. Figure 11 shows the database
tables and their relationships.

Once the database model was completed, we established a connection to the


local MySQL database server in MySQL workbench. Then we forward engineered
the model, from MySQL Workbench (from the toolbar: Database Forward
Engineer...), on to the database server.

Chapter 4: The Approach 41


42

Figure 11: Project Database Structure

42 Chapter 4: The Approach


43

To connect to the database from our proposed tasks, we used the MySQL Java
connector (mysql-connector-java-5.1.10-bin.jar). This connector operates over the
Java Database Connectivity (JDBC) API. We placed this file in the following
directory: [<MGROOT>\WebServerExtensions\www\WEB-INF\lib].

To help query the database from our tasks, we created two Java classes. These
were the DatabaseConnection and DatabaseAccess classes. The
DatabaseConnection class stored all the information such as the driver name,
database location address, username and password that was necessary to make a
successful connection to the database. DatabaseAccess took an instance of
DatabaseConnection class as input to establish a connection. It consisted of methods
to load the drivers, make procedure calls, execute SQL query statements and update
statements that were passed as strings.

4.6 TASK DESIGN

All custom tasks for MapGuide were developed using Java/JSP. These tasks
extended the web tier of MapGuide. To setup the environment for our tasks we
created another directory called, rssfTool inside the [<MGROOT>\WebServerExtensions\]
www directory. We copied the ajaxviewersample.jsp to this directory and renamed it
to ajaxviewerRSSF.jsp. Then we modified this file to point to our map layout that we
generated and stored in the mapguide spatial server with MapGuide Maestro. We did
this by modifying the webLayout variable to point to
"Library://QLD/Layouts/simpleJsp.WebLayout". We also created a number of other
directories under rssfTool directory for each of our tasks. The main files within these
directories were linked to the simpleJsp layout as described previously in Task
Display section.

Chapter 4: The Approach 43


44

Each of our tasks required the ability to communicate with the server tier and
client tier (interface). MapGuide comes with a developer guide and a Java
Application programming interface (API). The Java API gives description about all
of the Java classes that were implemented to access the MapGuide spatial server. To
use this API, the MapGuideApi.jar file needed to be placed in the
[\<MGROOT>\WebServerExtensions\Tomcat\] lib directory. This was done for us
automatically during the installation as we opted for the Tomcat web server
extension. MapGuide also provide a JavaScript API, which can be used in our
JavaScript code to communicate with the client tier. We used it to perform operations
such as getting and clearing the user selected items on the map, setting the zoom and
scale of the map, and refreshing the map. As indicated in the beginning of this
chapter, this client tier was generated by the MapGuide JSP files inside
[<MGROOT>\WebServerExtensions\www\] mapviewerjava directory.

Initially, to develop JSP code we used a simple text editor with syntax
highlighting, called PSPad. JSP files
usually consist of code from Java,
JavaScript and HTML. As a result most
text editors in this situation fail to provide
adequate syntax highlight. However,
PSPad was able to apply syntax
highlighting for the three languages
separately within the same file. This made
it easier to edit the code with PSPad.
However, the downside to using PSPad
was that it provided no syntax error
checking. The only way these errors were
correct was after testing each of those
tasks on a browser. Since in this case, the
tomcat server attempted to compile and
run the code and generated errors if it
failed. As this was a time consuming
process, we later decided to use Eclipse
(3.6) to develop the code. The advantage Figure 12: Eclipse Project Directories

44 Chapter 4: The Approach


45

of Eclipse was that it provided automatic syntax and dependency error checking
capability in addition to multiple language syntax highlighting. This increased our
software development productivity, as all syntax errors were shown and corrected in
real time while writing the code. As a result of this, when functional testing was
performed only the relevant runtime problems were detected.

The downside to using Eclipse was that it required more setting up. However,
once these settings were made, it operated smoothly. To develop software in eclipse
we had to create a new Dynamic Web project. We called this project MapGuide.
When the Dynamic Web project option was selected, Eclipse automatically
generated the directory structure for the project. Within this directory structure was
the WebContent directory where the java files needed by the web application were
placed. However, we were not able to simply create our task files directly under this
directory as these tasks need other dependent libraries that were not available in the
Eclipse directories. These dependencies were installed in the MapGuide server
directories. Creating our tasks directly in the Eclipse directory produced dependency
errors by the automatic builder. This made it difficult to distinguish normal Java
errors from the dependency errors and therefore defeated the purpose of using
Eclipse.

One way to overcome this was to copy all the Java dependencies from
MapGuide server directory to the MapGuide project directory in Eclipse. However,
with this approach at the end of writing the code, all the new files needed to be
moved back to the MapGuide server directory, so that it could be run and tested as a
web application.

To avoid all this, we replicated our MapGuide server directory structure within
the Eclipse project. To do this we emptied the WebContent directory to delete all the
automatically generated content. Then we used the directory link feature in Eclipse to
create links within the WebConent directory to all the necessary MapGuide server
directories. This included mapviewerjava (MapGuide JSP libraries), WEB-INF
(MapGuide and other Jar libraries) and our task directory rssfTool. Figure 12 shows
the final directory structure and the linked directories within Eclipse. Once this was
completed, we verified that all the libraries were added correctly by right clicking on
the project name (MapGuide) and clicking properties. This loaded the properties for
the project. In project properties, from the left menu, we selected the Java Build path

Chapter 4: The Approach 45


46

section and clicked on libraries tab. This provided a list of all the libraries used in
building the project.

Each of our tasks were developed using a number of Java classes and JSP files.
For each task we designed a main JSP file, a request handling method and a
processing class. The main JSP file for each task was responsible for generating the
task interface. Within the source code of this file, we used a JavaScript asynchronous
POST request to pass the user input to the particular handling method. The request
handling method retrieves these inputs and initiates the appropriate processing.

We also had the option of creating Java classes, called Servlets, to do the
request handling. Since every time changes were made to a Java class, it required
manual compiling and restarting of the tomcat server, this approach was considered
inefficient to use. Therefore all of the Java methods and classes designed for our
tasks were in JSP format. However we designed the DatabaseAccess and
DatabaseConnection classes to be normal Java classes. This was important,
especially for the database connection class, as it stored the username and password
of the database. Once this class was compiled and stored on the server, no third party
was able to easily see this information, even if they had access to the server, as the
compiled file was in binary format.

The processing class was designed to process the user inputs and generate the
necessary output. To simplify the processing of the input we broke down this stage
and spread it over a number of classes. Doing it in this way improved the
interoperability and readability of the code and made it easier to debug the code. At
the end of the processing stage, the output was returned back to the handling method.
The handling method used this output and generated the user output. Depending on
the task, we displayed the user output on the map, on the task page or using both
methods. The diagrams in Figure 13 show the structure of the code for each of the
tasks. The Section 5.2 gives more detailed description about the final product of our
tasks and how their algorithms work.

46 Chapter 4: The Approach


47

Locality Classification Trend Display

Classification.jsp
Trend.jsp

HandleCFN.jsp
HandleTrend.jsp

ProcessCFN.jsp
TimeSeries.jsp

HandleXML.jsp Filter.jsp Location.jsp

Data Entry and Update Impact Assessment

Update.jsp ImpactAssess.jsp

LoadData.jsp UpdateValue .jsp HandleIAS.jsp

HandleUpdate.jsp
ProcessIAS.jsp

BarChart.jsp

Figure 13: Task Structure and Overview

Chapter 4: The Approach 47


48

We tested our tasks and the web application on Internet Explorer 8 and Firefox
3.6 browsers. To load the web application in the browser we used to the following
URL: http://localhost:8008/mapguide/rssfTool/ajaxviewerRSSF.jsp. This loaded the main
interface and our tasks. We selected each of the tasks we were working on to test
their functionality. Tasks that did not depend on other MapGuide components were
also tested separately. For example the database update task was accessed in this
way: http://localhost:8008/mapguide/rssfTool/dev_update/update.jsp. This only loaded the task
without other MapGuide layout components.

To monitor the progress and failure of a task, we used Java print statements
(System.out.println()), which specified each of the main steps the task was about to
execute and the content of its main variables. These print statements were surround
with a if(DEBUG) condition. The DEBUG variable used was a final static Boolean
variable, declared in global scope. It allowed us to easily turn off debugging by
setting its value to false. To see these print statements we had to run the Tomcat
server in console mode. To do this we ran the startup.bat file located in the
[MGROOT\WebServerExtensions\Tomcat] bin directory. The console mode also displayed
other standard Java error messages such as database connection errors. Figure 14
shows the output of the Tomcat console after running the locality classification task.

Figure 14: Tomcat Console for Debugging

48 Chapter 4: The Approach


49

To debug JavaScript code execution we used the Developer Tools (Tools


Developer Tools, F12) available in Internet Explorer 8 and the JavaScript error
console (Tools Error Console, Ctrl+Shift+J) available in Firefox 3.6. In case of
errors, we also placed JavaScript alert() messages in the code to verify where the
execution of the code reaches.

4.7 SUMMARY

To start developing the tool we first installed the mapguide package and the
available samples. We then familiarised our self of using the MapGuide technology
with the help of MapGuide documentation and the source code. To apply MapGuide
to our problem, we first obtained, customised and integrated the relevant spatial data.
Then we extended the MapGuide interface to support chart display. Next, we
designed and developed the database to store and retrieve the available data. Finally,
we developed and integrated four tasks to support decision making. The general
structure of these tasks consists of an interface generating JSP file, a request handling
method and a processing class. The resulting web application was tested in Internet
Explorer 8 and Firefox 3.6. To debug Java code of our application we utilised the
tomcat console and for JavaScript we used the embedded debuggers in each of the
browser.

Chapter 4: The Approach 49


Chapter 5: RSSF Tool

The RSSF tool provides easy access and interactive manipulation of data for
rural decision making. The tool handles such capabilities through a number of
custom developed tasks and through the use of the interactive MapGuide AJAX
interface for spatial data manipulation. As described in the previous chapter, the
basic three tier architecture of MapGuide was extended to incorporate other
technologies and custom tasks to fulfil the objectives of the decision support tool.
This chapter discusses the outcome of our development. The final version of this tool
can be accessed from the following web page: http://www.growingregions.org.au/.

5.1 INTERFACE

This tool is intended to be used by non-technical users. Therefore, the interface


of the tool needs to be interactive, easy to use and understand without requiring too
much setting up or configuration. The Ajax viewer of MapGuide provided just the
right solution for this. Ajax technology gives the developer the option to process and
respond to requests without having to submit the page. This means the user can
continue to use the page while the request is being processed and once the processing
has completed, only the necessary part of the page will change. In this way the
MapGuide Ajax interface ensures seamless interactivity and responsiveness.

The interface of our tool is developed based on this Ajax viewer. Figure 15
shows how the final version of our tool looks when it is initially loaded. As
highlighted in Figure 15, the interface consists of four main areas. These are the
legend display, property display, map display and task display areas.

Chapter 5: RSSF Tool 51


52

Legend Display

Task Display

Property
Display Map Display

Figure 15: Finalised Interface of the Tool

To make the interface useful for the context in which it is used and to provide
the user with spatial visual feedback, we have incorporated the appropriate spatial
data. These spatial data belong to the Western and Southern Down regions. The user
can use various tools to navigate around these spatial data. The user can move around
on the map using the pan tool. This tool can be activated by clicking on the hand icon
tool located on the toolbar at the top of map display area. Alternatively, the user can
also use the compass buttons beneath the zoom scale to move around the map. The
user can also zoom in on the map by using the mouse wheel or by clicking on the
scale located at the top right corner of the map display area. Zooming in on the map
reveals more layers and shows more detail. There are three distinct zoom levels
available to the user. These are the region, locality and street/property level. Initially,
the user is presented with a map that shows the regional areas of Queensland. If the
user wishes to see a specific area, for example the property packages for the locality
Chinchilla, then from the initial screen they need to pan on to its region (in this case
the Western Downs region). From here, they need to zoom down to reveal the
localities that belong to that region. Finally they again pan to find the locality
(Chinchilla) and zoom down to reveal the street and property level detail. A portion
of the street level detail for Chinchilla is shown on Figure 16 . The toolbar also

52 Chapter 5: RSSF Tool


53

provides a quick way to zoom to a specific location on the map. This is done using
the Zoom To drop down menu. Clicking on the Zoom To icon reveals to the user
a list of available locations from which to choose. Clicking on one of these locations
centres and scales that location on the map display area. Pre-defined locations can be
added here to make the navigation more efficient.

The interface also allows the user to enable and disable certain features that are
displayed on the map. As shown on Figure 16 this can be done by clicking on the
check box next to the desired layer on the legend display area. For example, when
viewing the street level details, if the user wants to know to which locality the part of
the map that is displayed belongs, they can simply place a check on the Locality
Boundaries layer on the legend display area. This will place an outline of the
locality boundaries on the map.

Figure 16: Street Level Detail for Chinchilla with the Locality Outline

Chapter 5: RSSF Tool 53


54

The interface also allows the user to select certain features of the map. The
default behaviour for selecting a feature is using a single left mouse click on the
desired feature. However, if the user has activated the pan tool this behaviour is
overridden and therefore it needs to be reactivated by clicking on the arrow icon on
the toolbar. When a feature is selected, the data that is used to describe the feature,
such as its name and type, is loaded to the property display areas. The user can also
select multiple features by left clicking with the mouse and dragging (highlighting)
on the map to select an area. The feature selection tool helps to interactively receive
spatially oriented inputs from the user.

5.2 SYSTEM TASKS AND OPERATION

So far the description has focused on the visual, interactive and usability aspect
of the tool. As these aspects focus on the presentation of spatial data to the user, it
can be categorised as the GIS component of the tool. The system tasks that we
developed and integrated are described in this section. These tasks add the decision
support component. With this addition, the tool can be classified as a spatial decision
support system.

We created four tasks to help in the decision making-process. These are the
Localities Classification, Trend Display, Impact Assessment, and Data Entry and
Update. Table 3 gives a brief description of each of these tasks. These tasks are
structured using a number of classes and methods.

54 Chapter 5: RSSF Tool


55

Task Function
Localities The user is able to select certain indicators such as
Classification population, employment or number of housing and to classify
them in terms of political/administrative or regional divisions
in order to discover performance differences.
Data Trend Display The user is able to select political/administrative divisions
and to view trends associated with core indicators such as
population and employment, based on past data.
Impact Assessment The impact assessment task helps the user to view the
changes to services when certain core-indicator values are
modified.
Data Entry and Update The user can directly access the data in the database to
modify and update, with the ability to view multiple
combinations of records. Also they have the ability to add
new core indicators to the database.

Table 3: System Tasks and Functionality

5.2.1 LOCALITY CLASSIFICATION

The aim of this task is to provide the user with a means to generate thematic
maps interactively. Thematic mapping is defined as the ability of a GIS to filter data
and to selectively display it using different colours, styles or symbols (Caldeweyher
et al., 2006). This task is important in categorising and viewing certain indicators
such as population, employment and number of hospitals, in terms of
political/administrative or regional divisions, in order to easily discriminate between
them. This particular implementation aims to categorise different localities in terms
of the chosen indicator and according to a given threshold value. For example, the
number of hospital beds per thousand people and the corresponding standard that is
specified by government policy. Performing such classification enables the user to
easily visualise which localities within a Local Government Area fall above or below
a certain standard.

Chapter 5: RSSF Tool 55


56

For this task to work a number of structural components are required. First, the
user needs to provide the necessary information through the client tier. The source
code for this task is documented in Appendix A. This task is populated in the task
pane area. As shown in Figure 17, the user specifies the region to be classified by
dragging with the mouse on the map or by holding the Ctrl key and clicking on
multiple individual localities. Then the user can load the task from the task drop
down list located at the top of the task pane. This will load the task and display to the

Figure 17: Locality Feature Selection as Input

user the selected regions. Alongside this the user can choose the indicator of interest
using the drop down box provided. Beneath this the user specifies the threshold for
the selected indicator. Finally, clicking on the classify button sends this information
to the web tier.

The task processes the inputs and generates a colour coded layer based on the
processing. This is shown on Figure 18. The task resets the scale of the map so that
all the localities that are classified are in range. The task also generates and displays
a table describing the regions that were selected, along with the data and the year of
the data that was used in the processing.

56 Chapter 5: RSSF Tool


57

Figure 18: Final Output of the Task

Chapter 5: RSSF Tool 57


58

5.2.2 TREND DISPLAY

The aim of this task is to show the user


how the core-indicator data varies over a
period of years. Like all the other tasks, this
task is also selected from the task menu and
populated on the task pane that is located on
the right of the screen. This task allows the
user to plot time series charts for any year and
for any dataset that is available in the
database.

As shown in Figure 19, the core-


indicators are populated under
Environmental, Social and Economic
categories. These are displayed to the user
with three HTML select boxes. Before
loading this task the user can select a location
from the map so that the core indicators for
that location can be automatically populated Figure 19: Trend Display Interface
into the select boxes when the task loads. Once
the task has loaded, the user can also choose different regions, which will instantly
update the content of the categories. The user can select any combination of these
core indicators along with the time range (in years) to be plotted. Once the necessary
selections have been made, the user can submit the request by pressing the Plot
Trend button. This request is then received by the HandleTrend Java class. It
generates an SQL statement, using each of the years and core indicators specified in
the request, and retrieves the data from the database. The result of this query is stored
in a ResultSet object within the HandleTrend class.

The chart is generated as a PNG file and saved on the server. It is displayed to
the user as described previously in section 4.4.2. Initially we generated the lines on
the chart using single continuous lines. This became a problem when distinguishing
between years that had data, from years with no data, as a continuous line can be
drawn through a number of years hiding the years that have no data. This can make
the user come to the wrong conclusion that there is some steady growth over a

58 Chapter 5: RSSF Tool


59

certain period of years, when in fact the chart only shows the data for the beginning
and end years. To avoid this ambiguity, we chose to place symbols for each of the
data points in the chart. Figure 20 below shows one particular time series chart that is
generated using this task. It compares the total government students, total non-
government students and the total students for Stanthorpe between the years 2002
and 2008.

Figure 20: Final Output of the Task for One Particular Selection

5.2.3 IMPACT ASSESSMENT

The aim of this task is to show the user how the changes in one core indicator
dataset affect main services. The prediction of how the dataset will change needs to
be based on a statistical model. The limited availability of data and the complexity of
the problem have made it difficult to incorporate such modelling capability in time.
However, the research conducted by the economic division of this project has
managed to produce a possible model that could be incorporated in to this tool. It is
described in the paper: Forecasting Population Changes and Service Requirements
in the Regions: A Study of Two Regional Councils in Queensland, Australia
(Athukorala et al.)

In this version of the tool however, we only address the visual aspect and the
web tier logic in executing the impact assessment task. Visually we present the
outcome using side-by-side bar graphs which display the current value of the datasets

Chapter 5: RSSF Tool 59


60

and their predicted change. Due to the lack of data availability we restrict the
changes to be displayed only for the widely available datasets. These are the
Population, Number of Hospitals beds and Number of Police. This task helps to
demonstrate the capability of the tool to integrate a model alone with the available
data and user interface. In subsequent versions of the tool, the proper statistical
models can be incorporated, as further described in the implementation section 5.3.3,
to improve the tool.

For this to work, the user must first select a locality by clicking on the
appropriate feature on the map and then loading the impact assessment task from the
task list, which will populate it on the task pane. The interface of the task gives the
user a systematic approach in selecting the necessary dataset. First, the user selects
the category of the dataset from environmental, economic or social categories. This
is presented to the user as three radio buttons. Selecting this populates the themes and
issues belonging to that category from the database into two drop down boxes (these
drop-down boxes are placed beneath the category selection buttons).

Second, changing the theme will make the issue values update according to the
selected theme. Third, once the user has selected a particular issue they can then
choose a dataset that belongs to that issue. Selecting the dataset and clicking apply
loads the controls to specify the necessary changes in that dataset. For example, say
the user selected the farm as the dataset, and then the user can specify the number of
farms they would like to increase. The user then selects from the three output
categories: peri-urban development, land and water, and labour resources to see the
effects of the changes. When the user submits the request, the number specifying
their change along with the output category is passed to the web tier. Figure 21
shows the interface for this task. The output chart is shown in Figure 22.

60 Chapter 5: RSSF Tool


61

Figure 21: Interface for Impact Assessment Task

Chapter 5: RSSF Tool 61


62

Figure 22: Visualising Changes with Bar Charts

5.2.4 DATA UPDATE

One of the most important


resources to this project is data. At the
moment the availability of data is
limited. The aim of this task is to help
the user gather new data and to keep
the current data accurate. Also as more
relevant data is gathered it makes it
possible to create better statistical and
analytical models which could be used
to improve and add more decision
support capabilities.

Using this task the user can view


and modify all the data that is available
in the database. As shown in Figure
23, the interface displays the year,
region and core indicator for the user to Figure 23: Interface for the Update Data Task

choose from. Alongside the core indicator is the measurement, which is displayed so
the user is able to identify what kind of data is stored in a particular core indicator.
The regions, core indicator and measurement are displayed using expanded select

62 Chapter 5: RSSF Tool


63

boxes. This is so that the user can quickly see their content without having to scroll
too much.

When the task is initially loaded from the task list, it displays the data for the
current year. The user can select a new year by clicking on the drop down list. The
years displayed here are loaded directly from the database after retrieving the unique
values. When the user selects a new year, the page reloads again to update the select
boxes. The user can change the region to load core-indicator data belonging to that
region.

Beneath the core indicators and measurement select boxes is a text box that
specifies the value of the selected core indicator. This value is also loaded in a
similar fashion as described previously. It is updated as the user clicks on different
core indicators. The user can update a core-indicator value specified here, by
overwriting the current value with a new one and clicking on the update button
located next to it. When the user clicks on the update button it forms a request to
send all the currently selected items in the user interface such as the year, region
name, and core indicator together with the newly entered core indicator value to the
UpdateValue Java class. This class then forms the necessary update SQL statement
and saves the entered data to our MySQL database.

This task also provides a way for the user to view multiple core-indicator and
region data in a table format. To use this, the user needs to specify the necessary core
indicators and the regions for a given year. This is done by double clicking on each
core indicator and region of interest that is available in the select boxes. As shown in
Figure 24, the double clicked items are placed in the empty select boxes located at
the bottom of the task window. The user can also click and drag on the core
indicators in the select box to select multiple items. Multiple selections can be loaded
into the empty select box by clicking the Get Selected Items button located beneath
the empty select boxes. Once the required items are displayed in the core indicators
and the regions select boxes, the user can then click Load Table button to display
this data in table format.

Chapter 5: RSSF Tool 63


64

Figure 24: Items Placed in the Empty Select Boxes

Figure 25: Table Format of Data

In this new popup window, underneath the generated table is a button that can
be clicked on to update the database with the data in the table cells. The user can
choose to modify any of the cells, or leave them as is, and then click the update
button. This saves the data in to the database.

Using this table generation method the user can quickly update multiple sets of
values more intuitively. In addition to this, it also provides an easy way to visualise
and compare different regions for a given set of core indicators.

64 Chapter 5: RSSF Tool


65

5.2.5 DECISION SUPPORT

These system tasks work together in combination to support decision making.


The user can utilise these tasks in the following manner. First the user zooms to the
Local Government Area of interest and selects a set of regions. Then the user
performs a locality classification against a particular core indicator, to distinguish
from the selected regions, which are above or below a certain standard.
Subsequently, the user performs a trend analysis to see how this particular core
indicator, for that locality, has performed in the past and what its future trend looks
like. Based on this trend, the user determines an estimate for the core indicator to
compensate for any negative effects. Lastly, the user loads up the impact assessment
task, for the concerning locality, and enters the new estimate to analyse and visualise
what changes it will bring about.

5.3 TASK IMPLEMENTATION

This section gives technical description of the implementation of each task. As


specified before, the RSSF tool uses a number of classes to perform its operations.
These classes are created using Java/JSP. Table 4 provides the task source files and
their purpose, for each task.

Task Source Files Purpose


Classification Web Interface generation
HandleCFN Handle server request
ProcessCFN Specifies the algorithm for this task
Locality Classification
Location Create location objects
Filter Retrieve layer resource and apply filter
HandleXML XML processing
Trend Display Trend Web Interface generation
HandleTrend Handle and process server request
TimeSeries Generate time series charts
Impact Assessment ImpactAssess Generate web interface and load data
HandleIAS Handle server request
ProcessIAS Process data and modelling
BarChart Generate bar charts
Data Entry and Update Update Generate web interface and load data
LoadData Initial load of all data
UpdateValue Update individual core indicators
HandleUpdate Generate and update tables

Table 4: Tasks and Source Files

Chapter 5: RSSF Tool 65


66

5.3.1 CLASSIFICATION

For this task we created two Java classes, HandleCFN and ProcessCFN, to
perform its operation. This task is designed so that the user can specify locality
selection by selecting them on the map.

When the user submits the request to perform the task, the HandleCFN class
initialises a location object for each selected locality in the map and stores in it the
locality name and the feature ID. Feature ID is a unique ID given to a spatial feature
in a certain spatial feature set. This is similar to a primary key of a relational database
table. The initialised location objects are stored in an array list called the featureList.
HandleCFN then creates an instance of the object ProcessCFN and passes it the user
selected featureList, indicator names, and threshold value along with the MapGuide
session ID (MgSeesionId) and the MapGuide map name (MgMapName). The
ProcessCFN class is responsible for most of the logic implemented in this task.
Before going into detail it is important to understand how MapGuide stores features
in its library and how to dynamically modify this for a particular purpose.

MapGuide stores feature definitions as XML Documents. These XML


documents are standardised using a schema depending on the particular resource. All
of the tags that are used for customising layers are specified in the
layerDefinition.1.1.xsd schema. Based on this schema, MapGuide creates a separate
XML document for each of the layers that are used in the map package. This is the
XML document that is created and edited when using MapGuide Maestro for map
authoring. The spatial data that is connected to each of these layers is then rendered
into an image in the clients user interface according to the customisations specified
in each of the XML definitions. Specified in the LayerDefinition XML schema is the
VectorScaleRange tag; all of the visual customisations that are applied to spatial
features are specified under this tag. Using multiple different VectorScaleRange tags
with different MaxScale and MinScale values we could specify different
customisations to different zoom levels. Examples of possible customisations are
area colour, border thickness and transparency.

The actual visual customisation is specified under the AreaRule tag, which is a
child of the VectorScaleRange tag. The AreaRule tag itself, consists of a number of
child tags, such as the Filter, ForegroundColor, BackgroundColor, FontName and
BackgroundStyle, all of which can be used to customise a particular layer. Out of all

66 Chapter 5: RSSF Tool


67

the child tags under AreaRule tag, the one of most interest to us is the Filter tag. This
tag can be used to specify expressions that can be used to filter certain data from the
spatial dataset. We can use this tag to filter and group different features that belong
to a certain classification according to our calculations. To perform the filtering we
simply list the IDs of the desired features separated with an OR statement inside the
filter tag. This makes the customisations specified, under one particular declaration
of the AreaRule tag (in that XML resource), apply only to those features that are
listed in the filter tag. By having multiple AreaRule tag declarations, with different
feature IDs in the filter tag, we are able to have multiple different categories of
classification.

We designed a separate Java class to obtain the desired XML resource, modify
it and to store it back on to the server tier. This class is called the Filter. To abstract
the handling of the XML documents, we also created a separate class called
HandleXML(). Both of these classes are initialised in the ProcessCFN class, as this is
where the algorithm for this task is implemented.

Processing the Request


The ProcessCFN class has eight methods. It starts off by initialising the
database connection and database access objects. The constructor of the class stores
the feature list, Indicator name, Threshold, MapGuide Session ID and the MapGuide
map name, passed from the HandleCFN, in the state variables of the class. Then it
calls the run method which executes the genColorMap(), getData() and setFilter()
methods respectively.

The genColorMap() method simply creates a Java map of the colours that will
be used in the classification. It uses the English name of the colour as the key and the
hexadecimal colour code as the value of the Java map. This allows more intuitive
referral of the colours throughout our program. The getData() method, creates an
SQL statement using the feature names and the dataset name, to fetch the necessary
data from the database. This statement is then executed using the database access
object which returns the result set of the query. This result set is then iterated and the
corresponding data stored in the appropriate location objects.

Chapter 5: RSSF Tool 67


68

LocationSet Array

No Data Less Than Greater Than Equal To

The size of
these depend on
how many Locality 1 Locality 3 Locality 6 Locality 5
localities
Locality 4 Locality 7 Locality 8 Locality 3
belong to each
of the . . ..
categories ..
. . .
.
. .

Location object array lists (one for each category)

Figure 26: Data Structure for Locality Classification

setFilter() method is where most of the processing happens. First it categorises


the locations based on the provided threshold and the data from the database. To do
this, it creates a Java array list called locationSet, with its size equal to the number of
possible categories that can exist. In this case, there are four possible categories: No
Data, Less than, Greater than or Equal To. Then it initialises each of these elements
of the array list to an array list of Locations. The resulting data structure can be
visualised as depicted in Figure 26. This locationSet array list is then passed to the
processLocations() method. This method compares each of the dataset values that
were stored in the location object against the supplied threshold. It then gives these
locations an appropriate colour, based on the comparison result, and categorically
stores it in the locationSet array list.

Next step in the setFilter() method is to initialise the Filter object, passing it
the MapGuide session ID, Map Name and the resource name. The resource name is
the name and location of the XML document that we are interested in modifying. In
this case we are classifying localities which are the features in the Localities
Boundary layer. Therefore the fully qualified resource name is
Library://DLB_SD/Layers/Locality_Boundaries.LayerDefinition. The Filter object uses the

MapGuideJavaAPI to access the current session of the map and fetches the
LayerDefinition XML where the user had made their selection. ProcessCFN, The
class that initialised the Filter, can retrieve this XML document by calling the
getLayerXML() method of the Filter object.

68 Chapter 5: RSSF Tool


69

XML Processing
All XML parsing, modifying and building operations are performed by the
HandleXML object. What we are interested in modifying are the child elements
under the AreaRule tag of the layer definition XML. We need to create multiple of
these tags, one for each category. Therefore we created a separate template file called
arearule.templ with just the AreaRule tag and its content. As shown in Figure 27, in
the arearule.templ file, under the Filter and ForegroundColor child tags, we place a
%s symbol to indicate that the values for these will be populated by our code, at
runtime, to create a unique category for each of the deferring classes of localities.

Figure 27: Area Rule Tag Template

The HandleXML object, parses the LayerDefinition XML for the locality layer
and retrieves the VectorScaleRange tag that contains the appropriate scale range
(between 9 and 45) we are interested in modifying. Once a string copy of the
arearule.templ file is updated with the appropriate values, it can be sent to the
updateXML() method of HandleXML. This method will then build that string into an
XML tag and attach it under the previously retrieved VectorScaleRange.

After initialising the HandleXML object, ProcessCFN then retrieves a string


copy of the arearule.temple to update it. This update is performed using its
createFilter() method. This method, loops through all of the locations in the
locationSet by going through each of the four categories. When going through one
category it will retrieve the colour and the feature IDs for that category. The colour

Chapter 5: RSSF Tool 69


70

information needs to be retrieved only once from an object in a category as it will be


the same for all objects in the same category. However the feature IDs need to be
collected from each of the objects as they are unique to each location. The retrieved
values are stored in a string. Multiple feature IDs are stored in a string with a comma
separating each one. These values are then substituted under the appropriate tags in
one particular copy of the arearule.templ. The updated string copy of the
arearule.templ is passed to the updateXML() method which builds it into an XML
tag and attaches it to the VectorScaleRange tag as described previously. Similar
processing is performed for the remaining categories in the locationSet array list. At
the end of this processing, a fully modified XML definition for the new thematic
layer is generated in the HandleXML object.

The ProcessCFN then retrieves the modified layer XML using the
getModLayer() method and passes it to the setLayer() method of the Filter object.
This method creates a new layer from the given XML definition, creates a category
called classification in which to place the new layer and appends all these updates to
the runtime library of the map.

70 Chapter 5: RSSF Tool


71

5.3.2 TREND DISPLAY

In this task, the chart generation is handled by our TimeSeriesChart Java class.
The HandleTrend class initialises TimeSeriesChart and passes a ResultSet object as a
parameter. This ResultSet object consists of the data for the user selected items in the
interface. These data are retrieved from the database. The TimeSeriesChart utilises
the Java JFreeChart API to generate charts. To generate time series charts, our
TimeSeriesChart class requires a TimeSeriesCollection dataset. A
TimeSeriesCollection dataset is a data structure that is specified in the JFreeChart
API.

To initialise the TimeSeriesCollection dataset, the TimeSeriesChart uses the


ResultSet object that was passed to it. The TimeSeriesChart iterates through the
ResultSet object and creates a TimeSeries object for each of the selected core
indicators. A TimeSeries object consists of a core indicator name along with the
selected years and their data values. Therefore, one particular TimeSeries object
essentially forms one series in the chart. During the ResultSet object iteration, the
TimeSeriesChart retrieves the years and data values that belong to the selected core-
indicators and adds these to the correct TimeSeries object. All these TimeSeries
objects are added to a Java ArrayList called listOfSeries. After completing the
iteration through the ResultSet, TimeSeriesChart has placed all the data into the
appropriate TimeSeries object for each of the core indicators. These TimeSeries
objects now consist of all the years and data values that belong to the respective core
indicator.

To further illustrate this, we can take the scenario where the user selects the
following three core indicators: Total government students, total non-government
students and total students for Stanthorpe locality between the years 2002 and 2008.
In this case, our listOfSeries Java ArrayList, would consist of three elements for each
of the three core indicators. Within these elements are the TimeSeries objects for
those core indicators. And each of these TimeSeries objects would consist of the
corresponding core-indicator data from the year 2002 to 2008.

Finally, TimeSeriesChart iterates through the Java list (listOfSeries) and adds
each of the available TimeSeries objects to the TimeSeriesCollection dataset. This is
done by calling the method addSeries() in TimeSeriesCollection class. This dataset is
then used in the createChart() method to form the time series chart.

Chapter 5: RSSF Tool 71


72

5.3.3 IMPACT ASSESSMENT

As for other tasks, the handle class (HandleIAS) of this task retrieve the inputs
from the client tire (interface). It initialises an instance of the ProcessIAS class and
feeds the input to it. The ProcessIAS class initialises variables locationName,
datasetName and incrementValue. These variables are initialised to the parameters
from the interface. It then calls the getCurrentData() method which creates an SQL
statement based on the location name and the datasets that would be affected by the
user-selected dataset. As mentioned before we want to look for the changes in the
datasets of Population, Number of Hospitals and Number of Police. Once the
DatabaseAccess object has completed the query, its result is stored within
ProcessIAS. This ends the execution of the getCurrentData() method.

Next the ProcessIAS object calls the modelScenario() method. Within this
method the appropriate calculation and analysis, to accurately predict the changes, is
designed to take place. Once the appropriate model is developed, it can be
incorporated to the modelScenario() method. This model may be developed as a Java
class, in which case it would be initialised within this method and executed to receive
the result. If the model requires the execution of an external application such as an
advanced statistical package, we would need to have this installed in our server. We
could use the Java Runtime.exec() to execute this application within our
modelScenario() method. Then we could have the output of this program saved to a
file on the server and then read from our method to be used in further processing.
Since we dont have access to a sophisticated model that can be used for this
purpose, for this version of the task we simply linearly increase the current value
based on the specified change. Once the new data is obtained it is stored alongside
the current data in a Java Map variable.

Chart Generation
After completing the modelling part, the ProcessIAS object then calls the
generateChart() method. Here we use a separate class, called BarChart to perform
the chart generations. This chart generation class utilises the open source JFreeChart
Java library. It is designed to be able to initialise side-by-side or single bar charts. In
this case we are interested in the side-by-side bar charts. The generation of a side-by-
side bar chart occurs when the BarChart class is passed two, as opposed to one, Java
Maps as parameters. The class has the capability to create the appropriate chart and

72 Chapter 5: RSSF Tool


73

save it as a PNG image on the server. Once ProcessIAS completes its execution, it
returns control back to HandleIAS. This is where the code necessary to display the
chart is generated and passed to the client tier.

5.3.4 DATA ENTRY AND UPDATE

This task is design to dynamically retrieve data upon user selection. The task
uses AJAX to handle this sort of data retrieval. The loadData() JavaScript function
initiate the AJAX request. This function takes the currently selected item in the
interface and the type of data to load as input parameters. It is attached to all
necessary HTML elements using their onChange and onClick properties. The
function is designed so that the input type can specify either a name of an indicator
or its value. For example, the user may specify to retrieve all the core-indicators
given a particular region or the value of a particular core- indicator and the region.
The type is setup as a string variable that could take the form of either ind or
val. When the user changes the name of the region it is the indicator name that
needs to be loaded therefore the loadData() function calls the loadIndicator()
function. This function sets up the parameters: region name, year and data type, to
retrieve a list of core indicators. Then using an AJAX request it passes these
parameters to the LoadData Java class.

The LoadData class retrieves these parameters and forms an SQL statement
and executes this statement over the DatabaseAccess object to retrieve a list of core
indicators and their measurements. Each of the core indicators that are retrieved for a
particular year and region are combined into a string with a , character separating
each individual name. The corresponding measurements are also combined into a
separate string in a similar way and the two are separated by a | character. The
finalised string is then set as the response output of the LoadData class. Once the
request is completed the control is then returned back to loadData() JavaScript
function that initialised the request. This function then invokes the call back method
getIndicator(). In this function the obtained response string is split by the |
character and by the , character to create two arrays of core indicators and
measurement names. These are then used to update the core indicators and
measurement select boxes in the interface.

Chapter 5: RSSF Tool 73


74

Table Format
When the user makes this request, the values in the select boxes are submitted
as a form using the post method to the HandleUpdate Java class. This class can
handle two kinds of requests. The initial request is to use the items from the select
boxes to generate a table. The class uses two if statements to check which parameters
are available and then choose the appropriate request to perform.

To perform the table generation request, first we use the submitted core
indicators, regions and year values to form an SQL statement to retrieve the data
from the database. Once this data has been retrieved it is stored in a Java SQL
ResultSet object. We then loop through this ResultSet object to form the table. To aid
in forming this table, we use a two-dimensional array called table[][]. The number of
rows and columns in this array is determined by the number of core indicators and
regions in the ResultSet object. The retrieved ResultSet consists of three columns: the
region, core indicator and value. The objective is to translate this ResultSet into a
table format on to the two-dimensional array. We do this as we loop through the
ResultSet. This table will have one column for core indicator and one row for each
region. Therefore, for each row of the ResultSet, we check to see if the region has
changed. If so, we increment the row value of the table[][] two-dimensional array. If
when iterating through the ResultSet, the current row has the same region name as
the previous, then we store the corresponding core-indicator value in the column
position of the table array. The values in this array are stored as a HTML statement.
That is, using an input text box with its default value set to the actual data value. This
input text box represent a cell in the table. As our table cell is represented by an input
text box, the values in it can be modified and when the table is submitted it can
therefore be used to update the database. To facilitate this, we give the input text box
a name to uniquely identify it. It is important that this name corresponds to the order
in which the specified cells are created. Therefore the name is set to be a decimal
number that is incremented each time a cell is created. Once the ResultSet is
completely transformed into a table, the table[][] array is then written out to a new
popup window.

This will again call HandleUpdate which this time will execute the code for
updating the database with the values in the table. This request also occurs as a form
post operation as the table is designed to be part of a form. The cells of the table are

74 Chapter 5: RSSF Tool


75

essentially text input fields. To update the data using the text field values we first
need to retrieve a ResultSet from the database restricted to the regions and
coreindicators in the table. This ResultSet will be a subset of the core-indicators table
in the database. When we have a ResultSet from just one table, JDBC allows us to
update the values of the actual table by updating the value of the ResultSet object.

Chapter 5: RSSF Tool 75


76

5.4 SUMMARY

The system design consists of database, interface and application logic. The
database of the system is developed using MySQL. The interface of the tool is based
on MapGuide AJAX viewer. It is modified and extended for this particular case with
the help of MapGuide Maestro. This interface of the tool has good interactive
capabilities and behaviour similar to that of a desktop application. This makes it
intuitive to the user and therefore easy to use and understand. The application logic
of the system implements four tasks: Localities Classification, Trend Display, Impact
Assessment, and Data Entry and Update. The Localities Classification feature
enables the user to choose or filter required characteristics for a particular locality or
area. The Data Trend Display features help in visualising and displaying trends
based on past data. The Impact Assessment task helps the use to visualise how a
change in one core indicator can affect other main services, whilst the Data Entry and
Update task assists in accessing the database to make required modifications and
changes.

76 Chapter 5: RSSF Tool


Chapter 6: Discussion and Conclusions

In this research we focused on developing an online geographic information


system tool to support rural decision making. Initial research in the literature
revealed the advantages of a web-based tool and the relative lack of sophisticated
interactive capabilities of similar web-based tools in the past. Using knowledge
available in the literature about spatial decision support systems and newer web
enabled technologies that have emerged in this area; we were able to successfully
develop a decision support tool for the Queensland rural context. The developed tool
focuses on Western and Southern Downs regions of Queensland and it fulfils the
three aims of our research. It has an interactive, spatially-integrated, web-based user
interface that supports sustainable decision making; has a functioning database
backend with facilities for data retrieval, modification and addition; it ensures the
capability to make future extensions and to integrate analytical and statistical models.

The tool is developed as a web-based system to provide easy dissemination and


quick maintenance capabilities and to minimise compatibility problems that are
common in desktop-based programs. The interface of the tool is design to provide as
much interactivity and usability as possible. It uses MapGuide Open Source to
provide basic interface, map serving and rendering facilities. To connect to spatial
data and to modify and extend the existing MapGuide Ajax interface, we used the
MapGuide Maestro desktop application. Although it is a very useful application, as it
did not have a full set of documentation available we found it bit too difficult to get
started at the beginning of the project.

One thing to understand about MapGuide Maestro, that makes it easier to use,
is the fact that it is basically an intuitive graphical front end to edit all XML
resources. It provides various graphical components to easily specify configurations
for a given resource that is needed by the web application. All these configurations
are ultimately saved to an XML file. Maestro can also be used to view these resource
files directly in a text-based XML format. This is important as it helps to make batch
processing tasks much quicker. For example, when duplicating features in a
particular layer resource, we can simply copy the necessary XML segment and paste

Chapter 6: Discussion and Conclusions 77


78

it where necessary instead of having to follow all the steps in the graphical interface
to reconstruct it. One thing to beware of, when creating feature sources with
MapGuide Maestro and Shapefile format, is to make sure that we include all the
files that come with it. This includes the .shp file along with .shx, .dbf, .sbx,
.sbn and .prj files. These files are needed to set the metadata and correct
coordinate systems. It is also important that we specified the correct coordinate
system for all the feature sources in MapGuide Maestro, in order to get the correct
map scale and to enable advanced spatial analysis such as distance measuring and
buffer creation. Another problem with Maestros limited availability of good
documentation is that it makes it difficult to know about all FDO capabilities to build
expressions. These expressions are needed to specify different formatting on spatial
data, such as different colours for property parcels and appearance of the labels on
the map. Some of the FDO capabilities include the ability to perform comparisons,
conversions between strings and integers, and concatenation. A complete list of FDO
capabilities for each provider can be obtained from the MapGuide server that was
installed. To retrieve this, we need to browse to the mapagent page of the MapGuide
server. Assuming the server is on local host, this would be:
http://localhost:8008/mapguide/mapagent/. From this page, we choose Features under

Server API and then click on getCapabilities which returns a HTML form. In this
form, we need to make sure that the provider field specifies the provider that we
are interested in, for our case this is OSGeo.SHP. After submitting the form, the
server returns an XML document. This document, under each of the function
definition tags, gives a description about all the supported capabilities and their
inputs and outputs.

6.1 OUTCOMES AND FUTURE WORK

The final version of our tool implements four tasks to support the decision-
making process. These are the Localities Classification, Impact Assessment, Data
Trend Display and Data Entry and Update. These tasks help to automate
cumbersome and laborious data processing and analytical operations and provide
visual feedback to the user. This help to support quick, accurate and well informed
decision-making.

78 Chapter 6: Discussion and Conclusions


79

The localities classification task provides the user with a way to interactively
generate thematic maps. Generation of such thematic maps for a region is a
convenient way to identify localities that are performing poorly. The task uses the
most recent data available in the developed database, which means any changes are
immediately reflected in the output. Currently the task only allows the user to specify
a single limit for comparison. One way to improve this is to give the user the ability
to input a range of limits and generate the appropriate thematic output. This task
provides a good demonstration of the capability of MapGuide Open Source in
interacting and processing spatial data.

The impact assessment task is developed to incorporate a model that can be


used to predict how a change in a particular dataset affects population and services.
The task, at the moment, only focuses on the visual and logical aspects of getting
user input and displaying it. To operate the task, the user selects a locality, a dataset
and enters the appropriate change for a particular dataset. The results of the predicted
changes are displayed to the user using back-to-back bar graphs, which show the
current and predicted results. This visualisation of results can be improved by
implementing a mechanism to display the changes on the map itself, for instance, as
an increase in the boundary of a particular parcel to show an increase in land use.

The Trend Display task gives the user a way to visualise changes in a specific
dataset over a period of time. The user selects a location on the map, loads the task,
selects the time range in years and selects what dataset to plot. As well as plotting the
trend for a single dataset, the task has the capability to plot multiple datasets. This
allows the user to compare interdependent datasets in terms of how they performed
over a particular time period. One limitation in this task is that when comparing
multiple datasets, the user cannot select datasets with different measurements. For
example data stored as a percentage compared with value-based data. This can be
solved by making sure that the data collection and recording process adheres to one
particular format. Also we need to be cautious when comparing different datasets
with a large gap between their values, which can make the graph scale stretch too
much, and therefore unable to display an apparent trend. One way to solve this would
be to apply normalisation do the two datasets (such as logarithmic normalisation)
before it is plotted. Another way would be to have stacked charts with different
scales.

Chapter 6: Discussion and Conclusions 79


80

The Data Update task provides the user with a way to add, update and visualise
all the data available in the database. This task is anticipated to be used by
responsible council personal who has knowledge about the datasets that is needed for
their decision making. Currently there is a significant gap in the availability of data
for the Western and Southern Downs regions. This task ensures that the data is
collected and recorded in one place and that all decision makers can easily gain
access to it.

The developed tool also allows easy extension capability. It was developed
using an object-oriented paradigm, which means that the existing classes can be
easily modified and reused to achieve the desired changes. It uses Java for server-
side development and therefore any existing Java-based statistical models can be
easily embedded to increase the tools analytical capabilities. Also the open source
nature of all the components used makes it possible to create changes to the core
functionality of the tool. Currently the tool is limited to the Western and Southern
Downs regions, but by incorporating more relevant data it can be easily extended to
other rural regions. Further, specific research needs to be carried out to develop
sophisticated modelling capabilities to this tool.

One important thing to make sure of when developing this kind of tool is that
the interactivity does not come at the cost of performance. As a result, the developer
may need to compromise on some interactive features. For example, in the case of
map interaction, instead of having continuous zooming of the map it can be set to
have predefined zoom levels, so that the user can quickly get to the point. Another
thing to beware of when developing for high interactivity is the accessibility
concerns. For this tool to function it requires the use of both the mouse and the
keyboard. Also it uses a lot of JavaScript to perform background requests and other
dynamic tasks to convey a seamless interaction. These JavaScript interactions depend
on the users willingness to have it enabled on their browser. Therefore, if the tool is
ultimately used by a government body for greater public service, a separate version
with some sacrificing of interactive capabilities may need to be developed to comply
with accessibility policies. Also this tool uses a lot of vector-based spatial data which
needs to be processed by the server. The way the server initialises and handles this
can create delays in the initial load of the tool.

80 Chapter 6: Discussion and Conclusions


81

The Australian government introduced, National Broadband Network (NBN) is


a valuable resource towards the success of this tools. Once implemented, the NBN
will provide high speed fibre optic internet connection, for up to 93% of Australian
residents and corporations, with the remainder cover by a high speed wireless
network (Australian Government: The Department of Broadband Communications
and the Digital Economy, 2011). As a result, the NBN will play a vital role in
making this tool more accessible, to remotely located local council planners and
policy makers. The faster and wide spread availability of internet, through the NBN,
will make the public aspect of the tool readily and easily accessible to many rural
communities. Also it will provide more incentive to carry out further research into
online decision support tools.

The RSSF tool together with its four tasks, combines and brings together
information which otherwise would be dispersed. This makes the decision-making
process much easier for the decision maker as they can access all the information
they need from one place. Not only this, it helps to refine, update and keep accurate
the information that is available, as decision makers gather around a single hub of
information. One of the difficulties in making planning decisions is due to the lack
of data. Data collection and entry is a time-consuming task. The lack of data is also a
big limitation to this tool. Usually it is the decision maker who knows what problems
need to be solved and what data can be used for this. The availability of a tool that
amalgamates all known datasets and presents them to the decision maker, helps to
identify any gaps in the data so that timely procedures can be put in place to fill these
gaps. In addition to this, through this research we have discovered open source and
new technologies that can be used for spatial decision support purposes. Using these
technologies we have implanted a system that can be used in decision support and
have demonstrated the capabilities of our selected technologies.

As mentioned previously, it is important going forward that our policy makers


have the capability to promote a sustainable development approach. It is important to
make sure that the economic development does not compromise heavily on the
environmental and social aspects. The policy maker must ensure that their
development decisions are maintained in balance across economic, environmental
and social aspects. To justify these decisions and to ensure their progress it is
important to have the proper planning, monitoring and reporting tools. Therefore, we

Chapter 6: Discussion and Conclusions 81


82

believe that the development and release of the RSSF tool is a step in the right
direction to making a positive impact in promoting sustainable development in rural
Queensland.

82 Chapter 6: Discussion and Conclusions


Bibliography

AIHW (2008). Rural, regional and remote health: Indicators of health status and
determinants of health. Canberra ACT: Australian Institute of Health and Welfare.

Athukorala, W., Wilson, C., Neelawela, P., Miller, E., Sahama, T., Grace, P., et al.
Forecasting Population Changes and Service Requirements in the Regions: A Study
of Two Regional Councils in Queensland, Australia. Economic Analysis and Policy
(EAP), 40(3), 327-349.

Australian Government: The Department of Broadband Communications and the


Digital Economy (2011). What is the National Broadband Network? Retrieved May
2, 2011, from http://www.nbn.gov.au/content/what-national-broadband-network

Baker, S. (2006). Sustainable Development. Abingdon: Routledge.

Bell, M., Dean, C., & Blake, M. (2000). Forecasting the pattern of urban growth with
PUP: a Web-based model interfaced with GIS and 3D animation. Computers,
Environment and Urban Systems, 24(6), 559-581.

Belussi, A. (2007). Spatial data on the Web : modeling and management. Berlin:
Springer.

Bhalla, S., Hosozawa, T., Sasaki, H., Watanabe, K., Yatsunami, T., Berthouze, N., et
al. (2002). A user interface for a Web-geographic information system (Web-GIS).
Paper presented at the Proceedings of the 6th World Multiconference on Systemics,
Cybernetics and Informatics. Orlando, FL, USA: Int. Inst. Inf. & Syst.

Caldeweyher, D., Jinglan, Z., & Pham, B. (2006). OpenCIS-open source GIS-based
Web community information system. International Journal of Geographical
Information Science, 20(8), 885-898.

Chavarriaga, E., & Macias, J. A. (2009). A model-driven approach to building


modern Semantic Web-Based User Interfaces. Advances in Engineering Software,
40(12), 1329-1334.

Convention on Biological Diversity (2011). Impact Assessment. Retrieved June 9,


2011, from http://www.cbd.int/impact/

Cowen, D. J., Cundall, A. J., Helmunn, P. W., & Richers, D. (1996). Maintaining
metadata through a common Web and GIS interface. In (pp. 1063-1070). Bethesda,
MD, USA: American Society for Photogrammetry and Remote Sensing.

Densham, P. J., & Goodchild, M. F. (1989). Spatial decision support systems: a


research agenda. In (pp. 707-716). Bethesda, MD, USA: American Society for
Photogrammetry and Remote Sensing.

Bibliography 83
84

DERM (2010). Environment and Resource Management. Retrieved July 6, 2010,


from http://www.derm.qld.gov.au/

DEWHA (1992). Our Community Our Future: A Guide to Local Agenda 21.
Canberra ACT: Department of the Environment, Water, Heritage and the Arts

Dutta, D. (2000). AVSWAT- a Spatial Decision Support System for Land and water
management an its application for watershed management in Bankura district of
West Bengal. In Map India 2000. New Delhi. Retrieved July 23, 2009, from
http://www.gisdevelopment.net/application/nrm/water/watershed/watws0003b.htm

Dye, A. S., & Shaw, S. (2007). A GIS-based spatial decision support system for
tourists of Great Smoky Mountains National Park. Journal of Retailing and
Consumer Services, 14(4), 269-278.

Elkington, J. (1998). Cannibals with Forks: The Triple Bottom Line of 21st Century
Business (The Conscientious Commerce Series): New Society Publishers.

EU (European Union) (2011). Impact Assessment. Retrieved June 9, 2011, from


http://ec.europa.eu/governance/impact/index_en.htm

Eversole, R. (2004). The Industry Gap in Community Development. New Community


Quarterly, 2(1)

Gilbert, D. (2009). JFreeChart. Retrieved July 6, 2010, from


http://www.jfree.org/jfreechart/

Hardi, P., & DeSouza-Huletey, J. A. (2000). Issues in analyzing data and indicators
for sustainable development. Ecological Modelling, 130(1-3), 59-65.

Hersh, M. A. (1999). Sustainable decision making: The role of decision support


systems. IEEE Transactions on Systems, Man and Cybernetics Part C: Applications
and Reviews, 29(3), 395-408.

Inter-Ministerial Committee on Sustainable Development (2009). Why Sustainable


Development Now? Retrieved May 25, 2010, from
http://app.mewr.gov.sg/web/Contents/ContentsSSS.aspx?ContId=1294

Jesus, J. D. (2009). What is Impact Assessment? Retrieved June 9, 2011, from


http://www.iaia.org/publicdocuments/special-
publications/What%20is%20IA_web.pdf

Kavanagh, P. (2004). Open Source: The Good, the Bad, and the Ugly. In Open
Source Software (pp. 41-65). Burlington: Digital Press.

Li, X., Yingyi, C., & Li, D. (2009). A spatial decision support system for land-use
structure optimization. WSEAS Transactions on Computers, 8(3), 439-448.

84 Bibliography
85

Malczewski, J. (2006). GIS-based multicriteria decision analysis: a survey of the


literature. International Journal of Geographical Information Science, 20(7), 703-
726.

MapGuide (2010). MapGuide Architecture. Retrieved July 6, 2010, from


http://trac.osgeo.org/mapguide/wiki/MapGuideArchitecture

McKenzie, S. (2004). Social sustainability: towards some definitions. Magill, South


Australia: Hawke Research Institute, University of South Australia.

Miller, E., Buys, L., & Rich, B. R. (2006). Defining the social dimension of triple
bottom line for the Australian dairy industry: Challenges, priorities and
opportunities. Paper presented at the 2006 Australasian Business and Behavioural
Sciences Association International Conference: School of Commerce, University of
Adelaide, Australia. from http://eprints.qut.edu.au/8522/

Muracevic, D., & Orucevic, F. (2008). Development of web spatial applications


based on MapGuide open source. Paper presented at the Proceedings of the 30th
International Conference on Information Technology Interfaces. Dubrovnik, Croatia.

NAO (National Audit Office) (2002). Better Regulation: Making Good Use of
Regulatory Impact Assessments. London.

Power, D. J. (2007). A Brief History of Decision Support Systems. Retrieved July 23,
2009, from http://DSSResources.COM/history/dsshistory.html

Robert, K.-H., Daly, H., Hawken, P., & Holmberg, J. (1997). A compass for
sustainable development. International Journal of Sustainable Development & World
Ecology, 4(2), 79 - 92. Retrieved May 25, 2010, from Science Direct database.

Rogers, M., & Walker, R. (2005). Sustainable Enterprise Creation: Making a


Difference in Rural Australia and Beyond. The International Journal of
Environmental, Cultural, Economic and Social Sustainability

Roseland, M. (2000). Sustainable community development: integrating


environmental, economic, and social objectives. Progress in Planning, 54(2), 73-
132.

Sikder, I. U., & Yasmin, N. (1997). Spatial Decision Support System for Location
Planning. Paper presented at the Proceedings of the International Conference on
Geo-Information for Sustainable Land Management (SLM). Enschede, Netherlands.

Stimson, R., & Shyy, T. (2007). A Prototype Web-Based Spatial Decision Support
System to Benchmark Queensland Local Government (1991-2001) Socio-economic
Performance. Paper presented at the ARCRNSISS Methodology, Tools and techniques
and Spatial Theory Paradigm Forums Workshop (2005 : University of Newcastle).
Melbourne, VIC: RMIT Publishing.

Bibliography 85
86

Sundblad, D., & Pullen, K. (2010). Why Is Sustainable Development Important?


Retrieved May 25, 2010, from
http://greenliving.lovetoknow.com/Why_Is_Sustainable_Development_Important

Tornqvist, R., Norstrom, A., Karrman, E., & Malmqvist, P. A. (2008). A framework
for planning of sustainable water and sanitation systems in peri-urban areas. Water
Science and Technology, 58(3), 563-570.

Turnhout, E., Hisschemller, M., & Eijsackers, H. (2007). Ecological indicators:


Between the two fires of science and policy. Ecological Indicators, 7(2), 215-228.

Vanclay, F., & Bronstein, D. A. (1995). Environmental and Social Impact


Assessment. England: John Wiley & Sons.

Wang, L., & Cheng, Q. (2008). Design and implementation of a web-based spatial
decision support system for flood forecasting and flood risk mapping. Paper
presented at the Proceedings of the IEEE International Geoscience and Remote
Sensing Symposium (IGARSS) Barcelona, Spain: Institute of Electrical and
Electronics Engineers Inc., from http://dx.doi.org/10.1109/IGARSS.2007.4423879

WCED (1987). Our Common Future. Oxford: Oxford University Press.

Wheeler, D. A. (2007). Why Open Source Software / Free Software (OSS/FS,


FLOSS, or FOSS)? Look at the Numbers! Retrieved July 6, 2010, from
http://www.dwheeler.com/oss_fs_why.html

Wu, Q., Zhang, H., Chen, F., & Dou, J. (2008). A web-based spatial decision support
system for spatial planning and governance in the Guangdong Province. Paper
presented at the Proceedings of the Geoinformatics 2008 and Joint Conference on
GIS and Built Environment: The Built Environment and Its Dynamics. Guangzhou,
China: SPIE. from http://link.aip.org/link/?PSI/7144/71442G/1

Yukui, S., & Sheng, Z. (2009). Analysis of problems and trends of decision support
systems development. Paper presented at the Proceedings of the 2009 International
Conference on E-Business and Information System Security Piscataway, NJ, USA:
IEEE. from http://dx.doi.org/10.1109/EBISS.2009.5137932

86 Bibliography
87

Appendices

APPENDIX A: LOCALITY CLASSIFICATION SOURCE CODE

Classification.jsp
<%@page import="org.osgeo.mapguide.*" %>
<%@page import="org.apache.jasper.JasperException" %>
<%@page import="java.util.*" %>
<%@page import="java.io.*" %>
<%@page import="java.text.*" %>
<%@page import="javax.servlet.jsp.*" %>
<%@page import="javax.servlet.http.*" %>
<%@page import="org.jdom.output.*" %>
<%@page import="org.jdom.xpath.XPath"%>
<%@page import="org.jdom.*,org.jdom.input.SAXBuilder"%>
<%@ include file="../../mapviewerjava/common.jsp/" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%!/*
* This file generates the interface for this task.
* When the task it loaded it retrieves the user selected
features on the map
* It passes all the user input to HandleCFN.jsp
* Author: Oshan Manawadu
*/

private static final boolean DEBUG = true;%>

<%
String featName="";
String featId = "";
String featSelec = "";
List<String> featureName = new ArrayList<String>();

String mgSessionId = request.getParameter("SESSION");


String mgMapName = request.getParameter("MAPNAME");

InitializeWebTier();

MgUserInformation userInfo = new MgUserInformation(mgSessionId);


MgSiteConnection siteConnection = new MgSiteConnection();
siteConnection.Open(userInfo);

MgResourceService resourceService =
(MgResourceService)siteConnection.CreateService(MgServiceType.Resour
ceService);
MgFeatureService featureService =
(MgFeatureService)siteConnection.CreateService(MgServiceType.Feature
Service);

MgMap map = new MgMap();

Appendices 87
88

map.Open(resourceService, mgMapName);

MgSelection selection = new MgSelection(map);


selection.Open(resourceService,mgMapName);

MgReadOnlyLayerCollection layers = selection.GetLayers();

if (layers != null){
MgFeatureQueryOptions queryOptions = new
MgFeatureQueryOptions();
for (int i = 0; i<layers.GetCount(); i++) {

MgLayer layer = (MgLayer)layers.GetItem(i);

if(DEBUG) System.out.println(layer.GetName());

if( layer != null &&


layer.GetName().equals("Locality_Boundaries")){

if(DEBUG) System.out.println("inside locality");

String layerClassName = layer.GetFeatureClassName();


if(DEBUG) System.out.println("class name: "+layerClassName);
String selectionString =
selection.GenerateFilter(layer,layerClassName);

String layerFeatureId = layer.GetFeatureSourceId();


if(DEBUG) System.out.println("Layer feature source:
"+layerFeatureId);
MgResourceIdentifier layerFeatureResource = new
MgResourceIdentifier(layerFeatureId);

queryOptions.SetFilter(selectionString);
MgFeatureReader featureReader =
featureService.SelectFeatures(layerFeatureResource,layerClassName,qu
eryOptions);

String tmp="";
String sep="";
while(featureReader.ReadNext()){

tmp = featureReader.GetString("ADMINAREAN").split(",")[0];
tmp = tmp.substring(0,1).toUpperCase() +
tmp.substring(1).toLowerCase();
featName = featName +sep+ tmp;
featId = featId+sep+featureReader.GetInt32("FeatId");

featureName.add(tmp);
sep=",";
}
}
}
}
pageContext.setAttribute("fName", featureName);
featSelec = featId + "|" + featName;
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"


"http://www.w3.org/TR/html4/frameset.dtd">
<html>

88 Appendices
89

<head>
<script type="text/javascript">

var dataSetName;

function process() {

var selObj = document.getElementById("dsSelect");


var selObjIndex = selObj.selectedIndex;
dataSetName = selObj.options[selObjIndex].value;
var thres = document.getElementById("thsInput").value;

var url = "HandleCFN.jsp";


//var windowProperty = "location=0,directories=no, height=420,
width=620, resizable=0";
var param
="featureSelection=<%=featSelec%>&dataSetName="+dataSetName+"&thresh
old="+thres+"&SESSION=<%=mgSessionId%>&MAPNAME=<%=mgMapName%>";
//window.open(url+param,"mywindow");
//parent.parent.scriptFrame.location.href=url+param;

request = createReqObject();
if (request != null) {
request.open("POST", url, true);
request.setRequestHeader("Content-Type",
"application/x-www-form-urlencoded;");
request.send(param);
request.onreadystatechange = getResponse;
}
}

function createReqObject() {
var xmlhttp = null;
if (window.XMLHttpRequest) {
xmlhttp = new XMLHttpRequest();

} else if (window.ActiveXObject) {
try {
xmlhttp = new
ActiveXObject("Msxml2.XMLHTTP");
} catch (e1) {
try {
xmlhttp = new
ActiveXObject("Microsoft.XMLHTTP");
} catch (e2) {
alert("error cannot create request
object");
}
}
}
return xmlhttp;
}
function onRquestReturn() {
var x = parent.parent.mapFrame.GetCenter().X;
var y = parent.parent.mapFrame.GetCenter().Y;

parent.parent.mapFrame.ClearSelection();
//parent.parent.mapFrame.ZoomSelection();
parent.parent.mapFrame.ZoomToView(x, y, 12, true);

Appendices 89
90

parent.parent.mapFrame.LegendCtrl.Refresh();
//parent.Refresh()

//Process ajax respose when it arrives


function getResponse() {
if (request.readyState == 4 && request.status == 200) {

var resText = trim(request.responseText);


onRquestReturn();

var dataTag = document.getElementById("data");


dataTag.innerHTML = resText;
dataTag.style.visibility = "visible";
setLegend(dataSetName);

}
}

function trim(stringToTrim) {
return stringToTrim.replace(/^\s+|\s+$/g, "");
}

function setLegend(dsn) {

var legendArry = document.getElementsByTagName("span");


var val = document.getElementById("thsInput").value;
for ( var i = 0; i < legendArry.length; i++) {
if (legendArry[i].getAttribute("class") ==
"limit") {
legendArry[i].innerHTML = val;
} else if (legendArry[i].getAttribute("class") ==
"dsn") {
legendArry[i].innerHTML = dsn;
}
}
document.getElementById("cLegend").style.visibility =
"visible";
}
</script>

<style type="text/css">
h2 {
font-family: "Arial";
font-size:20px;
}
#hed1, legend {
background-color:lightgrey;
font-family:"Arial";
font-size:13px;
font-weight:bold;
}
fieldset {
float:left;
}
#sec1{
padding-top:15px;
float:left;
clear:both;
}

90 Appendices
91

#sec1 table {
background-color:#ECE9D8;
font-family:"Verdana";
font-size:12px;
width:100%;
}
#rgSelect {
background-color:#ECE9D8;
/*border-width:0px;*/
}
#cLegend{
margin-left:5px;
float:left;
padding-top:15px;
width:30%;
visibility:hidden;
}
#cLegend table td {
width:20px;
height:20px;
font-family: "Verdana";
font-size:10px;
}
#data {
margin-left:2px;
float:left;
padding-top:15px;
visibility: hidden;
}
#data table tr.head {
font-family: "Arial";
font-weight:bold;
}
#data table {
font-family: "Verdana";
font-size:12px;
width:100%;
}
</style>
</head>
<body onLoad="parent.parent.mapFrame.Refresh();">
<div id="container">
<h2> Classification </h2>
<fieldset id="dset">
<legend>Controls</legend>
<p>
<table>
<tr>
<td>
Data Set
</td>
<td>
<select name="dataset" id="dsSelect" >
<option value="Population">Population</option>
<option value="Unemployment rate">Unemployment
rate</option>
<option value="Mean temperature">Mean
temperature</option>
</select>
</td>

Appendices 91
92

</tr>
<tr>
<td>Limit</td>
<td><input type="text" name="threshold" size=11
value=1000 id="thsInput" > </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td align="right"><input type="button"
value="Classify" onclick="process()"></td>
</tr>
</table>

</p>
</fieldset>
<div id="sec1">
<div id="hed1"> Selected Regions </div>
<table>
<tr> <td>&nbsp</td> </tr>
<c:forEach items="${fName}" var="name">
<tr>
<td><c:out value="${name}" /> </td>
</tr>
</c:forEach>
</table>
</div>
<div id="data">
</div>
<div id="cLegend">
<div id="hed1"> Legend: <span class="dsn"> </span>
</div>
<table>
<tr>
<td class="colored" style="background-
color:#ff6600;"> </td>
<td> Greater than </td>
<td > <span class="limit" ></span></td>
</tr>
<tr>
<td class="colored" style="background-
color:#ffff00;"> </td>
<td> Equal to </td>
<td ><span class="limit"></span></td>
</tr>
<tr>
<td class="colored" style="background-
color:#006600;"> </td>
<td> Less than </td>
<td> <span class="limit"></span> </td>
</tr>
<tr>
<td class="colored" style="background-
color:#000000;"> </td>
<td> No Data </td>
<td ></td>
</tr>
</table>

92 Appendices
93

</div>
</div>
</body>
</html>

Appendices 93
94

HandleCFN.jsp
<%@ page import="org.osgeo.mapguide.*" %>
<%@ page import="java.util.*" %>
<%@ page import="java.io.*" %>
<%@ page import="java.text.*" %>
<%@ page import="javax.servlet.jsp.*" %>
<%@ page import="javax.servlet.http.*" %>
<%@ include file="ProcessCFN.jsp" %>

<%!
private static final boolean DEBUG = true;
%>
<%

/*
* This method retrieves the user input from client tier
* It then initialse the ProcessCFN class and passes these
inputs
* It uses the output from this class to generated the task
output page
* Author: Oshan Manawadu
*/

if(DEBUG) System.out.println("inside handlecfn method");


String fs = request.getParameter("featureSelection");

// retrieve the input from client tier


String mgSessionId = request.getParameter("SESSION");
String mgMapName = request.getParameter("MAPNAME");
String thres = request.getParameter("threshold");
String dataSetName = request.getParameter("dataSetName");
Double threshold = Double.parseDouble(thres);

List<Location> featureList = new ArrayList<Location>();

if(!fs.equals("|")){
String[] featId = fs.split("\\|")[0].split(",");
String[] featNames = fs.split("\\|")[1].split(",");

for (int i=0;i< featId.length; i++) {


featureList.add(new Location(featNames[i],featId[i]));
}
}

for (int i=0;i<featureList.size();i++){


if(DEBUG) System.out.println(featureList.get(i).getName()+"
"+featureList.get(i).getFeatId());
}

ProcessCFN pcfn = new


ProcessCFN(featureList,dataSetName,threshold,mgSessionId,mgMapName);
pcfn.run();

out.print("<div id='hed1'>"+dataSetName+" Data </div>");


out.print("<table>");
out.print("<tr class='head'>");
out.print("<td>");
out.print("Year");
out.print("</td>");
out.print("<td>");

94 Appendices
95

out.print("Value");
out.print("</td>");
out.print("</tr>");
for(Location aLoc : featureList){

out.print("<tr>");
out.print("<td>");
out.print(aLoc.getYear());
out.print("</td>");
out.print("<td>");
out.print(aLoc.getValue());
out.print("</td>");
out.print("</tr>");
}
out.print("</table>");

%>

Appendices 95
96

Location.jsp
<%@ page import="java.util.*" %>

<%!

/*
* This class is used to store the locality name, dataset
name,
* data value, year and colour coding for each of the features
selected in the map.
*/

public class Location {

private String name;


private String indicatorName;
private String featureID;
private String color;

private Double value=0.0;


private int year;

public Location(String nm,String fID) {


name = nm;
featureID = fID;
}

public void setFeatId(String fid){


featureID = fid;
}

public void setName(String nm){


name = nm;
}

public void setYear(String yr){


if(!yr.equals(""))
year = Integer.parseInt(yr);
}

public void setValue(String val){


if(!val.equals(""))
value = Double.parseDouble(val);
}

public void setIndicatorName(String indName){


indicatorName = indName;
}

public void setColor(String clr){


color = clr;
}

public String getName(){


return name;
}

public String getFeatId(){


return featureID;

96 Appendices
97

public String getColor(){


return color;
}

public int getYear(){


return year;
}

public Double getValue(){


return value;
}

%>

Appendices 97
98

ProcessCFN.jsp
<%@ page import="Database.*" %>
<%@ include file="Filter.jsp" %>
<%@ include file="HandleXML.jsp" %>
<%@ page import="java.sql.*" %>
<%@ include file="Location.jsp" %>

<%!

/*
* This class processes the input passed from HandleCFN
* It retrieves and stores data for each location for the
specified dataset
* It classifies this data into groups based on the
specified threshold value
* Then it creates a colour coded layer resource, based on
this categories,
* and set it on the map
* Author: Oshan Manawadu
*/

public class ProcessCFN {

private static final boolean DEBUG = true;


List<Location> featureList = new ArrayList<Location>();
String dataset = null;
Double threshold;
Map<String,String> dataSetMap = new HashMap<String,String>();
Map<String,String> colorMap = new HashMap<String,String>();
DatabaseConnection dbcon = new DatabaseConnection();
DatabaseAccess dba = new DatabaseAccess(dbcon);
Random ranGen = new Random();
String mgSessionId;
String mgMapName;

List locationSet;

public ProcessCFN(List fl, String ds, Double tsh,String


sId,String mName) {

featureList = fl;
dataset = ds;
threshold = tsh;

mgSessionId = sId;
mgMapName = mName;

genColorMap();
}
public List run(){
if(DEBUG) System.out.println("runing get data");
getData();
setFiltre();
return locationSet;
}

// generate a user friendly colour map


private void genColorMap() {

98 Appendices
99

colorMap.put("red","ff0000");
colorMap.put("orange","ff6600");
colorMap.put("yellow","ffff00");
colorMap.put("green","006600");
colorMap.put("black","000000");
}

// Retrieve the data from the database


private void getData() {

String statement="";
for (Location aLocation: featureList){

String aLocName = aLocation.getName();

try{
ResultSet dbResultSet = dba.callProcedure("call
isr.getRecentIndicatorValue('"+aLocName+"','"+dataset+"')");
if(dbResultSet.next()){
if(DEBUG) System.out.println(dataset+"
"+dbResultSet.getString(1).split("-")[0]+"
"+dbResultSet.getString(2));
// Add data and year to each location object
aLocation.setValue(dbResultSet.getString(2));
aLocation.setYear(dbResultSet.getString(1).split("-
")[0]);

}else {
if(DEBUG) System.out.println("No Data");
}
}catch (SQLException error) {
String msg = error. getMessage();
System.out.println("Error printing data:
"+error.toString());
}
}
dba.close();
}

public void setFiltre() {


if(DEBUG){
System.out.println("=============================");
System.out.println("inside SetFilre
method");
}

// specify the existing resource layer used for the thematic


map,
// the location of the template, and the parent node of the
layer xml where the template goes in
String resName =
"Library://QLD/Layers/Locality_Boundaries.LayerDefinition";
String templName = "/rssfTool/Classification/arearule.templ";
String node = "//VectorScaleRange";

int size = 4;
locationSet = new ArrayList(size);

for (int i=0; i<size; i++){


locationSet.add(new ArrayList<Location>());
}

Appendices 99
100

processLocations(locationSet);

//create filter object


Filter flt = new Filter(mgSessionId,mgMapName);
flt.setResource(resName);
//set the name of the new layer,legend,group, group ledgend
flt.setLayerNames(dataset,dataset);
flt.setGroupNames("Classification","Classification");
String currentLayer = flt.getLayerXML();

//create a handle XML object passing it the current layer xml


//and the parent node of which the child nodes are going to be
modified
if(DEBUG) System.out.println("Creating handle xml object");
HandleXML hx = new HandleXML(currentLayer,node);

if(DEBUG) System.out.println("Updating xml");


String filterXML = createFilter(templName,locationSet,hx);
if(DEBUG) System.out.println("Printing Filter XML:
\n"+filterXML);
String modLayer = hx.getModLayer();

if(DEBUG){
System.out.println("Just before setLayer()");
System.out.println(modLayer);
}

flt.setLayer(modLayer);
if(DEBUG){

System.out.println("======================================");
System.out.println("edning SetFilre method");
}

for (Location aloc: featureList){


if(DEBUG) System.out.println(aloc.getName()+" Year:
"+aloc.getYear()+" Value: "+aloc.getValue());
}
}

// locSet list specifies the location for a given colour


category
// If an element in locSet is empty hasLocations is set to false

public String createFilter(String templName,List


locSet,HandleXML hx) {
String templ = "";
String modTempl = "";
String sep1="";
boolean hasLocations;

for(Object locList: locSet){


String color="";
String featId="";
String sep2="";
List<Location> locationList = (List<Location>)locList;
hasLocations = false;
for(Location loc: locationList){
featId=featId+sep2+"FeatId="+loc.getFeatId();
color = loc.getColor();

100 Appendices
101

sep2=" or ";
hasLocations = true;
}
// Add the featureIDs of each location in the same categorie
to the
// arearule template
if(hasLocations){
String[] vals = {featId,color};
try{
templ = LoadTemplate(templName);
//substitue the values to the template
modTempl = Substitute(templ, vals);
hx.updateXML(modTempl);

}catch(FileNotFoundException e){
System.out.println("File Not found");
}catch(IOException e){
}
sep1="\n";
}
}
return modTempl;
}

// Categories the location into colour coded categories


public void processLocations(List locationSet){

for(Location loc: featureList){


if(loc.getValue()==0){

loc.setColor(colorMap.get("black"));
((List)locationSet.get(0)).add(loc);

}else if(loc.getValue()<threshold){

loc.setColor(colorMap.get("green"));
((List)locationSet.get(1)).add(loc);

}else if(loc.getValue()>threshold){

loc.setColor(colorMap.get("orange"));
((List)locationSet.get(2)).add(loc);

}else{
loc.setColor(colorMap.get("yellow"));
((List)locationSet.get(3)).add(loc);
}
}
}
}
%>

Appendices 101
102

Filter.jsp
<%@page import="org.osgeo.mapguide.*" %>
<%@page import="org.apache.jasper.JasperException" %>
<%@page import="java.util.*" %>
<%@page import="java.io.*" %>
<%@page import="java.text.*" %>
<%@page import="javax.servlet.jsp.*" %>
<%@page import="javax.servlet.http.*" %>
<%//@ include file="../utilityfunctions.jsp" %>
<%@ include file="../../mapviewerjava/common.jsp" %>

<%!

/*
* This class initilises a map guide session
* Gets the layer resources and return this for modification.
* Then it saves the modified layer resources, which is
passed
* to this class as a String xml via setLayer();
*/

public class Filter {

MgUserInformation userInfo;
MgSiteConnection siteConnection;
MgResourceService resourceService;
MgFeatureService featureService;
String mgSessionId;
String mgMapName;
MgMap map;

MgResourceIdentifier resourceID;
String resName;
String layerXml;

String layerName = "New_Layer";


String layerLegendName = "New Layer";
String groupName = "New_Group";
String groupLedgendName = "New Group";

private static final boolean DEBUG = true;

public Filter(String mgSessionId,String mgMapName){

intMg(mgSessionId,mgMapName);

public void setLayerNames(String layer, String legend){

layerName = layer;
layerLegendName = legend;

public void setGroupNames(String group, String legend) {

groupName = group;
groupLedgendName = legend;

102 Appendices
103

//connect to current MapGuide session


public void intMg(String mgSessionId, String mgMapName ) {

this.mgSessionId = mgSessionId;
this.mgMapName = mgMapName;

try{
InitializeWebTier();

userInfo = new MgUserInformation(mgSessionId);


siteConnection = new MgSiteConnection();
siteConnection.Open(userInfo);

resourceService =
(MgResourceService)siteConnection.CreateService(MgServiceType.Resour
ceService);
featureService =
(MgFeatureService)siteConnection.CreateService(MgServiceType.Feature
Service);

map = new MgMap();


map.Open(resourceService, mgMapName);

}catch(MgException e) {

e.printStackTrace();
}
}

public void setResource(String resName){


try {
this.resName = resName;
resourceID = new MgResourceIdentifier(resName);
layerXml =
resourceService.GetResourceContent(resourceID).ToString();
}catch(MgException e) {

e.printStackTrace();
}
}

public String getLayerXML() {


return layerXml;
}

public void setLayer(String modLayer){


try{
MgByteSource byteSource = new
MgByteSource(modLayer.getBytes(),modLayer.length());
byteSource.SetMimeType(MgMimeType.Xml);

if(DEBUG)
System.out.println("Session:"+mgSessionId+resName.substring(8,21)+la
yerName+".LayerDefinition");

resourceID = new
MgResourceIdentifier("Session:"+mgSessionId+resName.substring(8,21)+
layerName+".LayerDefinition" );

Appendices 103
104

resourceService.SetResource(resourceID,byteSource.GetReader(),null);

MgLayer newLayer;
MgLayerGroup newGroup;
MgLayerCollection newlayerCollection = map.GetLayers();

if(!newlayerCollection.Contains(layerName)){

newLayer = createLayer(layerName,layerLegendName);
MgLayerGroupCollection layerGroupCollection =
map.GetLayerGroups();

if(!layerGroupCollection.Contains(groupName)){

newGroup = createGroup(groupName,groupLedgendName);
layerGroupCollection.Insert(0,newGroup);
if(DEBUG) System.out.println("name of new group:
"+newGroup.GetName());
}else {
newGroup = layerGroupCollection.GetItem(groupName);
}
newLayer.SetGroup(newGroup);
newlayerCollection.Insert(0,newLayer);
}
map.Save(resourceService);
}catch(MgException e) {
System.out.println("Something wrong with setLayer()");
}
}

public MgLayer createLayer(String layerName, String


layerLegendName) {
try{
MgLayer newLayer = new MgLayer(resourceID,resourceService);
newLayer.SetName(layerName);
newLayer.SetVisible(true);
newLayer.SetDisplayInLegend(true);
newLayer.SetLegendLabel(layerLegendName);
return newLayer;
}catch(MgException e) {
e.printStackTrace();
return null;
}
}
public MgLayerGroup createGroup(String groupName,String
groupLedgendName) {
try {
MgLayerGroup newGroup = new MgLayerGroup(groupName);
newGroup.SetLegendLabel(groupLedgendName);
newGroup.SetDisplayInLegend(true);
newGroup.SetVisible(true);
return newGroup;
}catch(MgException e) {
System.out.println("group exception occured");
e.printStackTrace();
return null;
}
}
} %>

104 Appendices
105

HandleXML.jsp
<%@page import="org.apache.jasper.JasperException" %>
<%@page import="java.util.*" %>
<%@page import="java.io.*" %>
<%@page import="java.text.*" %>
<%@page import="org.jdom.output.*" %>
<%@page import="org.jdom.xpath.XPath"%>
<%@page import="org.jdom.*, org.jdom.input.SAXBuilder"%>

<%!
/*
* This class builds up the final XML layer for the
modified layer
* It does this by adding each of the generated filter
arearule tags
* on top of each other
* This is done for the map scale between 4 and 12.5
* Author: Oshan Manawadu
*/
public class HandleXML {

private static final boolean DEBUG = true;


SAXBuilder sb = new SAXBuilder();

Document jdomDoc;
Document templJdomDoc;
Element templRoot;
XPath xp;
List<Element> nodes;
String modLayer;
String templ;

XMLOutputter outputter = new XMLOutputter();

public HandleXML(String layerXml, String nodeToMod) {

try{

// copy of the Layer definition of localities_boundaries


jdomDoc = sb.build(new StringReader(layerXml));
xp = XPath.newInstance(nodeToMod);
// Selects only the nodeToMod node(= "//VectorScaleRange")
into nodes list
nodes = xp.selectNodes(jdomDoc);

}catch(JDOMException e){
e.printStackTrace();
}catch(IOException e){
e.printStackTrace();
}
}

public void updateXML(String templName){


for(Element node: nodes){
if(DEBUG) {
System.out.println(node.getChildText("MinScale"));
System.out.println(node.getChildText("MaxScale"));
}

Appendices 105
106

try{
if(DEBUG) System.out.println("Start parsing templ");
templJdomDoc = sb.build(new StringReader(templName));
if(DEBUG) System.out.println("Finished parsing templ");
templRoot = (Element)
templJdomDoc.getRootElement().clone();
}catch(JDOMException e){

e.printStackTrace();
}catch(IOException e){
e.printStackTrace();
}

if(node.getChildText("MinScale").equals("4") &&
node.getChildText("MaxScale").equals("12.5")) {
if(DEBUG) System.out.println("between 4 and 12.5");
try{
//adds the mod template on top of the existing
arearule tag for this scale
node.getChild("AreaTypeStyle").addContent(1,templRoot);

try {
//write the XML to a file for debug purposes
BufferedWriter out = new BufferedWriter(new
FileWriter("nodeDebug.txt", true));
out.write(outputter.outputString(node));

out.write("\n<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
out.close();

} catch (IOException e) {
e.printStackTrace();
}
}catch (Exception e) {
e.printStackTrace();
}
}else if(Double.parseDouble( node.getChildText("MinScale")
)<12.5) {
try{
// Removes all other nodes (Scale levels) as we don't
require it for this layer
// and the there is nothing over MinScale 12.5

jdomDoc.getRootElement().getChild("VectorLayerDefinition").removeCon
tent(node);
}catch (Exception e) {
e.printStackTrace();
}
if(DEBUG) System.out.println("Not between...");
}
}
}

public String getModLayer() {


modLayer= outputter.outputString(jdomDoc);
return modLayer;
}

}%>

106 Appendices

You might also like