SlideShare a Scribd company logo
1 of 76
Download to read offline
UNIVERSITY OF BAGAMOYO
COLLEGE OF SCIENCE, INFORMATICS AND
BUILT ENVIONMENT
Bachelor of Science in Geoinformatics
MATHEMATICAL APPROACHES AND
ADVANCED GIS APPLICATION FOR SPATIAL DATA
ANALYSIS
Spatial Data Analysis with
Open Source Softwares
AREA OF STUDY;KILIMANJARO REGION
Author:
Joachim Nkende Yohana
Registration No:
UB010/0053/14
COLLEGE OF SCIENCE, INFORMATICS AND
BUILT ENVIRONMENT
SPATIAL DATA ANALYSIS
WITH
Open Source Softwares
Author:
Nkende J. Y
Supervisor:
Dr Mtalo E. G
Acknowledgements
With high gratitude i would like to thank Hon. Prof. Costa Rick Mahalu, University of
Bagamoyo Vice Chancellor for his Ethical and Principled governance, centered in develop-
ment and assistance toward youths dreams. In malt-dimensional ways he have been my pillar
toward Academic success in my studies
I express my deep gratitude to Dr. Elifuraha Gerard Mtalo - PHD, M.Sc.Eng,M.Sc
Civil Eng, Dean of Faculty,Faculty of Informatics and Built Environment for providing me
with guidance and encouragement within whole days of my studies. Never the less, we wish
to thank him much with all my heart for his both academic and financial support in the whole
semester basically on R software Applications.
I thank very much Dr. Deus Dorothea, She have assisted me so much on expansion of
my skills and knowledge toward GIS and Spatial data Analysis, It have been easy for me
to continue with Spatial Data Analysis basing on open source softwares like Q GIS and R
software from basic knowledge of ArcGIS (ArcMap10)
Also I would like to acknowledge made by Mr.Msaki Masawe, The Photogrammetry
department administrator at the Ministry of Land , Survey and Mapping Division for his
basic knowledge to aerial photogrammetry and close range photogrammetry. From his basic
idea and techniques , it made easy for me to deal with huge data covering a region, Country
or a Continent in Spatial data analysis
Last but not least, Its our genuine pleasure to express my deep sense of gratitude to all
Lectures and classmates forming the Geoinformatics Department in our Campus for their
advice and assistance toward accomplishment of this project.
Abstract
This project aims at providing basic introduction to spatial data concepts and statistical
approaches in data Visualization, Spatial data analysis and Modeling with the use of R .
Spatial data arise in almost every field of study as Spatial data are everywhere. Usefulness of
Spatial data is observed in geographic mapping of land cover, Urban transportation networks,
meteorological measurements from weather stations, demographics from the census, and
incidence of disease over a particular geographic area.
However this project explains the main idea of what is, where do we get and when we
can acquire a spatial data. What are the basic types of spatial data and their relationships.
The context of R software in Spatial Data Analysis and the existing relationships between R
and GIS
It further looks on the fundamental Applied Spatial Data Analysis in context to Spatial
objects, Spatial points , Spatial Lines and Spatial polygons in relations to their Data frames.
Never the less This project provides spatial data analysis with focused idea in Spatial
point pattern analysis, Interpolation and Geostatistics, estimation of Spatial correlation and
variogram modeling and prediction of Spatial data through simple and Universal Kriging ,
Local neighborhood and Spatial neighborhood.
Last but not least is applied Spatial data modeling which involves the use of mathematical
concepts and principles to model real world objects and phenomena. Regarding to this
Project Kilimanjaro Region have been used as source of data.
Therefore this project describes the classes and methods of the sp package, and in doing
so also provides a practical guide to the internal structure of many GIS data models, as R
permits the user to get as close as desired to the data.
Table of contents
1 Introduction 1
1.1 Spatial Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1.1 What means by the term Spatial . . . . . . . . . . . . . . . . . . . 1
1.1.2 Geographic phenomenon . . . . . . . . . . . . . . . . . . . . . . . 1
1.1.3 Spatial Data Models/ Structures . . . . . . . . . . . . . . . . . . . 2
1.2 What is R . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2.1 Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2.2 Why R ? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2.3 Relationship between R and GIS . . . . . . . . . . . . . . . . . . . 3
1.3 Applied Spatial Data Analysis . . . . . . . . . . . . . . . . . . . . . . . . 4
2 Spatial Reference System 5
2.1 Basic Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.1.1 What is Reference System . . . . . . . . . . . . . . . . . . . . . . 5
2.1.2 Spatial/Coordinate Reference System . . . . . . . . . . . . . . . . 5
2.1.3 Why CRS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.1.4 Objectives of CRS . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.2 Types of CRS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.2.1 Geographic Coordinate Reference System . . . . . . . . . . . . . 7
2.2.2 Projected Coordinate Reference System . . . . . . . . . . . . . . . 7
2.3 EPSG code and Projection.4 CRS in R . . . . . . . . . . . . . . . . . . . 9
2.3.1 UTM: Universal Transverse Mercator . . . . . . . . . . . . . . . . 9
2.4 EPSG code and Projection.4 CRS in R . . . . . . . . . . . . . . . . . . . 9
2.5 Setting the Map to UTM Arc 1960 Datum . . . . . . . . . . . . . . . . . . 11
2.6 Map projections with Q GIS . . . . . . . . . . . . . . . . . . . . . . . . . 14
3 Methodology 15
3.1 R packages to be used in the project . . . . . . . . . . . . . . . . . . . . . 15
viii Table of contents
3.2 Introduction to Spatial objects . . . . . . . . . . . . . . . . . . . . . . . . 16
3.3 Points Pattern . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
3.4 Spatial Point Data Creation, Loading and Processing in R . . . . . . . . . . 19
3.4.1 Point data creation . . . . . . . . . . . . . . . . . . . . . . . . . . 20
3.4.2 Klm File Processing . . . . . . . . . . . . . . . . . . . . . . . . . 20
3.4.3 Loading a Coordinate list in R . . . . . . . . . . . . . . . . . . . . 21
3.4.4 3D Visualizarion of point data . . . . . . . . . . . . . . . . . . . . 23
3.5 Line data , and Polygon Formation with Script in R . . . . . . . . . . . . . 25
4 Introduction to Spatial Data Modeling 29
4.1 Basic Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
4.1.1 Realms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
4.1.2 Spatial Databases . . . . . . . . . . . . . . . . . . . . . . . . . . 30
4.2 Modeling of Vector data in QGIS . . . . . . . . . . . . . . . . . . . . . . 30
4.3 Modeling of Kilimanjaro Mountain in QGIS . . . . . . . . . . . . . . . . 31
5 Digital Image Processing 39
5.1 High resolution Image acquisition with R . . . . . . . . . . . . . . . . . . 40
5.2 Map projections with Q GIS . . . . . . . . . . . . . . . . . . . . . . . . . 44
5.3 Image Pre-processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
5.4 Image Classifications with Q GIS . . . . . . . . . . . . . . . . . . . . . . . 47
5.4.1 Opening the SCP and select Working file . . . . . . . . . . . . . . 48
5.4.2 Creation of Shapefiles and ROIs . . . . . . . . . . . . . . . . . . . 48
5.4.3 Spectral Signature List plotting . . . . . . . . . . . . . . . . . . . 49
5.4.4 Perform classification . . . . . . . . . . . . . . . . . . . . . . . . . 50
5.5 Post Classification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
5.5.1 Accuracy Assessment . . . . . . . . . . . . . . . . . . . . . . . . 51
5.6 GIS Modeler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
5.6.1 Image Processing by QGIS Processing Modeler . . . . . . . . . . . 51
6 Spatial Object Analysis 55
6.1 Introduction to OSMAR . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
6.2 Data acquisition with OSM . . . . . . . . . . . . . . . . . . . . . . . . . . 56
6.3 Handling Spatial Data Frame in QGIS . . . . . . . . . . . . . . . . . . . . 58
6.4 Handling Spatial Data in R . . . . . . . . . . . . . . . . . . . . . . . . . . 61
6.5 Loading or Attaching of Datasets in R . . . . . . . . . . . . . . . . . . . . 62
Table of contents ix
Bibliography 63
x Table of contents
Preface
Geoinformatics is the science and art of processing and managing spatial information
and data and extracting policy, planning and decision making information for sustainable
resource and environmental management. Geoinformation includes temporal information
and data that is spatially or geographically referenced.
The Geoinformatics programs are designed to equip students with the scientific founda-
tion required to master the technical and professional requirements for modern spatial data
acquisition, data processing and transformation, data management, data analysis and model-
ing, information extraction and presentation/visualisation using the latest computer/electronic
hardware, methods, and software systems.
Therefore graduates of this program should be able to integrate spatial and non-spatial
(attribute data) from a diversity of sources ranging from earth-orbiting satellites, air and
sea-borne remote sensors, ground-based surveying instruments and social economic surveys
and use relevant hardware and software systems to support operational requirements at the
workplace as an individual or part of a professional team
The General Objectives of this project is to implement the key objectives considered
in establishment of Geoinformation technology, Geographic Information Systems, Remote
Sensing, Environmental management, Surveying and Geomatics by imparting theoretical
and practical knowledge in:
1. Spatial data acquisition, data processing, data management, information extraction
and and presentation for governance (i.e. policy development, development planning,
development monitoring and decisionmaking) in a wide range of human undertakings
and professional fields.
2. Problem analysis and structuring for purposes of designing effective solutions using
remote sensing, geographic information science, database technology, spatial/temporal
modeling and software development principles.
3. Geographic Information Systems development and effective application to the solution
of key developmental problems.
4. Geospatial information for governance, civil society and environmental sustainability
Chapter 1
Introduction
1.1 Spatial Data
1.1.1 What means by the term Spatial
The term Spatial means each item of data has a geographical reference so we know where
each case occurs on a map.
Spatial data refers to any Geographic phenomena whether seen or unseen with our
naked eyes, existing in the real world, For example Temperature, elevation and spatial
objects.(Dorothea, 2016)
1.1.2 Geographic phenomenon
A geographical phenomenon is an entity or process of interest that can be named or de-
scribed, can be georeferenced (it has a geographical position in the real world), can be
assigned a name and occurs at a specific time.
There are two groups of geographic phenomena, which are fields and objects:
Geographic objects: are well-distinguished, discrete, and bounded entities, not present
everywhere in the study area as they do not cover the total study area. The space between
them is empty or undetermined. Some typical examples of fields are temperature, barometric
pressure and elevation.
Geographic field: are geographic phenomenon from which, for every point in the study
area, a value can be determined.
There are two types of geographic fields; continuous fields and discrete fields:
2 Introduction
In a continuous field, the underlying function is assumed to be continuous. Continuity
means that all changes in field values are gradual (for example elevation).
Discrete fields cut up the study space in mutually exclusive bounded parts, with all
locations in one part having the same field value (for example soil types).
However Typical examples are land classifications, geological classes, soil types, land
use types, crop type or natural vegetation types.
Objects are discrete and bounded entities and the space between the objects is potentially
‘empty’ or ‘undetermined’, however the space is not really empty, as it may contain roads,
gardens which in fact are not houses or buildings.
The position of an object in space is determined by a combination of one or more of the
following parameters;
Location (where is it?)
Shape (what form?)
Size (how big?)
Orientation (which direction?)
1.1.3 Spatial Data Models/ Structures
A Model is a miniature representation of an object OR is a representation of a real world
object at reduced scale, it can be either physical, descriptive or abstract (e.g. in mathematical
form,)
Data are raw facts, concepts or instructions in formalized manner, suitable for commu-
nication, interpretation or processing by human (manually) or automated means. A Data
Model is an organization or Structure/System of storing data in a computer. A Data Model
being a structure for holding data it defines rules and/or limitations the relevant stored data
have to obey as well as manipulation functions, which can be applied on data sets.The spatial
data models include Point data, line data, area and continuous data.
1. Point: eg. wells, street lamps, addresses
2. Line: eg. roads, transmission lines, streams
3. Area: eg. land use, parcels
4. Continuous: eg elevation, rainfall, ocean salinity
1.2 What is R 3
1.2 What is R
1.2.1 Definitions
R is a language and environment for statistical computing and graphics which provides a wide
variety of statistical as linear and nonlinear modeling, classical statistical tests, time-series
analysis, classification, clustering, and graphical techniques, and is highly extensible. In
other way R can be defined as an integrated suite of software facilities which support data
manipulation, calculation and graphical display developed by John Chambers et al.(Bivand
et al., 2008)
1.2.2 Why R ?
R aims at facilitating;
• An effective data handling and storage facility,
• A suite of operators for calculations on arrays, in particular matrices,
• A large, coherent, integrated collection of intermediate tools for data analysis,
• Graphical facilities for data analysis and display either on-screen or on hardcopy, and
• A well-developed, simple and effective programming language which includes conditionals,
loops, user-defined recursive functions and input and output facilities. Also R has its own
LaTeX-like documentation format, which is used to supply comprehensive documentation,
both on-line in a number of formats and in hard copy.
1.2.3 Relationship between R and GIS
GIS is a computer system capable of capturing, storing, analyzing, and displaying geographi-
cally referenced data in digital form.The data in a GIS is inherently spatially referenced. In
other words, each object found in a GIS can be related to some location and can be mapped.
The objects in a GIS are defined by their location and often by multiple attributes that further
describe the characteristics of objects.
Since GIS as a ’tool’ for capturing, storing, analyzing, and displaying which operates
under toolbox-centered architectures like Arc/Info™ or ArcGIS™ applications and now is
moving to towards service-centered architectures such as Google Earth.
Therefore increasing availability and bandwidth of the Internet, and also ownership and
maintenance of data and/or analysis methods lead to growth of the R system since it also
operates well under both toolbox-centered and service-centered architectures.
4 Introduction
1.3 Applied Spatial Data Analysis
Applied Spatial Analysis is the broad term explaining on how to disseminate the knowledge
and skills which enable the community to accurately measure and collect information about
the earths surface using a combination of technologies ranging from ground-based sensors,
airborne sensors and space borne sensors, how to develop and utilize remote sensing systems
and geographic information system for studying the environment, monitoring and analyzing
earth resources.
Not only that but also to analyze specific sector problems and design practical solutions
through the use cartographic and geo-visualization techniques. This is implemented through
creation of effective maps and 3D visualizations which support planning and decision making.
Applying of geo-spatial science techniques in the application fields of land governance,
environmental management, disaster management, natural resources management, and urban
and regional planning. through spatial-temporal analysis and modeling techniques, spatial
decision support, systems design and application which are essential in designing optimum
geographic information system solutions used for selecting application areas.
Last but not least , is developing solutions to complex problems using database , Ge-
ographic Information Science techniques and Geoinformatics technology for predicting,
monitoring and mitigating environmental disasters, land administration and management
problems, natural resources management problems, mineral resources management and to
build decision support systems for governance and environmental management.
Chapter 2
Spatial Reference System
2.1 Basic Concepts
2.1.1 What is Reference System
It is a complete conceptual definition of how coordinate system is formed. It defines the
origin and the orientation of the fundamental planes or axes of the system. It also includes the
fundamental mathematical and physical models. Therefore both vectors and raster must be
expressed in a uniform coordinate system. The definition of a 3-D Cartesian system requires
a convention for the orientation of the axes and the location of the origin.(Bivand et al., 2008)
However Spatial data vary a great deal both in the ways in which their position attributes
are recorded and in the adequacy of documentation of how position has been determined.
This applies both to data acquired from secondary sources and to Global Positioning System
input, or data capture from analogue maps by digitizing.(Mtalo, 2016)
2.1.2 Spatial/Coordinate Reference System
A spatial reference system (SRS) or coordinate reference system (CRS) is a coordinate-based
local, regional or global system used to locate geographical entities. A spatial reference
system defines a specific map projection, as well as transformations between different spatial
reference systems.
Spatial reference systems can be referred to the use of a Spatial Reference System
Identifier (SRID) such as the European Petroleum Survey Group (EPSG) which is maintained
by the International Association of Oil and Gas Producers (OGP) Surveying and Positioning
Committee.
6 Spatial Reference System
EPSG: 21035S, EPSG: 21037S and EPSG:21036S are the three CRS that cover Eastern
and Western Tanzania respectively. The figure below shows European Petroleum Survey
Group (EPSG) covering Tanzania(Mtalo, 2016)
2.1.3 Why CRS
Coordinate reference systems (CRS) are at the heart of geodetics and cartography: how to
represent a bumpy ellipsoid on the plane. We can speak of geographical CRS expressed in
degrees and associated with an ellipse – a model of the shape of the earth, a prime meridian
defining the origin in longitude, and a datum. The concept of a datum is arbitrary and anchors
a specific geographical CRS to an origin point in three dimensions, including an assumed
height above the assumed centre of the earth or above a standard measure of sea level.
Since most of these quantities have only been subject to accurate measurement since the
use of satellites for surveying became common, changes in ellipse and datum characteristics
between legacy maps and newly collected data are common.
2.1.4 Objectives of CRS
• Satisfy the need to answer the questions:
Where am I (at some instant in time)?
What is the location of some object or someone else?
In absolute terms or in relative terms and at varying accuracies
• For the military:
Missile launch sites, precision weapons and targets
Landmines
Battlespace coordination
2.2 Types of CRS 7
• For the general civilian population:
International borders
Car, ship or plane navigation
Mineral resources
• For the scientific community:
Crustal motion
Sea level change
Satellite orbits
2.2 Types of CRS
Coordinate Reference Systems is composed of both
Geographic Coordinate Reference System and
Projected Coordinate Reference System
2.2.1 Geographic Coordinate Reference System
Geographic Coordinate Reference System is a set of longitudes and latitudes based on the
mechanism that; longitudes running from north to south pole with central meridian(0 degree)
through Greenwich from which the Eastern longitudes are positive (East of Greenwich) and
Western longitudes are negative (West of Greenwich). Also set of latitudes which are parallel
circles created by slicing the Earth by planes parallel to the Equator with Equator at latitude
0 degree. Northern latitudes are positive (North of Equator) while Southern latitudes are
negative (South of Equator) (Mtalo, 2016)
Kilimanjaro region latitudes are negative since the northern-most boundary is 2.7 degree
south of Equator and 36.5 East of Greenwich meridian
2.2.2 Projected Coordinate Reference System
Map projection refers to a projection of the globe onto a flat map/surface using a grid of lines
of latitude and longitude.
8 Spatial Reference System
Types of Map Projection
1. Cylindrical: In standard presentation, these map regularly-spaced meridians to equally
spaced vertical lines, and parallels to horizontal lines.
2. Conic: In standard presentation, conic (or conical) projections map meridians as straight
lines, and parallels as arcs of circles.
3. Azimuthal: map meridians as straight lines and parallels as complete, concentric circle;
radially symmetrical and they preserve directions from the center point.
Transverse Mercator Projection
Transverse Mercator projections result from projecting the sphere onto a cylinder tangent
to a central meridian. Transverse Mercator maps are often used to portray areas with larger
north-south than east-west extent. Distortion of scale, distance, direction and area increase
away from the central meridian. Many national grid systems including that of Tanzania and
EA are based on the Transverse Mercator projection.
2.3 EPSG code and Projection.4 CRS in R 9
2.3 EPSG code and Projection.4 CRS in R
2.3.1 UTM: Universal Transverse Mercator
The Universal Transverse Mercator (UTM) projection is used to define horizontal, positions
world-wide by dividing the surface of the Earth into 6 degree zones, each mapped by the
Transverse Mercator projection with a central meridian in the center of the zone. UTM zone
numbers designate 6 degree longitudinal strips extending from 80 degrees South latitude to
84 degrees North latitude. UTM zone characters designate 8 degree zones extending north
and south from the equator. Tanzania is covered by UTM Zone characters M and L(Mtalo,
2016)
2.4 EPSG code and Projection.4 CRS in R
EPSG is provided in the rgdal package so as to permit the conversion of a large number
of CRS into the PROJ.4 style as it allows for datum transformation and projection, as the
number of different coordinate reference systems is larger than that in the mapproj package.
Datum transformation is based on transformation to the World Geodetic System of 1984
(WGS84), or inverse transformation from it to an alternative specified datum. WGS84 was
introduced after measurements of earth from space had become very accurate, and forms a
framework into which local an national systems may be fitted
For the case of My field locality, Kilimanjaro is covered by EPSG: 21037S. The tables on
the figure below identifies how does EPSG code relate to the projection prj4 .(Mtalo, 2016)
10 Spatial Reference System
Generally, it is possible also to use a note to specify local data frames. For example Arc
1960 the note on the following table are valid.
2.5 Setting the Map to UTM Arc 1960 Datum 11
2.5 Setting the Map to UTM Arc 1960 Datum
To set the downloaded Map to UTM Arc 1960 Datum first extract from the Tanzania Image
The area falling in Zone 37S and Zone 36S respectively
Then with plot function you can now crop for required area
12 Spatial Reference System
2.5 Setting the Map to UTM Arc 1960 Datum 13
14 Spatial Reference System
2.6 Map projections with Q GIS
The PROJ.4 library uses a ‘tag=value’ representation of coordinate reference systems, with
the tag and value pairs enclosed in a single character string.The Following strings represent
the proj4 specifications for UTM Zone 36S / WGIS 84 and UTM zone 36S / Arc 1960
respectively from QGIS
+proj=utm +zone=36 +south +ellps=WGS84 +units=m +no defs
+proj=utm +zone=36 +south +ellps=clrk80 +towgs84=-160,-6,-
302,0,0,0,0 +units=m +no defs
Chapter 3
Methodology
The project is driven by the software used to process , visualize and Analyze spatial data.
With this project Google Earth, TCX converter and R-Statistics software are useful in data
processing and visualization of spatial objects. Processing of Raster data is done with QGIS
software in Chapter five.
3.1 R packages to be used in the project
Kilimanjaro project aims at evaluation of the DEM (Digital Elevation model) of the mountain.
The useful packages was determined by the range of activities to be involved in the project.
The packages depends on;
1. A specified operation to be solved by such package
2. Source of data such as Vector data or Raster data
3. Environment from which data works whether spatial or not.
4. Utilities needed for the project to be well processed, visualized and analyzed
16 Methodology
Regarding to Kilimanjaro project ,useful packages were:
Packages Functions
library(sp) Classes for spatial data
library(raterVis) lattice, latticeExtra and RColorBrewer packages
library(maptools) Map creation functions
library(raster) raster, grids
library(rgdal) Geospatial Data Abstraction Library
library(rgeos) Spatial data relationships and operators
library(XML) loads required namespace in gmap
library(dismo) Species distribution modeling
library(foreign) loading google maps
library(plotly) Plotting 3D of spatial objects
library(geoR) Map analysis
library(osmar) Downloading spatial points
library(datasets) A package containing datasets
library(GISTools) Mapping and spatial data manipulation tools
library(rgl) 3D Visualization
library(spdep) evaluation of spatial pattern and autocorrelation
library(RgoogleMaps) Querying google saver for statistic maps
library(spatstat) analysing spatial data
3.2 Introduction to Spatial objects
Spatial objects are well-distinguished, discrete, and bounded entities, not present every-
where in the study area as they do not cover the total study area. The space between them is
empty or undetermined.(Dorothea, 2016)
3.3 Points Pattern 17
One spatial object is represented by a tuple within a table, and a table contains only
objects of the same type (set of points, set of lines, etc. for example, buildings and roads.
Spatial objects are presented in space as simplexes defining the space presentation as
0 simplex defining zero dimension, 1 simplex defining line , 2 simplex surface area and 3
simplex defining a three dimension object such as a cube or pyramid.Mtalo (2016)
1D Space the space associated with a straight line. Mathematically definable by adoption
of an origin O(0) and a direction (reference line through the origin). Object location P(x)
reckoned as distance x from the origin along the reference line. It supports only 1D coordinate
geometry.
2D space Space associated with a flat plane. Mathematically definable by adoption of
an orign O(0,0), an initial direction (1st reference line) and another direction(2nd reference
direction) normal to the first reference line. Object location P(x,y) reckoned as the object
distances (x, y) measured normal to the two reference lines. It supports 2D coordinate
geometry.
3D Space Space associated with a cube or a box. Mathematically definable by adoption
of an origin, two reference lines perpendicular to each other through the origin and a third
reference line through the origin perpendicular to the plane containing the two initial reference
lines. Object location P(x,y,z) reckoned as the object distances (x, y,z) measured normal to
the three reference lines. It supports 3D coordinate geometry Mtalo (2016)
3.3 Points Pattern
A Spatial Point is a single point with unique location describing its position in term of
georeferenced Data frame. A spatial point data of a place can be determined either by
ground based equipments like differential GPS and total stations or photogrammetric and
high resolution images obtained from satellite operations
18 Methodology
Spatial points are fundamental units needed to predict direction and distances of lines
such as roads, cables and natural rivers. Point pattern analysis is efficient if and only if there
exist point pattern data.
For example consider data below extracted from Google earth how are employed in Point
pattern analysis
The same data can be loaded to QGIS in order to determine Digital Elevation Model and
Contour Creation.
3.4 Spatial Point Data Creation, Loading and Processing in R 19
3.4 Spatial Point Data Creation, Loading and Processing
in R
Point data are the basic spatial data, as from a Point Data a line can be created, and from
combination of lines the polygon can be created. From this point of view , Spatial point data
were created covering the Mount Kilimanjaro so as to establish coordinates which may assist
in making a Digital elevation model (DEM)
20 Methodology
3.4.1 Point data creation
As shown above, the Add Path button was used to create a series of points to cover a whole
mountain. A total number of 6822 points were created manually to cover the mountain as
shown below;
After Spatial point creation the file was saved to .KLM extension which is the Google
Earth data format
3.4.2 Klm File Processing
The file was then loaded to TCX converter for primary processing; In TCX converter ,
longitudes ad latitudes were extracted, followed by computation of Altitude. Then data was
exported in a .CSV format to spreadsheet for further editing.
3.4 Spatial Point Data Creation, Loading and Processing in R 21
3.4.3 Loading a Coordinate list in R
After Editing and removing unwanted data from the file, Longtudes , Latitudes and Altitudes
were Loaded to R
22 Methodology
3.4 Spatial Point Data Creation, Loading and Processing in R 23
3.4.4 3D Visualizarion of point data
24 Methodology
3.5 Line data , and Polygon Formation with Script in R 25
3.5 Line data , and Polygon Formation with Script in R
Line is a two dimension plane defined by two or more lines. when three or more lines
are joined in their nodes , they form a polygon. From the same concept of Point data
creation, a series of points was created following the boundary of Kilimanjaro region, the
data were saved with .klm extension then imported to TCX converter. Since in defining the
two dimensional boundaries there is no need for height values, the data were exported as .csv
directly for further editing.
26 Methodology
The script defining how to plot an area was then introduced to R as shown below;
3.5 Line data , and Polygon Formation with Script in R 27
Then after loading the script to R point data were loaded as usual, defining the Xcord,
Ycord and Distance from one point to the other
Then after The are computation was carried out fom the created polygon. However there
was no clear illustrations of area since the area was not projected yet!!!!
28 Methodology
Chapter 4
Introduction to Spatial Data Modeling
4.1 Basic Concepts
4.1.1 Realms
Spatial objects considered in the design process using realms are points, lines, and regions.
These can be represented using only points and segments of the realm. Basically, a spatial
object is not created on the realm, but there are construction elements associated to it (points
and segments).(Mtalo, 2016)
Realms refers to the a finite set of points and line segments defined over a finite domain,
of type grid, such that :
1. Each point is a point of the grid;
2 Each segment end is a grid point;
3 No point of the realm belongs to the interior of a segment;
4 Any two distinct segments do not intersect and do not overlap.
Realms use a discrete domain for representing space and spatial objects. Therefore a user
can define a finite domain of numerical values that is used as the base in defining a set of
spatial data types.
30 Introduction to Spatial Data Modeling
4.1.2 Spatial Databases
A spatial database is a database optimized for storing, managing, and querying spatial
data. It provides spatial data types in its data model and query language, support for spatial
indexing and for spatial join. Spatial databases are essential for recording values of spatial
characteristics of a set of objects.
4.2 Modeling of Vector data in QGIS
Geographical Information Systems (GIS) and Digital Elevation Models (DEM) can be
used to perform many geospatial and hydrological modeling including drainage and wa-
tershed delineation, flood prediction and physical development studies of urban and rural
settlements.(Konadu and Fosu, 2009)
There are two techniques for modeling spatial data in a computer system: raster (grid)
and vector.The main difference within these two is that In a vector model, a spatial infor-
mation indicates where something is or where it occurs, and in a raster model it indicates
something that exists or occurs everywhere.
4.3 Modeling of Kilimanjaro Mountain in QGIS 31
In the study DEM was developed with 5 m contour topographic data; The Kilimanjaro
points with altitude created by using Google Earth were used as terrain inputs for performing
spatial analysis and obtaining derivative products. The generated DEM was used to delineate
drainage patterns and watershed of the study area using QGIS open source software.
4.3 Modeling of Kilimanjaro Mountain in QGIS
A vector-based approach was used to derive contours in determination of height levels of
mountain Kilimanjaro. The DEM of Kilimanjaro mountain was used as inputs for determining
contour lines which would help in further developmental projects mapping.
Randomly selected data acquired with Google Earth was used to create a DEM. The first
step was to load the .CSV file of kilimanjaroPts.csv to QGIS
Then points could be displayed as follows;
32 Introduction to Spatial Data Modeling
Reproject the point data to Arc 1960 UTM zone 37
Convert data to Shape files by using save as.. function
4.3 Modeling of Kilimanjaro Mountain in QGIS 33
There after, DEM will be displayed to canvas and therefore remove the kilimanjaroPts
data and remain with DEM
If there is a need of adding attributes to the DEM it is required to open attribute table
otherwise processing can take place.
34 Introduction to Spatial Data Modeling
With context to this project Modeling could involve Natural neighbor algorithms found
in Raster creation tools.
Projection parameter is of very important. also it is required to select input column data
eg. Altitude, cell size and output directory. The figure below shows sample of filling natural
neighbour toolbox.
4.3 Modeling of Kilimanjaro Mountain in QGIS 35
Raster Grid is then displayed to canvas as a single band gray level.
Then it is required to open attribute level so as to change color
36 Introduction to Spatial Data Modeling
Now the Grid raster is displayed in multiple colors and therefore provide clear visualiza-
tion of a model.
Open Raster tools box and select Extraction to allow Contour formation as shown below
4.3 Modeling of Kilimanjaro Mountain in QGIS 37
It is required to fill parameters cleary depending on the need of output values
For example for the case of Kilimanjaro, contours could be displayed as shown below;
38 Introduction to Spatial Data Modeling
By removing raster Grid contours coud then be displayed as shown below
Chapter 5
Digital Image Processing
A digital image refers to the record of the electromagnetic energy reflected or emitted from the
earths surface or other features on the earth’s surface. A remotely sensed image is a pictorial
rendition, or model, of target features described through the use of spectral reflectance. A
digital image is stored as a two-dimensional array (or grid) of small areas called pixels
(picture elements). Each pixel corresponds spatially to an area on the earth’s surface. This
array or grid structure is also called a raster, so image data is often referred to as a raster
image. The raster image is arranged in horizontal rows called lines, and vertical columns
called samples. Each pixel in the image raster is represented by a digital number (DN) or a
brightness value (BV).(ENVI, 2004)
Digital image processing refers to the subclass of signals processing concerned specif-
ically with pictures, with the aim of increasing or improving image quality for computer
visualization and human interpretation.
Therefore in order to conduct the accurate classification it requires first to:
-Acquire high resolution image
-Perform pre-processing so as to remove radiometric and geometric errors. High reso-
lution satellite image can be acquired by various ways depending on the need and time given
to accomplish the task. R and QGIS are simpler softwares employed in downloading of high
resolution satellite images. This is due to presence of GDAL and OSMAR packages in R
and and Plugin installer in QGIS. OpenStreetMap provides freely accessible and editable
geographic data. The osmar package smoothly integrates the OpenStreetMap project into
the R ecosystem. The osmar package provides infrastructure to access OpenStreetMap data
from different sources, to enable working with the OSM data in the familiar R idiom, and to
convert the data into objects based on classes provided by existing R packages.
40 Digital Image Processing
5.1 High resolution Image acquisition with R
Using R software i refer to the simplest and easiest technique of downloading high resolution
images. The image downloaded with R are always Multispectral band images but with few
bands as Red, Green and Blue (RGB). QGIS is essential in downloading images which require
large dataset as selection of satellite to be used, for example Landsat 5, 7,8 or Quickbird
satellites.
Strengths of using R instead of QGIS is that, The image downloaded with R such as
Google maps and Open Street Maps do not contain geometric and radiometric errors as they
tend to be already pre-processed. Never the less downloading high resolution images with
QGIS needs much time and bandwidths as one Landsat image with three bands can take to
more than 2GB (Gigabytes) to download where as in R only few MB (Megabytes).
Steps Employed in downloading high resolution satellite images with R.
1. Load the package required
2. Set the working directory from which image downloaded will be saved and download
the map defined by the name of district, region or country. The gmap package is useful in
5.1 High resolution Image acquisition with R 41
downloading and saving googlemap images. Also it is advised to use draw extent function to
draw tiles of interest covering the required area. A good example is shown below;
NOTE:
The small the tiles created the higher the resolution downloaded and vise versa is true.
From above 4 images plotted above, other 4 tiles to each were downloaded as shown below;
42 Digital Image Processing
########################################################################
> #So as to get high resolution images Kilimanjaro map was then plotted to four parts
># as North West, North east, South west and South East Then each part was further
># divided to four portion making total number of 20 downloaded images.
> plot(KilimanjaroMap)
> select.area <- drawExtent()
> North_West<-gmap(select.area, type="satellite",rgb=TRUE,filename="NW.tif")
> select.area <- drawExtent()
> North_West1<-gmap(select.area, type="satellite",rgb=TRUE,filename="NW1.tif")
> select.area <- drawExtent()
> North_West2<-gmap(select.area, type="satellite",rgb=TRUE,filename="NW2.tif")
> select.area <- drawExtent()
> North_West3<-gmap(select.area, type="satellite",rgb=TRUE,filename="NW3.tif")
> select.area <- drawExtent()
> North_West4<-gmap(select.area, type="satellite",rgb=TRUE,filename="NW4.tif")
>
> select.area <- drawExtent()
> North_East<-gmap(select.area, type="satellite",rgb=TRUE,filename="NE.tif")
> select.area <- drawExtent()
> North_East1<-gmap(select.area, type="satellite",rgb=TRUE,filename="NE1.tif")
> select.area <- drawExtent()
> North_East2<-gmap(select.area, type="satellite",rgb=TRUE,filename="NE2.tif")
> select.area <- drawExtent()
> North_East3<-gmap(select.area, type="satellite",rgb=TRUE,filename="NE3.tif")
> select.area <- drawExtent()
> North_East4<-gmap(select.area, type="satellite",rgb=TRUE,filename="NE4.tif")
>
> select.area <- drawExtent()
> South_West<-gmap(select.area, type="satellite",rgb=TRUE,filename="SW.tif")
> select.area <- drawExtent()
> South_West1<-gmap(select.area, type="satellite",rgb=TRUE,filename="SW1.tif")
> select.area <- drawExtent()
> South_West2<-gmap(select.area, type="satellite",rgb=TRUE,filename="SW2.tif")
> select.area <- drawExtent()
> South_West3<-gmap(select.area, type="satellite",rgb=TRUE,filename="SW3.tif")
> select.area <- drawExtent()
> South_West4<-gmap(select.area, type="satellite",rgb=TRUE,filename="SW4.tif")
>
> select.area <- drawExtent()
> South_East<-gmap(select.area, type="satellite",rgb=TRUE,filename="SE.tif")
> select.area <- drawExtent()
> South_East1<-gmap(select.area, type="satellite",rgb=TRUE,filename="SE1.tif")
> select.area <- drawExtent()
> South_East2<-gmap(select.area, type="satellite",rgb=TRUE,filename="SE2.tif")
> select.area <- drawExtent()
> South_East3<-gmap(select.area, type="satellite",rgb=TRUE,filename="SE3.tif")
> select.area <- drawExtent()
> South_East4<-gmap(select.area, type="satellite",rgb=TRUE,filename="SE4.tif")
> #######################################################################
5.1 High resolution Image acquisition with R 43
Therefore total number of other 16 tiles could be downloaded covering Kilimanjaro Map.
When each image plotted display a high resolution googlemap.
Note here that each map downloaded comes with three file types; the .gif file, .gfw file
and .prj file.
44 Digital Image Processing
The image downloaded in this format can be loaded to GIS softwares such as QGIS or
ARCGIS but can not be efficiently useful since is not in TIFF format. Therefore it required
to rewrite and save the image files as TIFF format as shown below.
5.2 Map projections with Q GIS
In order to define the map projection of the whole project. The main menu is useful as it is
required to Project>Project properties >CRS. But in order to deal with single directory of
raster data, select directory and CRS shown below;(Mtalo, 2016)
5.2 Map projections with Q GIS 45
After projecting all selected data, then all files are displayed in QGIS window.
In order to be able to perform processing of whole area at once it is then required to
merge all sixteen images of high resolution to a single image.
Go to Raster> Miscellaneous >Merge... as shown below;
Then select the files to be merged and name the output. in this project the output was
named as Merged-kilimanjaro.tif
46 Digital Image Processing
To add image data it is required to add layer through Layer> Add Layer> Add Raster
Layer then add your layer such asMerged-kilimanjaro.tif
Then it is displayed as a true color composite as shown below;
5.3 Image Pre-processing 47
5.3 Image Pre-processing
Pre processing refers to the preparation of data for subsequent analysis which employs;
-Correction of deficiencies
-Removal of flaws,
Image pre processing is essential for improving the quality of image as the basis for
later analyses that will extract information from the image. Satellite images such as Landsat
images need to be Pre-processed first before being analyzed.
5.4 Image Classifications with Q GIS
Image classification refers to the task of extracting information classes from a multiband raster
image. The resulting raster from image classification can be used to create thematic maps.
Depending on the interaction between the analyst and the computer during classification,
there are two types of classification: supervised and unsupervised.(Dorothea, 2016)
There are two main types of classification; supervised and unsupervised classification,both
are used in collecting endmembers, classifying previous rule images, calculating class
statistics and confusion matrices, applying majority and minority analysis to classification
images, clumping and sieving classes, combining classes, overlaying classes on grayscale
images, calculating buffer zone images, calculating segmentation images, and exporting
classes to vector layers.
48 Digital Image Processing
In this project supervised classification was used to cluster samples that determines land
cover of Kilimanjaro Region. Supervised classification is the process of using training data
samples to assign objects of unknown identity to one or more known features used to cluster
pixels in a dataset into classes corresponding to the user defined training classes(ROIs).
Steps Involved in Image Classification
5.4.1 Opening the SCP and select Working file
It is required to download SCP (Semi Automatic Classification plugin) if not installed, or just
loading it if present then display the false color composite as R=3, G=2. and B= of Selected
file. From the project, Merged-kilimanjaro.tif was loaded to SCP.
.
5.4.2 Creation of Shapefiles and ROIs
To create shape files of training samples followed by creating ROIs. It is advised to select
more features and training samples since better results depends on classified ROIs.
5.4 Image Classifications with Q GIS 49
5.4.3 Spectral Signature List plotting
After all ROIs have been loaded to signature list, it is then required to highlight all training
samples loaded in SCP classification and export them to signature list, then save the signature
list . Then after load selected samples to SCP spectral signature plot to evaluate Reflectance
and Standard Deviation of selected samples.
50 Digital Image Processing
5.4.4 Perform classification
There are many classification methods, but common are Parallelepiped, Minimum Distance,
Mahalanobis Distance, Maximum Likelihood, Spectral Angle Mapper, and Binary Encoding.
With context to this project Minimum likelihood was used. The minimum distance technique
uses the mean vectors of each endmember and calculates the Euclidean distance from each
unknown pixel to the mean vector for each class. All pixels are classified to the nearest class
unless a standard deviation or distance threshold is specified, in which case some pixels may
be unclassified if they do not meet the selected criteria. For technical details, see the following
reference: J.A.Richards, 1999,Remote Sensing Digital Image Analysis, Springer-Verlag,
Berlin, p. 240. During classifying Merged-Kilimanjaro. tif file, the classified file was served
as Kilimanjaro-Classified as shown below.
5.5 Post Classification 51
5.5 Post Classification
Post Classification is used to classify rule images, to calculate class statistics and confusion
matrices, to apply majority or minority analysis to a classification images, to clump, sieve,
and combine classes, to overlay classes on an image, to calculate buffer zone images, to
calculate segmentation images, and to output classes to vector layers.
5.5.1 Accuracy Assessment
It is required to use Confusion Matrix to show the accuracy of a classification result
by comparing a classification result with ground truth information. QGIS can calculate a
confusion matrix (contingency matrix) using either a ground truth image or using ground truth
regions of interest (ROIs). In each case, an overall accuracy, producer and user accuracies,
kappa coefficient, confusion matrix, and errors of commission and omission are reported.
5.6 GIS Modeler
A GIS Modeller is a special application development environment that supports the graphical
representation of the inputs, procedures and workflow required for the solution of a GIS anal-
ysis problem. Once the graphical model of the solution is fully specified it is then executed
to process the specified inputs and procedures according to the specified workflow.(Mtalo,
2016)
The graphical modeler are most useful since allows to create complex spatial analysis
models using a simple and easy to use interface no matter how many steps and different
algorithms it involves since a model is executed as a single algorithm
5.6.1 Image Processing by QGIS Processing Modeler
GIS Workflows typically involve many steps - with each step generating intermediate output
that is used by the next step. If you change the input data or want to tweak a parameter, you
will need to run through the entire process again manually. Fortunately, QGIS has a graphical
modeler built-in that can help you define your workflow and run it with a single invocation.
You can also run these workflows as a batch over a large number of inputs.(Mtalo, 2016)
Procedure for modeling with QGIS Graphical modeler
My workflow on this project started with loading of classified image ie.Kilimanjaro-
Classified as shown below.
52 Digital Image Processing
Then for Creating a model the following steps were used; Launch QGIS and go to
Processing Graphical Modeler, and since the Processing modeler dialog contains a left hand
panel and a main canvas. It was required to Select the Inputs tab in the left hand panel and
drag the + Raster layer to the canvas.
The alternative of that was to launch QGIS processing then open the Toolbox..., then
create a new model as shown below.
Apply a Majority Filter algorithm to the Input landcover raster (Kilimanjaro-Classified.tif).
This will reduce noise in our output by eliminating isolated pixels.
5.6 GIS Modeler 53
Then save the name of resulting Raster and Convert the resulting raster to a polygon layer
by using Polygonize function.Also set the output as vector-output .
Query for a class value from the attribute table of the polygon layer and create a vector
layer for that class as implemented below..
Next step is to assign a name and directory to a model and and save it.
54 Digital Image Processing
Then vectorize your classified image data using the created model by seting directory
as default to QGIS preferences to RUN, otherwise Extraction by attribute will not work
properly. Consider the image below;
Chapter 6
Spatial Object Analysis
6.1 Introduction to OSMAR
OSMAR is the short term of Open Street Maps And R. OpenStreetMap provides freely
accessible and editable geographic data. The osmar package smoothly integrates the Open-
StreetMap project into the R ecosystem. The osmar package provides infrastructure to access
OpenStreetMap data from different sources, to enable working with the OSM data in the
familiar R idiom, and to convert the data into objects based on classes provided by existing R
packages.
“OpenStreetMap creates and provides free geographic data such as street maps to anyone
who wants them” announces the OpenStreetMap wikipedia main page (OSM Foundation,
2011) – and since R users want free geographic data. Therefore, the add-on package
osmar (Schlesinger and Eugster, 2012) provides extensible infrastructure for integrating the
OpenStreetMap project (OSM) into the R project.(Eugster and Schlesinger, 2012)
The aim of the OpenStreetMap project is to create a free editable map of the world.
The project maintains a database of geographic elements (nodes, ways and relations) and
features (such as streets, buildings and landmarks). These data are collected and provided
by volunteers using GPS devices, aerial imagery, and local knowledge. The most prominent
application is the rendering of the geographic data and features into raster images (for
example, for the OSM map on the website). However, the project also provides an application
programming interface (API) for fetching raw data from and saving to the OSM database.
R implements a dialect of the S language that was developed by Rick Becker, John
Chambers and Allan Wilks. Versions of R are available, at no cost, for 32-bit versions of
Microsoft Windows for Linux, for Unix and for Macintosh OS X and it is available through
the Comprehensive R Archive Network (CRAN). R has extensive and powerful graphics
56 Spatial Object Analysis
abilities, that are tightly linked with its analytic abilities. The R system is developing rapidly
hence New features and abilities appear every few months.(Eugster and Schlesinger, 2012)
6.2 Data acquisition with OSM
OpenStreetMap data is licensed under the Open Data Commons Open Database License
(ODbL) and therefore is the free source of spatial data where as point , line and polygon data
are provided free.
To download free data is required to log into Open street map through https://www.openstreetmap.org
then extract extent of data to be downloaded through Export tool bar
QGIS also provides OSM plugin which allow downloading of open street maps directly
from https://www.openstreetmap.org through opening of Web services. Open Layer Plugin
provides function for downloading Google maps, open street maps for spatial data analysis.
The diagram below illustrates how QGIS supports OSM data acquisition.
6.2 Data acquisition with OSM 57
Downloading of Spatial data in OSM depends on the selected boundaries. for example
Kilimanjaro region is covered between extents of 2.7 to 4.7 latitude south of Equator and
36.5 to 38.5 longitude east of the Greenwich. OSM data can be downloaded as database
of given extent or locality. For example Kilimanjaro map was downloaded in both two
methods with open street map plugin as shown on the figure below.
58 Spatial Object Analysis
6.3 Handling Spatial Data Frame in QGIS
A data frame is the most common way of storing data in R and QGIS, and if used system-
atically makes data analysis easier. Under the hood, a data frame is a list of equal-length
vectors. This makes it a two dimensional structure, so it shares properties of both the matrix
and the list. This means that a data frame has names(), colnames(), and rownames(), although
names() and colnames() are the same thing. The length() of a data frame is the length of the
underlying list and so is the same as ncol(); nrow() gives the number of rows.
From the case study area, Kilimanjaro OSM data were loaded to QGIS so as to en-
able editing or removing of unwanted Spatial data frames. As shown on the figure below ,
downloaded OSM data contained points, lines and polygons outside the boundary of Kili-
manjaro. Therefore it was necessary to clip the image and select only data within boundary
of Kilimanjaro.
Vector tool-bar was used to process the data.For example Geo-processing tools was
employed to remove unwanted data in the project as shown on the diagram below.
6.3 Handling Spatial Data Frame in QGIS 59
Then it was required to isolate the shape files so as to determine points, polygons and
lines independently and save their shape files in specified folders
The new shape files was then loaded to QGIS to enable further editing of attribute tables
by employing digitization tools. For example editing of lines could be shown as a sample in
figure below.
60 Spatial Object Analysis
After editing of all attribute table the cropped image could then appear as shown be-
low.Then the output could be then loaded to R for further analysis.
6.4 Handling Spatial Data in R 61
6.4 Handling Spatial Data in R
The analysis of spatial data is usually undertaken to make inferences, that is to try to draw
conclusions about a hypothesised data generating process or to use an estimated process
to predict values at locations for which observations are unavailable. In some cases, the
conclusions are sufficient in themselves, and in others, they are carried through to other
hierarchical layers in the model under scrutiny.(Bivand et al., 2008)
For spatial data analysis in R the following
62 Spatial Object Analysis
6.5 Loading or Attaching of Datasets in R
Bibliography
Bivand, R. S., Gomez-Rubio, V., and Pebesma, E. J. (2008). Applied Spatial Data Analysis
with R. Number ISBN 978-0-387-78170-9. Springer.
Dorothea, D. (2016). Spatial data analysis and image processing. University of Bagamoyo
Faculty of Built Environment (FBE).
ENVI (2004). ENVI Users Guide, volume ENVI Version 4.1. Research System Inc (RSI),
2004 edition edition.
Eugster, M. J. A. and Schlesinger, T. (2012). osmar: Openstreetmap and r. The R Journal
CONTRIBUTED RESEARCH ARTICLES, 5(ISSN 2073-4859):53–63.
Konadu, D. D. and Fosu, C. (2009). Appropriate Technologies For Environmental Protection
In The Developing World. Springer.
Mtalo, E. G. (2016). Mathematical softwere aids and advanced gis applications in spatial data
analysis. University of Bagamoyo College of Science Informatics and Built Environment.
Spatial_Data_Analysis_with_open_source_softwares[1]

More Related Content

Viewers also liked

Implementation and Systemic Change with UTTIPEC Street Design Guidelines
Implementation and Systemic Change with  UTTIPEC Street Design GuidelinesImplementation and Systemic Change with  UTTIPEC Street Design Guidelines
Implementation and Systemic Change with UTTIPEC Street Design Guidelines
Uttipec Dda
 
Development plane of urban transportation in Malaysia
Development plane of urban transportation in MalaysiaDevelopment plane of urban transportation in Malaysia
Development plane of urban transportation in Malaysia
engrasha
 
How Does Transportation and Network Planning Address Network Planning Address...
How Does Transportation and Network Planning Address Network Planning Address...How Does Transportation and Network Planning Address Network Planning Address...
How Does Transportation and Network Planning Address Network Planning Address...
Congress for the New Urbanism
 
Creating a Complete Street Active Transportation Network - Marita Roos
Creating a Complete Street Active Transportation Network - Marita RoosCreating a Complete Street Active Transportation Network - Marita Roos
Creating a Complete Street Active Transportation Network - Marita Roos
BikeTexas
 
NACTO Urban Street Design Guide
NACTO Urban Street Design GuideNACTO Urban Street Design Guide
NACTO Urban Street Design Guide
Jesse Budlong
 
Creating a Complete Street Active Transportation Network - Mark Goode III
Creating a Complete Street Active Transportation Network - Mark Goode IIICreating a Complete Street Active Transportation Network - Mark Goode III
Creating a Complete Street Active Transportation Network - Mark Goode III
BikeTexas
 
Street Design guidelines UTTIPEC 2011-printer-friendly
Street Design guidelines UTTIPEC 2011-printer-friendlyStreet Design guidelines UTTIPEC 2011-printer-friendly
Street Design guidelines UTTIPEC 2011-printer-friendly
uttipecDRAFT
 
Syllabus of Traffic Engineering
Syllabus of Traffic EngineeringSyllabus of Traffic Engineering
Syllabus of Traffic Engineering
mhawarey
 

Viewers also liked (20)

Диего Депонте "Городские транспортные центры. От транспортных узлов к городск...
Диего Депонте "Городские транспортные центры. От транспортных узлов к городск...Диего Депонте "Городские транспортные центры. От транспортных узлов к городск...
Диего Депонте "Городские транспортные центры. От транспортных узлов к городск...
 
Street Design Guidelines
Street  Design  GuidelinesStreet  Design  Guidelines
Street Design Guidelines
 
Transportation Ecoefficiency: Quantitative Measurement of Urban Transportatio...
Transportation Ecoefficiency: Quantitative Measurement of Urban Transportatio...Transportation Ecoefficiency: Quantitative Measurement of Urban Transportatio...
Transportation Ecoefficiency: Quantitative Measurement of Urban Transportatio...
 
[Urban transportation policy program]city paper presentation cuenca
[Urban transportation policy program]city paper presentation cuenca[Urban transportation policy program]city paper presentation cuenca
[Urban transportation policy program]city paper presentation cuenca
 
Implementation and Systemic Change with UTTIPEC Street Design Guidelines
Implementation and Systemic Change with  UTTIPEC Street Design GuidelinesImplementation and Systemic Change with  UTTIPEC Street Design Guidelines
Implementation and Systemic Change with UTTIPEC Street Design Guidelines
 
Designing Transportation Systems
Designing Transportation SystemsDesigning Transportation Systems
Designing Transportation Systems
 
Beyond Traffic: US DOT's 30 Year Framework for the Future
Beyond Traffic: US DOT's 30 Year Framework for the FutureBeyond Traffic: US DOT's 30 Year Framework for the Future
Beyond Traffic: US DOT's 30 Year Framework for the Future
 
Development plane of urban transportation in Malaysia
Development plane of urban transportation in MalaysiaDevelopment plane of urban transportation in Malaysia
Development plane of urban transportation in Malaysia
 
How Does Transportation and Network Planning Address Network Planning Address...
How Does Transportation and Network Planning Address Network Planning Address...How Does Transportation and Network Planning Address Network Planning Address...
How Does Transportation and Network Planning Address Network Planning Address...
 
How Placemaking Can Transform Transit Facilities into Vibrant Destinations--...
	How Placemaking Can Transform Transit Facilities into Vibrant Destinations--...	How Placemaking Can Transform Transit Facilities into Vibrant Destinations--...
How Placemaking Can Transform Transit Facilities into Vibrant Destinations--...
 
[Urban transportation policy program]city paper presentation sebrang perai
[Urban transportation policy program]city paper presentation sebrang perai[Urban transportation policy program]city paper presentation sebrang perai
[Urban transportation policy program]city paper presentation sebrang perai
 
Creating a Complete Street Active Transportation Network - Marita Roos
Creating a Complete Street Active Transportation Network - Marita RoosCreating a Complete Street Active Transportation Network - Marita Roos
Creating a Complete Street Active Transportation Network - Marita Roos
 
NACTO Urban Street Design Guide
NACTO Urban Street Design GuideNACTO Urban Street Design Guide
NACTO Urban Street Design Guide
 
Creating a Complete Street Active Transportation Network - Mark Goode III
Creating a Complete Street Active Transportation Network - Mark Goode IIICreating a Complete Street Active Transportation Network - Mark Goode III
Creating a Complete Street Active Transportation Network - Mark Goode III
 
Smart Algorithms for Public Transport
Smart Algorithms for Public TransportSmart Algorithms for Public Transport
Smart Algorithms for Public Transport
 
Public Transit + Active Transportation: A network greater than the sum of its...
Public Transit + Active Transportation: A network greater than the sum of its...Public Transit + Active Transportation: A network greater than the sum of its...
Public Transit + Active Transportation: A network greater than the sum of its...
 
Complete Street Design Guideline: Chicago
Complete Street Design Guideline: ChicagoComplete Street Design Guideline: Chicago
Complete Street Design Guideline: Chicago
 
Street Design guidelines UTTIPEC 2011-printer-friendly
Street Design guidelines UTTIPEC 2011-printer-friendlyStreet Design guidelines UTTIPEC 2011-printer-friendly
Street Design guidelines UTTIPEC 2011-printer-friendly
 
Syllabus of Traffic Engineering
Syllabus of Traffic EngineeringSyllabus of Traffic Engineering
Syllabus of Traffic Engineering
 
Improving Street Design Through 'Link and Place'
Improving Street Design Through 'Link and Place'Improving Street Design Through 'Link and Place'
Improving Street Design Through 'Link and Place'
 

Similar to Spatial_Data_Analysis_with_open_source_softwares[1]

disertation_Pavel_Prochazka_A1
disertation_Pavel_Prochazka_A1disertation_Pavel_Prochazka_A1
disertation_Pavel_Prochazka_A1
Pavel Prochazka
 
QBD_1464843125535 - Copy
QBD_1464843125535 - CopyQBD_1464843125535 - Copy
QBD_1464843125535 - Copy
Bhavesh Jangale
 
ubc_2014_spring_dewancker_ian (9)
ubc_2014_spring_dewancker_ian (9)ubc_2014_spring_dewancker_ian (9)
ubc_2014_spring_dewancker_ian (9)
Ian Dewancker
 
Au anthea-ws-201011-ma sc-thesis
Au anthea-ws-201011-ma sc-thesisAu anthea-ws-201011-ma sc-thesis
Au anthea-ws-201011-ma sc-thesis
evegod
 

Similar to Spatial_Data_Analysis_with_open_source_softwares[1] (20)

thesis.compressed
thesis.compressedthesis.compressed
thesis.compressed
 
eur22904en.pdf
eur22904en.pdfeur22904en.pdf
eur22904en.pdf
 
Dt
DtDt
Dt
 
MSc_Thesis
MSc_ThesisMSc_Thesis
MSc_Thesis
 
MSc_Thesis
MSc_ThesisMSc_Thesis
MSc_Thesis
 
Data mining of massive datasets
Data mining of massive datasetsData mining of massive datasets
Data mining of massive datasets
 
Examensarbete
ExamensarbeteExamensarbete
Examensarbete
 
Mining of massive datasets
Mining of massive datasetsMining of massive datasets
Mining of massive datasets
 
btpreport
btpreportbtpreport
btpreport
 
Im-ception - An exploration into facial PAD through the use of fine tuning de...
Im-ception - An exploration into facial PAD through the use of fine tuning de...Im-ception - An exploration into facial PAD through the use of fine tuning de...
Im-ception - An exploration into facial PAD through the use of fine tuning de...
 
disertation_Pavel_Prochazka_A1
disertation_Pavel_Prochazka_A1disertation_Pavel_Prochazka_A1
disertation_Pavel_Prochazka_A1
 
QBD_1464843125535 - Copy
QBD_1464843125535 - CopyQBD_1464843125535 - Copy
QBD_1464843125535 - Copy
 
Thesis_Prakash
Thesis_PrakashThesis_Prakash
Thesis_Prakash
 
Master's Thesis
Master's ThesisMaster's Thesis
Master's Thesis
 
ubc_2014_spring_dewancker_ian (9)
ubc_2014_spring_dewancker_ian (9)ubc_2014_spring_dewancker_ian (9)
ubc_2014_spring_dewancker_ian (9)
 
Bike sharing android application
Bike sharing android applicationBike sharing android application
Bike sharing android application
 
Honours_Thesis2015_final
Honours_Thesis2015_finalHonours_Thesis2015_final
Honours_Thesis2015_final
 
Grl book
Grl bookGrl book
Grl book
 
Au anthea-ws-201011-ma sc-thesis
Au anthea-ws-201011-ma sc-thesisAu anthea-ws-201011-ma sc-thesis
Au anthea-ws-201011-ma sc-thesis
 
T401
T401T401
T401
 

Spatial_Data_Analysis_with_open_source_softwares[1]

  • 1. UNIVERSITY OF BAGAMOYO COLLEGE OF SCIENCE, INFORMATICS AND BUILT ENVIONMENT Bachelor of Science in Geoinformatics MATHEMATICAL APPROACHES AND ADVANCED GIS APPLICATION FOR SPATIAL DATA ANALYSIS Spatial Data Analysis with Open Source Softwares AREA OF STUDY;KILIMANJARO REGION Author: Joachim Nkende Yohana Registration No: UB010/0053/14
  • 2.
  • 3. COLLEGE OF SCIENCE, INFORMATICS AND BUILT ENVIRONMENT SPATIAL DATA ANALYSIS WITH Open Source Softwares Author: Nkende J. Y Supervisor: Dr Mtalo E. G
  • 4.
  • 5. Acknowledgements With high gratitude i would like to thank Hon. Prof. Costa Rick Mahalu, University of Bagamoyo Vice Chancellor for his Ethical and Principled governance, centered in develop- ment and assistance toward youths dreams. In malt-dimensional ways he have been my pillar toward Academic success in my studies I express my deep gratitude to Dr. Elifuraha Gerard Mtalo - PHD, M.Sc.Eng,M.Sc Civil Eng, Dean of Faculty,Faculty of Informatics and Built Environment for providing me with guidance and encouragement within whole days of my studies. Never the less, we wish to thank him much with all my heart for his both academic and financial support in the whole semester basically on R software Applications. I thank very much Dr. Deus Dorothea, She have assisted me so much on expansion of my skills and knowledge toward GIS and Spatial data Analysis, It have been easy for me to continue with Spatial Data Analysis basing on open source softwares like Q GIS and R software from basic knowledge of ArcGIS (ArcMap10) Also I would like to acknowledge made by Mr.Msaki Masawe, The Photogrammetry department administrator at the Ministry of Land , Survey and Mapping Division for his basic knowledge to aerial photogrammetry and close range photogrammetry. From his basic idea and techniques , it made easy for me to deal with huge data covering a region, Country or a Continent in Spatial data analysis Last but not least, Its our genuine pleasure to express my deep sense of gratitude to all Lectures and classmates forming the Geoinformatics Department in our Campus for their advice and assistance toward accomplishment of this project.
  • 6.
  • 7. Abstract This project aims at providing basic introduction to spatial data concepts and statistical approaches in data Visualization, Spatial data analysis and Modeling with the use of R . Spatial data arise in almost every field of study as Spatial data are everywhere. Usefulness of Spatial data is observed in geographic mapping of land cover, Urban transportation networks, meteorological measurements from weather stations, demographics from the census, and incidence of disease over a particular geographic area. However this project explains the main idea of what is, where do we get and when we can acquire a spatial data. What are the basic types of spatial data and their relationships. The context of R software in Spatial Data Analysis and the existing relationships between R and GIS It further looks on the fundamental Applied Spatial Data Analysis in context to Spatial objects, Spatial points , Spatial Lines and Spatial polygons in relations to their Data frames. Never the less This project provides spatial data analysis with focused idea in Spatial point pattern analysis, Interpolation and Geostatistics, estimation of Spatial correlation and variogram modeling and prediction of Spatial data through simple and Universal Kriging , Local neighborhood and Spatial neighborhood. Last but not least is applied Spatial data modeling which involves the use of mathematical concepts and principles to model real world objects and phenomena. Regarding to this Project Kilimanjaro Region have been used as source of data. Therefore this project describes the classes and methods of the sp package, and in doing so also provides a practical guide to the internal structure of many GIS data models, as R permits the user to get as close as desired to the data.
  • 8.
  • 9. Table of contents 1 Introduction 1 1.1 Spatial Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.1.1 What means by the term Spatial . . . . . . . . . . . . . . . . . . . 1 1.1.2 Geographic phenomenon . . . . . . . . . . . . . . . . . . . . . . . 1 1.1.3 Spatial Data Models/ Structures . . . . . . . . . . . . . . . . . . . 2 1.2 What is R . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.2.1 Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.2.2 Why R ? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.2.3 Relationship between R and GIS . . . . . . . . . . . . . . . . . . . 3 1.3 Applied Spatial Data Analysis . . . . . . . . . . . . . . . . . . . . . . . . 4 2 Spatial Reference System 5 2.1 Basic Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2.1.1 What is Reference System . . . . . . . . . . . . . . . . . . . . . . 5 2.1.2 Spatial/Coordinate Reference System . . . . . . . . . . . . . . . . 5 2.1.3 Why CRS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 2.1.4 Objectives of CRS . . . . . . . . . . . . . . . . . . . . . . . . . . 6 2.2 Types of CRS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2.2.1 Geographic Coordinate Reference System . . . . . . . . . . . . . 7 2.2.2 Projected Coordinate Reference System . . . . . . . . . . . . . . . 7 2.3 EPSG code and Projection.4 CRS in R . . . . . . . . . . . . . . . . . . . 9 2.3.1 UTM: Universal Transverse Mercator . . . . . . . . . . . . . . . . 9 2.4 EPSG code and Projection.4 CRS in R . . . . . . . . . . . . . . . . . . . 9 2.5 Setting the Map to UTM Arc 1960 Datum . . . . . . . . . . . . . . . . . . 11 2.6 Map projections with Q GIS . . . . . . . . . . . . . . . . . . . . . . . . . 14 3 Methodology 15 3.1 R packages to be used in the project . . . . . . . . . . . . . . . . . . . . . 15
  • 10. viii Table of contents 3.2 Introduction to Spatial objects . . . . . . . . . . . . . . . . . . . . . . . . 16 3.3 Points Pattern . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 3.4 Spatial Point Data Creation, Loading and Processing in R . . . . . . . . . . 19 3.4.1 Point data creation . . . . . . . . . . . . . . . . . . . . . . . . . . 20 3.4.2 Klm File Processing . . . . . . . . . . . . . . . . . . . . . . . . . 20 3.4.3 Loading a Coordinate list in R . . . . . . . . . . . . . . . . . . . . 21 3.4.4 3D Visualizarion of point data . . . . . . . . . . . . . . . . . . . . 23 3.5 Line data , and Polygon Formation with Script in R . . . . . . . . . . . . . 25 4 Introduction to Spatial Data Modeling 29 4.1 Basic Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 4.1.1 Realms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 4.1.2 Spatial Databases . . . . . . . . . . . . . . . . . . . . . . . . . . 30 4.2 Modeling of Vector data in QGIS . . . . . . . . . . . . . . . . . . . . . . 30 4.3 Modeling of Kilimanjaro Mountain in QGIS . . . . . . . . . . . . . . . . 31 5 Digital Image Processing 39 5.1 High resolution Image acquisition with R . . . . . . . . . . . . . . . . . . 40 5.2 Map projections with Q GIS . . . . . . . . . . . . . . . . . . . . . . . . . 44 5.3 Image Pre-processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 5.4 Image Classifications with Q GIS . . . . . . . . . . . . . . . . . . . . . . . 47 5.4.1 Opening the SCP and select Working file . . . . . . . . . . . . . . 48 5.4.2 Creation of Shapefiles and ROIs . . . . . . . . . . . . . . . . . . . 48 5.4.3 Spectral Signature List plotting . . . . . . . . . . . . . . . . . . . 49 5.4.4 Perform classification . . . . . . . . . . . . . . . . . . . . . . . . . 50 5.5 Post Classification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 5.5.1 Accuracy Assessment . . . . . . . . . . . . . . . . . . . . . . . . 51 5.6 GIS Modeler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 5.6.1 Image Processing by QGIS Processing Modeler . . . . . . . . . . . 51 6 Spatial Object Analysis 55 6.1 Introduction to OSMAR . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 6.2 Data acquisition with OSM . . . . . . . . . . . . . . . . . . . . . . . . . . 56 6.3 Handling Spatial Data Frame in QGIS . . . . . . . . . . . . . . . . . . . . 58 6.4 Handling Spatial Data in R . . . . . . . . . . . . . . . . . . . . . . . . . . 61 6.5 Loading or Attaching of Datasets in R . . . . . . . . . . . . . . . . . . . . 62
  • 11. Table of contents ix Bibliography 63
  • 12. x Table of contents Preface Geoinformatics is the science and art of processing and managing spatial information and data and extracting policy, planning and decision making information for sustainable resource and environmental management. Geoinformation includes temporal information and data that is spatially or geographically referenced. The Geoinformatics programs are designed to equip students with the scientific founda- tion required to master the technical and professional requirements for modern spatial data acquisition, data processing and transformation, data management, data analysis and model- ing, information extraction and presentation/visualisation using the latest computer/electronic hardware, methods, and software systems. Therefore graduates of this program should be able to integrate spatial and non-spatial (attribute data) from a diversity of sources ranging from earth-orbiting satellites, air and sea-borne remote sensors, ground-based surveying instruments and social economic surveys and use relevant hardware and software systems to support operational requirements at the workplace as an individual or part of a professional team The General Objectives of this project is to implement the key objectives considered in establishment of Geoinformation technology, Geographic Information Systems, Remote Sensing, Environmental management, Surveying and Geomatics by imparting theoretical and practical knowledge in: 1. Spatial data acquisition, data processing, data management, information extraction and and presentation for governance (i.e. policy development, development planning, development monitoring and decisionmaking) in a wide range of human undertakings and professional fields. 2. Problem analysis and structuring for purposes of designing effective solutions using remote sensing, geographic information science, database technology, spatial/temporal modeling and software development principles. 3. Geographic Information Systems development and effective application to the solution of key developmental problems. 4. Geospatial information for governance, civil society and environmental sustainability
  • 13. Chapter 1 Introduction 1.1 Spatial Data 1.1.1 What means by the term Spatial The term Spatial means each item of data has a geographical reference so we know where each case occurs on a map. Spatial data refers to any Geographic phenomena whether seen or unseen with our naked eyes, existing in the real world, For example Temperature, elevation and spatial objects.(Dorothea, 2016) 1.1.2 Geographic phenomenon A geographical phenomenon is an entity or process of interest that can be named or de- scribed, can be georeferenced (it has a geographical position in the real world), can be assigned a name and occurs at a specific time. There are two groups of geographic phenomena, which are fields and objects: Geographic objects: are well-distinguished, discrete, and bounded entities, not present everywhere in the study area as they do not cover the total study area. The space between them is empty or undetermined. Some typical examples of fields are temperature, barometric pressure and elevation. Geographic field: are geographic phenomenon from which, for every point in the study area, a value can be determined. There are two types of geographic fields; continuous fields and discrete fields:
  • 14. 2 Introduction In a continuous field, the underlying function is assumed to be continuous. Continuity means that all changes in field values are gradual (for example elevation). Discrete fields cut up the study space in mutually exclusive bounded parts, with all locations in one part having the same field value (for example soil types). However Typical examples are land classifications, geological classes, soil types, land use types, crop type or natural vegetation types. Objects are discrete and bounded entities and the space between the objects is potentially ‘empty’ or ‘undetermined’, however the space is not really empty, as it may contain roads, gardens which in fact are not houses or buildings. The position of an object in space is determined by a combination of one or more of the following parameters; Location (where is it?) Shape (what form?) Size (how big?) Orientation (which direction?) 1.1.3 Spatial Data Models/ Structures A Model is a miniature representation of an object OR is a representation of a real world object at reduced scale, it can be either physical, descriptive or abstract (e.g. in mathematical form,) Data are raw facts, concepts or instructions in formalized manner, suitable for commu- nication, interpretation or processing by human (manually) or automated means. A Data Model is an organization or Structure/System of storing data in a computer. A Data Model being a structure for holding data it defines rules and/or limitations the relevant stored data have to obey as well as manipulation functions, which can be applied on data sets.The spatial data models include Point data, line data, area and continuous data. 1. Point: eg. wells, street lamps, addresses 2. Line: eg. roads, transmission lines, streams 3. Area: eg. land use, parcels 4. Continuous: eg elevation, rainfall, ocean salinity
  • 15. 1.2 What is R 3 1.2 What is R 1.2.1 Definitions R is a language and environment for statistical computing and graphics which provides a wide variety of statistical as linear and nonlinear modeling, classical statistical tests, time-series analysis, classification, clustering, and graphical techniques, and is highly extensible. In other way R can be defined as an integrated suite of software facilities which support data manipulation, calculation and graphical display developed by John Chambers et al.(Bivand et al., 2008) 1.2.2 Why R ? R aims at facilitating; • An effective data handling and storage facility, • A suite of operators for calculations on arrays, in particular matrices, • A large, coherent, integrated collection of intermediate tools for data analysis, • Graphical facilities for data analysis and display either on-screen or on hardcopy, and • A well-developed, simple and effective programming language which includes conditionals, loops, user-defined recursive functions and input and output facilities. Also R has its own LaTeX-like documentation format, which is used to supply comprehensive documentation, both on-line in a number of formats and in hard copy. 1.2.3 Relationship between R and GIS GIS is a computer system capable of capturing, storing, analyzing, and displaying geographi- cally referenced data in digital form.The data in a GIS is inherently spatially referenced. In other words, each object found in a GIS can be related to some location and can be mapped. The objects in a GIS are defined by their location and often by multiple attributes that further describe the characteristics of objects. Since GIS as a ’tool’ for capturing, storing, analyzing, and displaying which operates under toolbox-centered architectures like Arc/Info™ or ArcGIS™ applications and now is moving to towards service-centered architectures such as Google Earth. Therefore increasing availability and bandwidth of the Internet, and also ownership and maintenance of data and/or analysis methods lead to growth of the R system since it also operates well under both toolbox-centered and service-centered architectures.
  • 16. 4 Introduction 1.3 Applied Spatial Data Analysis Applied Spatial Analysis is the broad term explaining on how to disseminate the knowledge and skills which enable the community to accurately measure and collect information about the earths surface using a combination of technologies ranging from ground-based sensors, airborne sensors and space borne sensors, how to develop and utilize remote sensing systems and geographic information system for studying the environment, monitoring and analyzing earth resources. Not only that but also to analyze specific sector problems and design practical solutions through the use cartographic and geo-visualization techniques. This is implemented through creation of effective maps and 3D visualizations which support planning and decision making. Applying of geo-spatial science techniques in the application fields of land governance, environmental management, disaster management, natural resources management, and urban and regional planning. through spatial-temporal analysis and modeling techniques, spatial decision support, systems design and application which are essential in designing optimum geographic information system solutions used for selecting application areas. Last but not least , is developing solutions to complex problems using database , Ge- ographic Information Science techniques and Geoinformatics technology for predicting, monitoring and mitigating environmental disasters, land administration and management problems, natural resources management problems, mineral resources management and to build decision support systems for governance and environmental management.
  • 17. Chapter 2 Spatial Reference System 2.1 Basic Concepts 2.1.1 What is Reference System It is a complete conceptual definition of how coordinate system is formed. It defines the origin and the orientation of the fundamental planes or axes of the system. It also includes the fundamental mathematical and physical models. Therefore both vectors and raster must be expressed in a uniform coordinate system. The definition of a 3-D Cartesian system requires a convention for the orientation of the axes and the location of the origin.(Bivand et al., 2008) However Spatial data vary a great deal both in the ways in which their position attributes are recorded and in the adequacy of documentation of how position has been determined. This applies both to data acquired from secondary sources and to Global Positioning System input, or data capture from analogue maps by digitizing.(Mtalo, 2016) 2.1.2 Spatial/Coordinate Reference System A spatial reference system (SRS) or coordinate reference system (CRS) is a coordinate-based local, regional or global system used to locate geographical entities. A spatial reference system defines a specific map projection, as well as transformations between different spatial reference systems. Spatial reference systems can be referred to the use of a Spatial Reference System Identifier (SRID) such as the European Petroleum Survey Group (EPSG) which is maintained by the International Association of Oil and Gas Producers (OGP) Surveying and Positioning Committee.
  • 18. 6 Spatial Reference System EPSG: 21035S, EPSG: 21037S and EPSG:21036S are the three CRS that cover Eastern and Western Tanzania respectively. The figure below shows European Petroleum Survey Group (EPSG) covering Tanzania(Mtalo, 2016) 2.1.3 Why CRS Coordinate reference systems (CRS) are at the heart of geodetics and cartography: how to represent a bumpy ellipsoid on the plane. We can speak of geographical CRS expressed in degrees and associated with an ellipse – a model of the shape of the earth, a prime meridian defining the origin in longitude, and a datum. The concept of a datum is arbitrary and anchors a specific geographical CRS to an origin point in three dimensions, including an assumed height above the assumed centre of the earth or above a standard measure of sea level. Since most of these quantities have only been subject to accurate measurement since the use of satellites for surveying became common, changes in ellipse and datum characteristics between legacy maps and newly collected data are common. 2.1.4 Objectives of CRS • Satisfy the need to answer the questions: Where am I (at some instant in time)? What is the location of some object or someone else? In absolute terms or in relative terms and at varying accuracies • For the military: Missile launch sites, precision weapons and targets Landmines Battlespace coordination
  • 19. 2.2 Types of CRS 7 • For the general civilian population: International borders Car, ship or plane navigation Mineral resources • For the scientific community: Crustal motion Sea level change Satellite orbits 2.2 Types of CRS Coordinate Reference Systems is composed of both Geographic Coordinate Reference System and Projected Coordinate Reference System 2.2.1 Geographic Coordinate Reference System Geographic Coordinate Reference System is a set of longitudes and latitudes based on the mechanism that; longitudes running from north to south pole with central meridian(0 degree) through Greenwich from which the Eastern longitudes are positive (East of Greenwich) and Western longitudes are negative (West of Greenwich). Also set of latitudes which are parallel circles created by slicing the Earth by planes parallel to the Equator with Equator at latitude 0 degree. Northern latitudes are positive (North of Equator) while Southern latitudes are negative (South of Equator) (Mtalo, 2016) Kilimanjaro region latitudes are negative since the northern-most boundary is 2.7 degree south of Equator and 36.5 East of Greenwich meridian 2.2.2 Projected Coordinate Reference System Map projection refers to a projection of the globe onto a flat map/surface using a grid of lines of latitude and longitude.
  • 20. 8 Spatial Reference System Types of Map Projection 1. Cylindrical: In standard presentation, these map regularly-spaced meridians to equally spaced vertical lines, and parallels to horizontal lines. 2. Conic: In standard presentation, conic (or conical) projections map meridians as straight lines, and parallels as arcs of circles. 3. Azimuthal: map meridians as straight lines and parallels as complete, concentric circle; radially symmetrical and they preserve directions from the center point. Transverse Mercator Projection Transverse Mercator projections result from projecting the sphere onto a cylinder tangent to a central meridian. Transverse Mercator maps are often used to portray areas with larger north-south than east-west extent. Distortion of scale, distance, direction and area increase away from the central meridian. Many national grid systems including that of Tanzania and EA are based on the Transverse Mercator projection.
  • 21. 2.3 EPSG code and Projection.4 CRS in R 9 2.3 EPSG code and Projection.4 CRS in R 2.3.1 UTM: Universal Transverse Mercator The Universal Transverse Mercator (UTM) projection is used to define horizontal, positions world-wide by dividing the surface of the Earth into 6 degree zones, each mapped by the Transverse Mercator projection with a central meridian in the center of the zone. UTM zone numbers designate 6 degree longitudinal strips extending from 80 degrees South latitude to 84 degrees North latitude. UTM zone characters designate 8 degree zones extending north and south from the equator. Tanzania is covered by UTM Zone characters M and L(Mtalo, 2016) 2.4 EPSG code and Projection.4 CRS in R EPSG is provided in the rgdal package so as to permit the conversion of a large number of CRS into the PROJ.4 style as it allows for datum transformation and projection, as the number of different coordinate reference systems is larger than that in the mapproj package. Datum transformation is based on transformation to the World Geodetic System of 1984 (WGS84), or inverse transformation from it to an alternative specified datum. WGS84 was introduced after measurements of earth from space had become very accurate, and forms a framework into which local an national systems may be fitted For the case of My field locality, Kilimanjaro is covered by EPSG: 21037S. The tables on the figure below identifies how does EPSG code relate to the projection prj4 .(Mtalo, 2016)
  • 22. 10 Spatial Reference System Generally, it is possible also to use a note to specify local data frames. For example Arc 1960 the note on the following table are valid.
  • 23. 2.5 Setting the Map to UTM Arc 1960 Datum 11 2.5 Setting the Map to UTM Arc 1960 Datum To set the downloaded Map to UTM Arc 1960 Datum first extract from the Tanzania Image The area falling in Zone 37S and Zone 36S respectively Then with plot function you can now crop for required area
  • 25. 2.5 Setting the Map to UTM Arc 1960 Datum 13
  • 26. 14 Spatial Reference System 2.6 Map projections with Q GIS The PROJ.4 library uses a ‘tag=value’ representation of coordinate reference systems, with the tag and value pairs enclosed in a single character string.The Following strings represent the proj4 specifications for UTM Zone 36S / WGIS 84 and UTM zone 36S / Arc 1960 respectively from QGIS +proj=utm +zone=36 +south +ellps=WGS84 +units=m +no defs +proj=utm +zone=36 +south +ellps=clrk80 +towgs84=-160,-6,- 302,0,0,0,0 +units=m +no defs
  • 27. Chapter 3 Methodology The project is driven by the software used to process , visualize and Analyze spatial data. With this project Google Earth, TCX converter and R-Statistics software are useful in data processing and visualization of spatial objects. Processing of Raster data is done with QGIS software in Chapter five. 3.1 R packages to be used in the project Kilimanjaro project aims at evaluation of the DEM (Digital Elevation model) of the mountain. The useful packages was determined by the range of activities to be involved in the project. The packages depends on; 1. A specified operation to be solved by such package 2. Source of data such as Vector data or Raster data 3. Environment from which data works whether spatial or not. 4. Utilities needed for the project to be well processed, visualized and analyzed
  • 28. 16 Methodology Regarding to Kilimanjaro project ,useful packages were: Packages Functions library(sp) Classes for spatial data library(raterVis) lattice, latticeExtra and RColorBrewer packages library(maptools) Map creation functions library(raster) raster, grids library(rgdal) Geospatial Data Abstraction Library library(rgeos) Spatial data relationships and operators library(XML) loads required namespace in gmap library(dismo) Species distribution modeling library(foreign) loading google maps library(plotly) Plotting 3D of spatial objects library(geoR) Map analysis library(osmar) Downloading spatial points library(datasets) A package containing datasets library(GISTools) Mapping and spatial data manipulation tools library(rgl) 3D Visualization library(spdep) evaluation of spatial pattern and autocorrelation library(RgoogleMaps) Querying google saver for statistic maps library(spatstat) analysing spatial data 3.2 Introduction to Spatial objects Spatial objects are well-distinguished, discrete, and bounded entities, not present every- where in the study area as they do not cover the total study area. The space between them is empty or undetermined.(Dorothea, 2016)
  • 29. 3.3 Points Pattern 17 One spatial object is represented by a tuple within a table, and a table contains only objects of the same type (set of points, set of lines, etc. for example, buildings and roads. Spatial objects are presented in space as simplexes defining the space presentation as 0 simplex defining zero dimension, 1 simplex defining line , 2 simplex surface area and 3 simplex defining a three dimension object such as a cube or pyramid.Mtalo (2016) 1D Space the space associated with a straight line. Mathematically definable by adoption of an origin O(0) and a direction (reference line through the origin). Object location P(x) reckoned as distance x from the origin along the reference line. It supports only 1D coordinate geometry. 2D space Space associated with a flat plane. Mathematically definable by adoption of an orign O(0,0), an initial direction (1st reference line) and another direction(2nd reference direction) normal to the first reference line. Object location P(x,y) reckoned as the object distances (x, y) measured normal to the two reference lines. It supports 2D coordinate geometry. 3D Space Space associated with a cube or a box. Mathematically definable by adoption of an origin, two reference lines perpendicular to each other through the origin and a third reference line through the origin perpendicular to the plane containing the two initial reference lines. Object location P(x,y,z) reckoned as the object distances (x, y,z) measured normal to the three reference lines. It supports 3D coordinate geometry Mtalo (2016) 3.3 Points Pattern A Spatial Point is a single point with unique location describing its position in term of georeferenced Data frame. A spatial point data of a place can be determined either by ground based equipments like differential GPS and total stations or photogrammetric and high resolution images obtained from satellite operations
  • 30. 18 Methodology Spatial points are fundamental units needed to predict direction and distances of lines such as roads, cables and natural rivers. Point pattern analysis is efficient if and only if there exist point pattern data. For example consider data below extracted from Google earth how are employed in Point pattern analysis The same data can be loaded to QGIS in order to determine Digital Elevation Model and Contour Creation.
  • 31. 3.4 Spatial Point Data Creation, Loading and Processing in R 19 3.4 Spatial Point Data Creation, Loading and Processing in R Point data are the basic spatial data, as from a Point Data a line can be created, and from combination of lines the polygon can be created. From this point of view , Spatial point data were created covering the Mount Kilimanjaro so as to establish coordinates which may assist in making a Digital elevation model (DEM)
  • 32. 20 Methodology 3.4.1 Point data creation As shown above, the Add Path button was used to create a series of points to cover a whole mountain. A total number of 6822 points were created manually to cover the mountain as shown below; After Spatial point creation the file was saved to .KLM extension which is the Google Earth data format 3.4.2 Klm File Processing The file was then loaded to TCX converter for primary processing; In TCX converter , longitudes ad latitudes were extracted, followed by computation of Altitude. Then data was exported in a .CSV format to spreadsheet for further editing.
  • 33. 3.4 Spatial Point Data Creation, Loading and Processing in R 21 3.4.3 Loading a Coordinate list in R After Editing and removing unwanted data from the file, Longtudes , Latitudes and Altitudes were Loaded to R
  • 35. 3.4 Spatial Point Data Creation, Loading and Processing in R 23 3.4.4 3D Visualizarion of point data
  • 37. 3.5 Line data , and Polygon Formation with Script in R 25 3.5 Line data , and Polygon Formation with Script in R Line is a two dimension plane defined by two or more lines. when three or more lines are joined in their nodes , they form a polygon. From the same concept of Point data creation, a series of points was created following the boundary of Kilimanjaro region, the data were saved with .klm extension then imported to TCX converter. Since in defining the two dimensional boundaries there is no need for height values, the data were exported as .csv directly for further editing.
  • 38. 26 Methodology The script defining how to plot an area was then introduced to R as shown below;
  • 39. 3.5 Line data , and Polygon Formation with Script in R 27 Then after loading the script to R point data were loaded as usual, defining the Xcord, Ycord and Distance from one point to the other Then after The are computation was carried out fom the created polygon. However there was no clear illustrations of area since the area was not projected yet!!!!
  • 41. Chapter 4 Introduction to Spatial Data Modeling 4.1 Basic Concepts 4.1.1 Realms Spatial objects considered in the design process using realms are points, lines, and regions. These can be represented using only points and segments of the realm. Basically, a spatial object is not created on the realm, but there are construction elements associated to it (points and segments).(Mtalo, 2016) Realms refers to the a finite set of points and line segments defined over a finite domain, of type grid, such that : 1. Each point is a point of the grid; 2 Each segment end is a grid point; 3 No point of the realm belongs to the interior of a segment; 4 Any two distinct segments do not intersect and do not overlap. Realms use a discrete domain for representing space and spatial objects. Therefore a user can define a finite domain of numerical values that is used as the base in defining a set of spatial data types.
  • 42. 30 Introduction to Spatial Data Modeling 4.1.2 Spatial Databases A spatial database is a database optimized for storing, managing, and querying spatial data. It provides spatial data types in its data model and query language, support for spatial indexing and for spatial join. Spatial databases are essential for recording values of spatial characteristics of a set of objects. 4.2 Modeling of Vector data in QGIS Geographical Information Systems (GIS) and Digital Elevation Models (DEM) can be used to perform many geospatial and hydrological modeling including drainage and wa- tershed delineation, flood prediction and physical development studies of urban and rural settlements.(Konadu and Fosu, 2009) There are two techniques for modeling spatial data in a computer system: raster (grid) and vector.The main difference within these two is that In a vector model, a spatial infor- mation indicates where something is or where it occurs, and in a raster model it indicates something that exists or occurs everywhere.
  • 43. 4.3 Modeling of Kilimanjaro Mountain in QGIS 31 In the study DEM was developed with 5 m contour topographic data; The Kilimanjaro points with altitude created by using Google Earth were used as terrain inputs for performing spatial analysis and obtaining derivative products. The generated DEM was used to delineate drainage patterns and watershed of the study area using QGIS open source software. 4.3 Modeling of Kilimanjaro Mountain in QGIS A vector-based approach was used to derive contours in determination of height levels of mountain Kilimanjaro. The DEM of Kilimanjaro mountain was used as inputs for determining contour lines which would help in further developmental projects mapping. Randomly selected data acquired with Google Earth was used to create a DEM. The first step was to load the .CSV file of kilimanjaroPts.csv to QGIS Then points could be displayed as follows;
  • 44. 32 Introduction to Spatial Data Modeling Reproject the point data to Arc 1960 UTM zone 37 Convert data to Shape files by using save as.. function
  • 45. 4.3 Modeling of Kilimanjaro Mountain in QGIS 33 There after, DEM will be displayed to canvas and therefore remove the kilimanjaroPts data and remain with DEM If there is a need of adding attributes to the DEM it is required to open attribute table otherwise processing can take place.
  • 46. 34 Introduction to Spatial Data Modeling With context to this project Modeling could involve Natural neighbor algorithms found in Raster creation tools. Projection parameter is of very important. also it is required to select input column data eg. Altitude, cell size and output directory. The figure below shows sample of filling natural neighbour toolbox.
  • 47. 4.3 Modeling of Kilimanjaro Mountain in QGIS 35 Raster Grid is then displayed to canvas as a single band gray level. Then it is required to open attribute level so as to change color
  • 48. 36 Introduction to Spatial Data Modeling Now the Grid raster is displayed in multiple colors and therefore provide clear visualiza- tion of a model. Open Raster tools box and select Extraction to allow Contour formation as shown below
  • 49. 4.3 Modeling of Kilimanjaro Mountain in QGIS 37 It is required to fill parameters cleary depending on the need of output values For example for the case of Kilimanjaro, contours could be displayed as shown below;
  • 50. 38 Introduction to Spatial Data Modeling By removing raster Grid contours coud then be displayed as shown below
  • 51. Chapter 5 Digital Image Processing A digital image refers to the record of the electromagnetic energy reflected or emitted from the earths surface or other features on the earth’s surface. A remotely sensed image is a pictorial rendition, or model, of target features described through the use of spectral reflectance. A digital image is stored as a two-dimensional array (or grid) of small areas called pixels (picture elements). Each pixel corresponds spatially to an area on the earth’s surface. This array or grid structure is also called a raster, so image data is often referred to as a raster image. The raster image is arranged in horizontal rows called lines, and vertical columns called samples. Each pixel in the image raster is represented by a digital number (DN) or a brightness value (BV).(ENVI, 2004) Digital image processing refers to the subclass of signals processing concerned specif- ically with pictures, with the aim of increasing or improving image quality for computer visualization and human interpretation. Therefore in order to conduct the accurate classification it requires first to: -Acquire high resolution image -Perform pre-processing so as to remove radiometric and geometric errors. High reso- lution satellite image can be acquired by various ways depending on the need and time given to accomplish the task. R and QGIS are simpler softwares employed in downloading of high resolution satellite images. This is due to presence of GDAL and OSMAR packages in R and and Plugin installer in QGIS. OpenStreetMap provides freely accessible and editable geographic data. The osmar package smoothly integrates the OpenStreetMap project into the R ecosystem. The osmar package provides infrastructure to access OpenStreetMap data from different sources, to enable working with the OSM data in the familiar R idiom, and to convert the data into objects based on classes provided by existing R packages.
  • 52. 40 Digital Image Processing 5.1 High resolution Image acquisition with R Using R software i refer to the simplest and easiest technique of downloading high resolution images. The image downloaded with R are always Multispectral band images but with few bands as Red, Green and Blue (RGB). QGIS is essential in downloading images which require large dataset as selection of satellite to be used, for example Landsat 5, 7,8 or Quickbird satellites. Strengths of using R instead of QGIS is that, The image downloaded with R such as Google maps and Open Street Maps do not contain geometric and radiometric errors as they tend to be already pre-processed. Never the less downloading high resolution images with QGIS needs much time and bandwidths as one Landsat image with three bands can take to more than 2GB (Gigabytes) to download where as in R only few MB (Megabytes). Steps Employed in downloading high resolution satellite images with R. 1. Load the package required 2. Set the working directory from which image downloaded will be saved and download the map defined by the name of district, region or country. The gmap package is useful in
  • 53. 5.1 High resolution Image acquisition with R 41 downloading and saving googlemap images. Also it is advised to use draw extent function to draw tiles of interest covering the required area. A good example is shown below; NOTE: The small the tiles created the higher the resolution downloaded and vise versa is true. From above 4 images plotted above, other 4 tiles to each were downloaded as shown below;
  • 54. 42 Digital Image Processing ######################################################################## > #So as to get high resolution images Kilimanjaro map was then plotted to four parts ># as North West, North east, South west and South East Then each part was further ># divided to four portion making total number of 20 downloaded images. > plot(KilimanjaroMap) > select.area <- drawExtent() > North_West<-gmap(select.area, type="satellite",rgb=TRUE,filename="NW.tif") > select.area <- drawExtent() > North_West1<-gmap(select.area, type="satellite",rgb=TRUE,filename="NW1.tif") > select.area <- drawExtent() > North_West2<-gmap(select.area, type="satellite",rgb=TRUE,filename="NW2.tif") > select.area <- drawExtent() > North_West3<-gmap(select.area, type="satellite",rgb=TRUE,filename="NW3.tif") > select.area <- drawExtent() > North_West4<-gmap(select.area, type="satellite",rgb=TRUE,filename="NW4.tif") > > select.area <- drawExtent() > North_East<-gmap(select.area, type="satellite",rgb=TRUE,filename="NE.tif") > select.area <- drawExtent() > North_East1<-gmap(select.area, type="satellite",rgb=TRUE,filename="NE1.tif") > select.area <- drawExtent() > North_East2<-gmap(select.area, type="satellite",rgb=TRUE,filename="NE2.tif") > select.area <- drawExtent() > North_East3<-gmap(select.area, type="satellite",rgb=TRUE,filename="NE3.tif") > select.area <- drawExtent() > North_East4<-gmap(select.area, type="satellite",rgb=TRUE,filename="NE4.tif") > > select.area <- drawExtent() > South_West<-gmap(select.area, type="satellite",rgb=TRUE,filename="SW.tif") > select.area <- drawExtent() > South_West1<-gmap(select.area, type="satellite",rgb=TRUE,filename="SW1.tif") > select.area <- drawExtent() > South_West2<-gmap(select.area, type="satellite",rgb=TRUE,filename="SW2.tif") > select.area <- drawExtent() > South_West3<-gmap(select.area, type="satellite",rgb=TRUE,filename="SW3.tif") > select.area <- drawExtent() > South_West4<-gmap(select.area, type="satellite",rgb=TRUE,filename="SW4.tif") > > select.area <- drawExtent() > South_East<-gmap(select.area, type="satellite",rgb=TRUE,filename="SE.tif") > select.area <- drawExtent() > South_East1<-gmap(select.area, type="satellite",rgb=TRUE,filename="SE1.tif") > select.area <- drawExtent() > South_East2<-gmap(select.area, type="satellite",rgb=TRUE,filename="SE2.tif") > select.area <- drawExtent() > South_East3<-gmap(select.area, type="satellite",rgb=TRUE,filename="SE3.tif") > select.area <- drawExtent() > South_East4<-gmap(select.area, type="satellite",rgb=TRUE,filename="SE4.tif") > #######################################################################
  • 55. 5.1 High resolution Image acquisition with R 43 Therefore total number of other 16 tiles could be downloaded covering Kilimanjaro Map. When each image plotted display a high resolution googlemap. Note here that each map downloaded comes with three file types; the .gif file, .gfw file and .prj file.
  • 56. 44 Digital Image Processing The image downloaded in this format can be loaded to GIS softwares such as QGIS or ARCGIS but can not be efficiently useful since is not in TIFF format. Therefore it required to rewrite and save the image files as TIFF format as shown below. 5.2 Map projections with Q GIS In order to define the map projection of the whole project. The main menu is useful as it is required to Project>Project properties >CRS. But in order to deal with single directory of raster data, select directory and CRS shown below;(Mtalo, 2016)
  • 57. 5.2 Map projections with Q GIS 45 After projecting all selected data, then all files are displayed in QGIS window. In order to be able to perform processing of whole area at once it is then required to merge all sixteen images of high resolution to a single image. Go to Raster> Miscellaneous >Merge... as shown below; Then select the files to be merged and name the output. in this project the output was named as Merged-kilimanjaro.tif
  • 58. 46 Digital Image Processing To add image data it is required to add layer through Layer> Add Layer> Add Raster Layer then add your layer such asMerged-kilimanjaro.tif Then it is displayed as a true color composite as shown below;
  • 59. 5.3 Image Pre-processing 47 5.3 Image Pre-processing Pre processing refers to the preparation of data for subsequent analysis which employs; -Correction of deficiencies -Removal of flaws, Image pre processing is essential for improving the quality of image as the basis for later analyses that will extract information from the image. Satellite images such as Landsat images need to be Pre-processed first before being analyzed. 5.4 Image Classifications with Q GIS Image classification refers to the task of extracting information classes from a multiband raster image. The resulting raster from image classification can be used to create thematic maps. Depending on the interaction between the analyst and the computer during classification, there are two types of classification: supervised and unsupervised.(Dorothea, 2016) There are two main types of classification; supervised and unsupervised classification,both are used in collecting endmembers, classifying previous rule images, calculating class statistics and confusion matrices, applying majority and minority analysis to classification images, clumping and sieving classes, combining classes, overlaying classes on grayscale images, calculating buffer zone images, calculating segmentation images, and exporting classes to vector layers.
  • 60. 48 Digital Image Processing In this project supervised classification was used to cluster samples that determines land cover of Kilimanjaro Region. Supervised classification is the process of using training data samples to assign objects of unknown identity to one or more known features used to cluster pixels in a dataset into classes corresponding to the user defined training classes(ROIs). Steps Involved in Image Classification 5.4.1 Opening the SCP and select Working file It is required to download SCP (Semi Automatic Classification plugin) if not installed, or just loading it if present then display the false color composite as R=3, G=2. and B= of Selected file. From the project, Merged-kilimanjaro.tif was loaded to SCP. . 5.4.2 Creation of Shapefiles and ROIs To create shape files of training samples followed by creating ROIs. It is advised to select more features and training samples since better results depends on classified ROIs.
  • 61. 5.4 Image Classifications with Q GIS 49 5.4.3 Spectral Signature List plotting After all ROIs have been loaded to signature list, it is then required to highlight all training samples loaded in SCP classification and export them to signature list, then save the signature list . Then after load selected samples to SCP spectral signature plot to evaluate Reflectance and Standard Deviation of selected samples.
  • 62. 50 Digital Image Processing 5.4.4 Perform classification There are many classification methods, but common are Parallelepiped, Minimum Distance, Mahalanobis Distance, Maximum Likelihood, Spectral Angle Mapper, and Binary Encoding. With context to this project Minimum likelihood was used. The minimum distance technique uses the mean vectors of each endmember and calculates the Euclidean distance from each unknown pixel to the mean vector for each class. All pixels are classified to the nearest class unless a standard deviation or distance threshold is specified, in which case some pixels may be unclassified if they do not meet the selected criteria. For technical details, see the following reference: J.A.Richards, 1999,Remote Sensing Digital Image Analysis, Springer-Verlag, Berlin, p. 240. During classifying Merged-Kilimanjaro. tif file, the classified file was served as Kilimanjaro-Classified as shown below.
  • 63. 5.5 Post Classification 51 5.5 Post Classification Post Classification is used to classify rule images, to calculate class statistics and confusion matrices, to apply majority or minority analysis to a classification images, to clump, sieve, and combine classes, to overlay classes on an image, to calculate buffer zone images, to calculate segmentation images, and to output classes to vector layers. 5.5.1 Accuracy Assessment It is required to use Confusion Matrix to show the accuracy of a classification result by comparing a classification result with ground truth information. QGIS can calculate a confusion matrix (contingency matrix) using either a ground truth image or using ground truth regions of interest (ROIs). In each case, an overall accuracy, producer and user accuracies, kappa coefficient, confusion matrix, and errors of commission and omission are reported. 5.6 GIS Modeler A GIS Modeller is a special application development environment that supports the graphical representation of the inputs, procedures and workflow required for the solution of a GIS anal- ysis problem. Once the graphical model of the solution is fully specified it is then executed to process the specified inputs and procedures according to the specified workflow.(Mtalo, 2016) The graphical modeler are most useful since allows to create complex spatial analysis models using a simple and easy to use interface no matter how many steps and different algorithms it involves since a model is executed as a single algorithm 5.6.1 Image Processing by QGIS Processing Modeler GIS Workflows typically involve many steps - with each step generating intermediate output that is used by the next step. If you change the input data or want to tweak a parameter, you will need to run through the entire process again manually. Fortunately, QGIS has a graphical modeler built-in that can help you define your workflow and run it with a single invocation. You can also run these workflows as a batch over a large number of inputs.(Mtalo, 2016) Procedure for modeling with QGIS Graphical modeler My workflow on this project started with loading of classified image ie.Kilimanjaro- Classified as shown below.
  • 64. 52 Digital Image Processing Then for Creating a model the following steps were used; Launch QGIS and go to Processing Graphical Modeler, and since the Processing modeler dialog contains a left hand panel and a main canvas. It was required to Select the Inputs tab in the left hand panel and drag the + Raster layer to the canvas. The alternative of that was to launch QGIS processing then open the Toolbox..., then create a new model as shown below. Apply a Majority Filter algorithm to the Input landcover raster (Kilimanjaro-Classified.tif). This will reduce noise in our output by eliminating isolated pixels.
  • 65. 5.6 GIS Modeler 53 Then save the name of resulting Raster and Convert the resulting raster to a polygon layer by using Polygonize function.Also set the output as vector-output . Query for a class value from the attribute table of the polygon layer and create a vector layer for that class as implemented below.. Next step is to assign a name and directory to a model and and save it.
  • 66. 54 Digital Image Processing Then vectorize your classified image data using the created model by seting directory as default to QGIS preferences to RUN, otherwise Extraction by attribute will not work properly. Consider the image below;
  • 67. Chapter 6 Spatial Object Analysis 6.1 Introduction to OSMAR OSMAR is the short term of Open Street Maps And R. OpenStreetMap provides freely accessible and editable geographic data. The osmar package smoothly integrates the Open- StreetMap project into the R ecosystem. The osmar package provides infrastructure to access OpenStreetMap data from different sources, to enable working with the OSM data in the familiar R idiom, and to convert the data into objects based on classes provided by existing R packages. “OpenStreetMap creates and provides free geographic data such as street maps to anyone who wants them” announces the OpenStreetMap wikipedia main page (OSM Foundation, 2011) – and since R users want free geographic data. Therefore, the add-on package osmar (Schlesinger and Eugster, 2012) provides extensible infrastructure for integrating the OpenStreetMap project (OSM) into the R project.(Eugster and Schlesinger, 2012) The aim of the OpenStreetMap project is to create a free editable map of the world. The project maintains a database of geographic elements (nodes, ways and relations) and features (such as streets, buildings and landmarks). These data are collected and provided by volunteers using GPS devices, aerial imagery, and local knowledge. The most prominent application is the rendering of the geographic data and features into raster images (for example, for the OSM map on the website). However, the project also provides an application programming interface (API) for fetching raw data from and saving to the OSM database. R implements a dialect of the S language that was developed by Rick Becker, John Chambers and Allan Wilks. Versions of R are available, at no cost, for 32-bit versions of Microsoft Windows for Linux, for Unix and for Macintosh OS X and it is available through the Comprehensive R Archive Network (CRAN). R has extensive and powerful graphics
  • 68. 56 Spatial Object Analysis abilities, that are tightly linked with its analytic abilities. The R system is developing rapidly hence New features and abilities appear every few months.(Eugster and Schlesinger, 2012) 6.2 Data acquisition with OSM OpenStreetMap data is licensed under the Open Data Commons Open Database License (ODbL) and therefore is the free source of spatial data where as point , line and polygon data are provided free. To download free data is required to log into Open street map through https://www.openstreetmap.org then extract extent of data to be downloaded through Export tool bar QGIS also provides OSM plugin which allow downloading of open street maps directly from https://www.openstreetmap.org through opening of Web services. Open Layer Plugin provides function for downloading Google maps, open street maps for spatial data analysis. The diagram below illustrates how QGIS supports OSM data acquisition.
  • 69. 6.2 Data acquisition with OSM 57 Downloading of Spatial data in OSM depends on the selected boundaries. for example Kilimanjaro region is covered between extents of 2.7 to 4.7 latitude south of Equator and 36.5 to 38.5 longitude east of the Greenwich. OSM data can be downloaded as database of given extent or locality. For example Kilimanjaro map was downloaded in both two methods with open street map plugin as shown on the figure below.
  • 70. 58 Spatial Object Analysis 6.3 Handling Spatial Data Frame in QGIS A data frame is the most common way of storing data in R and QGIS, and if used system- atically makes data analysis easier. Under the hood, a data frame is a list of equal-length vectors. This makes it a two dimensional structure, so it shares properties of both the matrix and the list. This means that a data frame has names(), colnames(), and rownames(), although names() and colnames() are the same thing. The length() of a data frame is the length of the underlying list and so is the same as ncol(); nrow() gives the number of rows. From the case study area, Kilimanjaro OSM data were loaded to QGIS so as to en- able editing or removing of unwanted Spatial data frames. As shown on the figure below , downloaded OSM data contained points, lines and polygons outside the boundary of Kili- manjaro. Therefore it was necessary to clip the image and select only data within boundary of Kilimanjaro. Vector tool-bar was used to process the data.For example Geo-processing tools was employed to remove unwanted data in the project as shown on the diagram below.
  • 71. 6.3 Handling Spatial Data Frame in QGIS 59 Then it was required to isolate the shape files so as to determine points, polygons and lines independently and save their shape files in specified folders The new shape files was then loaded to QGIS to enable further editing of attribute tables by employing digitization tools. For example editing of lines could be shown as a sample in figure below.
  • 72. 60 Spatial Object Analysis After editing of all attribute table the cropped image could then appear as shown be- low.Then the output could be then loaded to R for further analysis.
  • 73. 6.4 Handling Spatial Data in R 61 6.4 Handling Spatial Data in R The analysis of spatial data is usually undertaken to make inferences, that is to try to draw conclusions about a hypothesised data generating process or to use an estimated process to predict values at locations for which observations are unavailable. In some cases, the conclusions are sufficient in themselves, and in others, they are carried through to other hierarchical layers in the model under scrutiny.(Bivand et al., 2008) For spatial data analysis in R the following
  • 74. 62 Spatial Object Analysis 6.5 Loading or Attaching of Datasets in R
  • 75. Bibliography Bivand, R. S., Gomez-Rubio, V., and Pebesma, E. J. (2008). Applied Spatial Data Analysis with R. Number ISBN 978-0-387-78170-9. Springer. Dorothea, D. (2016). Spatial data analysis and image processing. University of Bagamoyo Faculty of Built Environment (FBE). ENVI (2004). ENVI Users Guide, volume ENVI Version 4.1. Research System Inc (RSI), 2004 edition edition. Eugster, M. J. A. and Schlesinger, T. (2012). osmar: Openstreetmap and r. The R Journal CONTRIBUTED RESEARCH ARTICLES, 5(ISSN 2073-4859):53–63. Konadu, D. D. and Fosu, C. (2009). Appropriate Technologies For Environmental Protection In The Developing World. Springer. Mtalo, E. G. (2016). Mathematical softwere aids and advanced gis applications in spatial data analysis. University of Bagamoyo College of Science Informatics and Built Environment.