Sunteți pe pagina 1din 101

Jaffna Temples Android Location Bases Application

GF1371 COM
Kanasalingam Sathyabaman (CB004114)


A project submitted in fulfillment of the requirements for the
Degree of
Bachelors of Science in Computing (Hons)


Supervisor
Mr. Balachandran Gnanasekaraiyer


Staffordshire University
6
th
March 2014, Colombo


i


Approval from Project Manager



Project Manager (Mr. Gamindu Hemachandra)





I certify that this thesis satisfies the requirements as a thesis for the degree of Bachelor of
Science in Computing.






Advisor/Assessor (Mr. Thangavel Saravanan)





I certify that I have read this thesis and that in my opinion it is fully adequate in scope and
quality as a thesis for the degree of Bachelor of Science in Computing.






Supervisor (Mr. Balachandran Gnanasekaraiyer)





ii

Abstract

There are about 1500 Hindu temples in Jaffna District, therefore it is hard for a human to
remember all the temples or keep a note on each temple. When people wanted to know the
temples located nearest to their location. They will have to search on internet or have to ask
the people in that location, most of the time they end up with the wrong or limited
information.
To solve this issue the Author have decided to develop a mobile application that will help the
users to find the nearest temples in their location and also can get the direction, details of
those temples. The application will also help the users to get the direction and the shortest
path to visit those temples.
The goal of this project is to develop a Mobile application for which will help the uses to
locate the nearest temples from their location in Jaffna. This application will also have
functionalizes to get the information, direction and the shortest path to visit those temples. To
achieve the goal of this project Author will be using technologies such as Geo fencing, Map
Collaboration, Location-based services, GPS, Google API v2, Web Mapping.
In this project Author have done a lot of research on Location based services (LBS) and how
they are used in the todays world with the use of smart phones and tablets. This project also
gives a clear picture of how LBS were stared and how that improved to match the
requirements of todays world. This project will also discuss technologies like Geo Fencing
and Map Celebration, which will help to create virtual boundaries in the map and also to
draw some interactive diagrams on the map. This project also discusses on the GPS
technology and how those are used in the smart phone and mobile devices, how locations are
tracked and how the distance between two locations are calculated. This project also discuss
in detail about the Mobile platforms, its architecture and also how the location servers can be
embedded into Mobile devices using APIs. Most of all the entire project will give a good
idea on mobile app development using the location based services.
iii

Acknowledgement

I am greatly thankful to my supervisor Mr. Balachandran Gnanasekaraiyer for assisting and
guiding me since the beginning of this project. I would also like to thank Mr.Gamindu
Hemachandra my project manager for valuable advice and guidelines during Idea generation
sessions and advisory meetings which were helpful for me to focus on the development of a
suitable software solution relevant to a timely problem area.
I would also like to thank my all lectures from APIIT for their encouragement, support and
continuous & guidance throughout this project. I thank them all for their invaluable guidance
and other people who directly or indirectly assisted me in the successful and timely
completion of my Mid-point.

I am also greatly thankful to my family members and my friends in providing me with
immense support and encouragement given during the project activities.
iv

Table of Contents

Abstract ...................................................................................................................................... ii
Acknowledgement ................................................................................................................... iii
Table of Contents ...................................................................................................................... iv
List of Figures ........................................................................................................................... ix
Abbreviations ............................................................................................................................. x
1.0 Introduction .......................................................................................................................... 1
1.1 Problem Overview ........................................................................................................... 1
1.2 Solution Overview ........................................................................................................... 2
1.3 Project Scope and Objectives ........................................................................................... 3
2.0 Report Overview .................................................................................................................. 4
2.1 Domain Research ............................................................................................................. 4
2.2 Technical Research .......................................................................................................... 4
2.3 Analysis............................................................................................................................ 4
2.4 Requirement Specification ............................................................................................... 4
2.5 Selection of methodology ................................................................................................ 5
2.6 System design .................................................................................................................. 5
2.7 Implementation ................................................................................................................ 5
2.8 Testing.............................................................................................................................. 5
2.9 Conclusion ....................................................................................................................... 5
3.0 Domain Research ................................................................................................................. 6
3.1 Use of LBS in this project ................................................................................................ 6
3.2 Location Based Service (LBS)......................................................................................... 6
3.2.1 History of LBS .......................................................................................................... 6
3.2.2 LBS Architecture ...................................................................................................... 8
3.3 USE of GIS in this project. .............................................................................................. 9
3.4 Geographical Information System (GIS) ......................................................................... 9
3.5 Use of GPS in this Project ............................................................................................. 10
3.6 Global Positing System (GPS) ....................................................................................... 10
3.6.1 Introduction ............................................................................................................. 10
3.6.2 Technical operations ............................................................................................... 10
v

3.6.3 GPS Signals ............................................................................................................ 12
3.7 Use of Google Map in this project ................................................................................. 13
3.8 Google maps .................................................................................................................. 13
3.9 Bing Maps ...................................................................................................................... 14
3.10 Use of Map Collaboration in this Project .................................................................... 16
3.11 Map Collaboration ....................................................................................................... 16
3.11.1 Map Markers ......................................................................................................... 18
3.12 Use of Geo Fencing in this project ........................................................................... 20
3.13 Geo- Fencing ................................................................................................................ 20
3.13.1 Drawing Polygons ................................................................................................. 21
3.13.2 Drawing Circles .................................................................................................... 21
4.0 Technical Research ............................................................................................................ 22
4.1 Android .............................................................................................................................. 22
4.1.1 Introduction ................................................................................................................. 22
4.1.2.1 Applications ......................................................................................................... 23
4.1.2.2 Application Frame work ...................................................................................... 24
4.1.2.3 Libraries ............................................................................................................... 24
4.1.2.4 Android Runtime ................................................................................................. 24
4.1.2.5 Linux Kernel ........................................................................................................ 25
4.1.3 Anatomy of an Android Application .......................................................................... 25
4.1.3.1 Activity ................................................................................................................ 25
4.1.3.2 Intent Receiver ..................................................................................................... 26
4.1.3.3 Service.................................................................................................................. 26
4.1.3.4 Content Provider .................................................................................................. 27
4.1.4 Location Based Mobile service design ....................................................................... 27
4.1.5 Distance calculation on Map ....................................................................................... 29
4.1.5.1 Spherical Law of Cosines .................................................................................... 29
4.1.5.2 Spherical law of cosines for Angles ..................................................................... 30
4.1.5.3 Haversine formula ................................................................................................ 32
4.1.6 Data base for Android Application ............................................................................. 33
4.1.6.1 Introduction to SQLite ......................................................................................... 33
4.1.6.2 Using the SQLite Database .................................................................................. 34
5.0 Analysis.............................................................................................................................. 35
vi

5.1 Selecting Map ................................................................................................................ 35
5.1.1 Google Maps ........................................................................................................... 35
5.1.2 Bing Maps ............................................................................................................... 36
5.1.3 Conclusion .............................................................................................................. 37
5.2 Selecting technologies for drawing shapes on map ....................................................... 38
5.2.1 Geo -Fencing ........................................................................................................... 38
5.2.2 Map collaboration ................................................................................................... 38
5.2.3 Conclusion .............................................................................................................. 39
5.3 Selecting Algorithm to Calculate Distance. ................................................................... 40
5.3.1 Spherical Law of Cosines ....................................................................................... 40
5.3.2 Haversine Formula .................................................................................................. 40
5.3.3 Conclusion .................................................................................................................. 41
5.4 Requirement Specification ............................................................................................. 42
5.4.1 Functional Requirements ........................................................................................ 42
5.4.2 Nonfunctional Requirements .................................................................................. 43
5.4.3 Hardware Requirements........................................................................................ 44
5.4.4 Software Requirements ........................................................................................... 44
6.0 Selection of Methodology .................................................................................................. 45
6.0.1 Chosen Development Methodology Model. ........................................................... 46
6.2 System Mythology selections ........................................................................................ 47
6.2.1 Stages in RAD Methodology .................................................................................. 47
6.2.2 Advantages of RAD Methodology ......................................................................... 49
6.2.3 Disadvantages of RAD methodology ..................................................................... 49
7.0 System Design ................................................................................................................... 50
7.1 Flow Chart ..................................................................................................................... 50
7.2 Use Case Representation................................................................................................ 51
7.3 System Modules ............................................................................................................. 54
7.3.1 Search Module ........................................................................................................ 55
7.3.2 Search results Module ............................................................................................. 56
7.3.3 Database Module .................................................................................................... 57
7.3.4 Map Module ............................................................................................................ 58
7.4 Over all Class Diagram .................................................................................................. 59
7.5 Sequence Diagram ......................................................................................................... 61
vii

8.0 Implementation .................................................................................................................. 62
8.1 Development Environment ............................................................................................ 62
8.2 System Development ..................................................................................................... 62
8.2.1 Search Module ............................................................................................................ 62
8.2.1.1 User Input............................................................................................................. 62
8.2.1.2 Explicit Intent....................................................................................................... 63
8.2.2 Database Module ........................................................................................................ 64
8.2.2.1 Creating database ................................................................................................. 64
8.2.2.2 Inserting values to the database ........................................................................... 65
8.2.2.3 Fetching values from Database ............................................................................ 65
8.2.2.4 Count total records ............................................................................................... 66
8.2.3 Search Results Module ............................................................................................... 66
8.2.3.1 Temple Adapter ................................................................................................... 66
8.2.3.2 Displaying the DB Results ................................................................................... 67
8.2.4 Location Module ......................................................................................................... 68
8.2.4.1 Network Service provider Location ..................................................................... 68
8.2.4.2 GPS Location ....................................................................................................... 68
8.2.5 Map Module ................................................................................................................ 69
8.2.5.1 Importing Google maps ....................................................................................... 69
8.2.5.2 Drawing Circles on Map ...................................................................................... 70
8.2.5.3 Drawing Polygons on the Map ............................................................................ 70
8.2.5.4 Displaying Markers .............................................................................................. 71
8.2.5.5 Calculating distance Harversine Formula ......................................................... 71
8.2.5.6 Calculating distance Spherical Law of Cosines ................................................ 72
8.2.5.7 Checking map service .......................................................................................... 72
8.2.5.8 Setting default location ........................................................................................ 73
9.0 Testing................................................................................................................................ 74
9.1 Test Plan......................................................................................................................... 74
9.2 Unit Testing ................................................................................................................... 74
9.2.1 Search Module ........................................................................................................ 74
9.2.2 Search Results Module ........................................................................................... 77
9.2.3 Location Module ..................................................................................................... 78
9.2.4 Map Module ............................................................................................................ 79
viii

8.3 Integration testing .......................................................................................................... 80
8.4 System Testing ............................................................................................................... 81
10.0 Limitation and Further Enhancements ............................................................................. 82
11.0 Conclusion ....................................................................................................................... 83
11.1 Critical Appraisal ......................................................................................................... 84
12.0 References ........................................................................................................................ 86
Appendix .................................................................................................................................. 90

ix

List of Figures
Figure 1- Location based services Architecture......................................................................... 8
Figure 2- Storing Location Information Using GIS ................................................................... 9
Figure 3 - How GPS signals are used to calculate the location, in smart devices ................... 11
Figure 4 - data packets send from the GNSS satellites to base station .................................... 12
Figure 5 Difference between Google Map sand Bing Maps................................................. 14
Figure 6 - Drawing on Map ..................................................................................................... 16
Figure 7- Drawing on map using fingers and touch system .................................................... 17
Figure 8- code snippet to custom markers ............................................................................... 18
Figure 9 - Map Marker with Info window ............................................................................... 19
Figure 10- Geo Fencing in Google Maps ................................................................................ 20
Figure 11- Code snippet to draw polygon................................................................................ 21
Figure 12 - Code snippet to draw circle ................................................................................... 21
Figure 13 - Android Architecture ............................................................................................ 23
Figure 14 - Code to add Google map view .............................................................................. 27
Figure 15 - Code to locate the users current location on map ................................................ 28
Figure 16 - Calculating Distance using Spherical Law of Cosines ......................................... 29
Figure 17 - Spherical law of cosines for Angles ...................................................................... 31
Figure 18- Harversine formula ................................................................................................. 32
Figure 19 - Harversine rule on sphere ...................................................................................... 32
Figure 20 - Method used to create a database in SQLite ......................................................... 34
Figure 21 - Rapid Application Development (RAD) model .................................................... 46
Figure 22- Flowchart diagram for overall System ................................................................... 50
Figure 23 - Use case diagram for overall System .................................................................... 51
Figure 24Activity Diagram (Search Module) .......................................................................... 55
Figure 25- Activity Diagram (Search Results Module) ........................................................... 56
Figure 26- Activity Diagram (Database Module) .................................................................... 57
Figure 27 - Activity Diagram (View Map Module)................................................................. 58
Figure 28- Over all Class Diagram .......................................................................................... 59
Figure 29 - Sequence Diagram ................................................................................................ 61

x

Abbreviations
LBS Location Based Services
GPS Global Positioning System
GIS - Geographical Information System
API - Application programming interface
RAD - Rapid application development
REST - Representational State Transfer
WPF Windows Presentation Foundation
1

1.0 Introduction
1.1 Problem Overview
Jaffna is the capital city of the Northern Provence in Sri Lanka. It is one of the historical
places for Sri Lankan Tamils. According to the Sri Lankan scenes report 2012, it is the 12
th

largest city in Sri Lanka and has a population of more than 88 thousand in which 70% of
them are Hindus. Since the time of 1215, the kings who ruled the Jaffna Kingdom started to
build different types of temples in that area. According to the Sri Lanka Department of
Hindu Religious and Cultural Affairs there are 1448 register Hindu temples available in
Jaffna. (Department of Hindu Religious and Cultural Affairs. 2013)
Since there are about 1500 temples, it is not possible for a single person to remember the
location and the details of these temples. Whenever a person wanted to know the nearest
temples from his location, the person has to ask from the people in that location or manually
have to search on the web or have to check the printed documents, where most of the time
they end up with wrong or limited information. Mainly tourist who wanted to visit Jaffna
temples have no idea, what are the nearest temples in their location, what type of temples
available, what is the puja time for those particular temples and what the specialty of those
temples is. The only way they have to get the information about the location is by search on
the Google maps, where most of the temples are not listed on the maps or get at least the
minimum information is through the particular temples websites. The main difficulty in
getting the information of these temples is where most of those temples dont have their own
websites or an online information source and most of the temples which have their own
websites are found to be out dated or they do not update often.
The application must target Hindu community in Sri Lanka. Mainly the public crowds who
want know the location and the specialty of the temples in Jaffna. This application will also
help to the people outside of Jaffna or the people who just went to Jaffna and want to know
about the temples in Jaffna. This application must specially target people who have
knowledge on the internet technology and the person who uses the smart phones only. There
is lot of tourist from Europe and Asia who visit temples in Jaffna, this application will be
highly benefited for those people who wants to know the nearest temples or the direction to a
particular temple. This application must also help the third party people like researches,
2

journalist and religious people who want get information of the temples. By considering this
Author had decided to create a mobile application to solve this problem.
1.2 Solution Overview
To solve this issue the application must provide some functionality such as using this
application users can do a simple search to find the nearest temples available in that area
depending on the distance the user is willing to travel. Users can also get the direction to a
particular temple using this application. Not only the direction, using this application users
can also get the information like historical data, puja time and other details for a particular
temple. The application must also prove the user with the shortest path to visit those temples.
To get the greatest benefit of this application, this application must be done for portable
devices that have all the location services therefore the Author had decided to create a mobile
application to solve this problem. When it comes to mobile application there are different
types of mobile platforms available such as IOS, Android, and Blackberry. But when
selecting the best platform for this application, the author has considered about the
performance, popularity, cost and available resources to make this application a success one.
Although IOS is widely used and it supports a lot of features related to map. The IOS
development environment and tools cost a lot of money. Compared to Google Maps the IOS
maps are not very accurate in Asia. IOS development also needs lot of security configuration.
When it comes to Blackberry it has very limited users compared to other platforms and it
does not have its own mapping application.
Android is an open source widely used and it has more users compared to all the other mobile
platforms and it has lot of free APIs available for the development. Android also has its own
mapping application called Google map, which is very accurate and used by many people in
the world, which will be a greater benefit to this application and also will help to get the
accurate locations of the temples. Therefore author had decided to solve this problem using
an Android application.




3

1.3 Project Scope and Objectives
The Scope of this project is to develop a mobile application to identify the nearest temple
from the users location in Jaffna or search for a particular temple depending on the users
requirements such as temple category and distance the user can travel and providing the users
with the details, location, information and direction to the selected temple. The application
must also provide the users with the shortest and the best path to visit those temples.
To implement these functionalities the application must store the list of temple details on a
database and depending on the users search criteria the application must check the data base
and find the temples that are matching with the users search criteria and the users expected
distance. Then the application must present the list of temples that matches the search criteria
to the user. Depending on the users selected temple the application has to get all the details
about the particular temple and display it to the user and if the user wanted to view the
temples on the map, then the application must calculate the shortest path to visit those
temples and filter it with the user provided distance and display it on the map by connecting
those temples with a polygon shape.
Objectives of the Project as follows
The application must store list of temple details in to the database.
The application must get the traveling distance and search criteria from the user.
Depending on the users criteria the application must filter the temples from the
database.
The application must filter the temples from result of the search criteria depending on
the travelling distance provided by the user.
The results for the users search must be presented to the user.
Depending on the users selected temple from the search result the application must
display the full details about that particular temple.
The application must draw circle on the map depending on the user provided distance.
The application must find the shortest path for the selected temples and display it on
the map by drawing the polygon for the shortest distance.
The application must be very user friendly to the users.
The accuracy of the location of temples must be maintained throughout the
application.

4

2.0 Report Overview
2.1 Domain Research
In this section of report the author will discuss about main research and the technologies that
can be used for the implement the system. The domain research is done to collect knowledge
from different areas for the final development of the system. In this section of the report the
author has done a research on various technologies such as LBS, GIS, GPS, Geo Fencing
and Map collaboration which will be used to understand the fundamental of those
technologies and how those technologies can be used for the implementation of the proposed
system.
2.2 Technical Research
This section of report will discuss on the technical assets that are need to the development of
the system. Especially the author will discuss about the platforms, algorithms and the
techniques that can be used for the development of the main functionalities of the system. In
this section author will mainly discuss on the suitable development platform, its architecture,
mobile location based services design and the algorithms that can be used to find the distance
on map. This section will also discuss on the techniques that can be used to draw circles,
polygons and other objects on the map.
2.3 Analysis
Analysis section is done to identify the suitable technology for the system form the domain
and the technical research. This section will discuss about all the available technologies and
how they can be used in this system. In this section author will discuss bout the importance of
each technology and select the suitable technologies for the development of the proposed
system.
2.4 Requirement Specification
This is one of the main sections in the entire report. This section will discuss about the
functional and non-function requirements of the system. The requirement specification is
backbone for the design and the implementation section, therefore these section will be
discussing on the functionalities that are need for the system. This section will also discuss
about the hardware and the software requirements of the proposed system.

5

2.5 Selection of methodology
This section will discuss about the available methodologies for the development of the
system. In section will consider about the functionalities of the system and the time available
for the development of the system. Depending on the time and the functionalities a suitable
development methodology will be selected for the development of the proposed system. This
section will also clearly explain the selected methodology and how that can be used for the
development of the system.
2.6 System design
This section of report will give a graphical representation of the functionalities of the system.
This section will uses the design techniques and tools such as flow chart, use case diagram,
Activity Diagram, sequence diagram and the class diagram to explain the functionalities of
the system. The system design will describe all the functionalities of the diagram in a
graphical manner, which will be used for the implementation of the system.
2.7 Implementation
This section of the report will explain about the techniques used for the implementation of the
system. This section will mainly discuss about how the algorithms and how they are
converted to the real code. This section of report will explain how the functionalities of the
system are implemented with the help of the code snippet.
2.8 Testing
This section of report will discuss about the techniques available for the testing of the
application. It will also discuss about the technologies and how they are used for the testing
of the application. After all the testing is done this section will provide the overall accuracy
of the system.
2.9 Conclusion
This section will give a final conclusion of this report. This section also have a critical
appraisal section which will discuss about the difficulties and the challenges faced by the
author during the development of this application and how the author overcome those
difficulties.to make this project a success.


6

3.0 Domain Research
3.1 Use of LBS in this project
LBS are the main core functionality for all the location based application. LBS will handle
the communication between the mobile device and the satellite to get the users location. LBS
also take care of the communication between the mobile devices and the remote servers to get
the location based information and to display the map on the users device. In this project the
author will be using the LBS technology to communicate between the satellite, remote
servers and the users device to represent the geographical information on the users device.
Author will also use the LBS technology to query about the location and the location
information in this project.
3.2 Location Based Service (LBS)
It is a general computer program service used to give specific controls for location service in
computing. It is an information service which is mainly used in much social networking
application today for entertainment purposes. LBS is also accessible with the mobile devices
such as Smart phones, PDA, Tablets . through the mobile network and which uses the
information of the geographical position of the mobile device. The LBS technology has
become more important technology for mobile phones after the introduction of the smart
phone. Today LBS is used in many context such as entertainment, work, personal life, indoor
search, health . LBS also includes services to identify a location of an object or a person. E.g.:
finding nearest coffee shops, searching the nearest ATM machine and finding the location of
the friend.it also includes services like parcel tracking, vehicle tracking, weather forecast
depending on users location and managing advertisements depending on users location.
(Telecom Systems, 2013)
3.2.1 History of LBS
The first dynamic real time stolen vehicle recovery system was introduced in 1990 by
International Teletrac System (pvt) in Los Angeles, CA, USA. This gives the way for the
developers to begin development on location based services that can transfer location
information based on goods location, this was first developed and implemented on Motorola
Pagers. In 1996 Todd Glassy developed the first digital timestamp server for Email and other
content validation and created the first of Geo Spatial Keying a complex cryptographic
process for using time and location data for unlocking certain services.Glassy also proceeded
7

with his digital evidence system based on location and digital object control at the service and
network layer interface. In1996 the us Federal Communication Commission (FCC) issued
rules requiring all us mobile operators to locate emergency callers, this rule leads the us
mobile operators to seek the support of the emergency community in order to obtain the same
protection from the law suits relating to emergency calls. In 1997 Christopher Kingdom from
Ericson, handed the description of Location services (LCS) joining with GSM group of the
European telecommunication standard institute (ETSI) and American national
standardinstitute (ANSI). As a result LCS sub working group was created and this group
started working on selecting position methods and standardized location service (LCS) and
later known as Location based service (LBS). As a result of these researches in 1999 the first
digital location based service patent was filed in the US and ultimately issued after nine
office action in March 2002. The patent has controls which applied in todays networking
models provide key value. In 2000 the world 12 largest telecom operators, Ericsson,
Motorola and Nokia jointly formed and location Interoperability Forum Ltd (LIF). This form
first specified the mobile location protocol (MLP) and the interface between the telecom
network and the LBS. In 2004 LIF joined with Open Mobile Association (OMA). The first
LBS service was launched in 2001 by TeliaSonera in Sweden (friend finder, emergency call
location, yellow pages, House position) and in May 2002 Go2 and AT&T launched the first
US mobile location LBS local search application that uses the automatic location identifier
(ALI) technology, which is used to search the nearest places such as (stores, ATMs, coffee
shop, restaurants, petrol station).This services are highly used in todays life with the use of
smart phones. The below image shows the LBS application Used to track the nearest places
such as bus stand, hotels, Hospitals. (Location-based service (LBS), N.A.)





8

3.2.2 LBS Architecture
According to Kupper, 2005 and Kolodziej&Hjelm, 2006, Location based service is a service
based on geographical location of mobile handled device. Examples for Location based
services are finding nearby restaurants, finding nearby store with the best price for a
particular product. A system structure of a Location Based Service include five major
components. (Steiniger, Neun, &Edwardes, 2006) they are.
Mobile handled devices, smart phones or a small computer that can be held in the hand
Positioning system, which is a navigation satellite system that provides location and time
information to anyone with a receiver.
Mobile and wireless network, which relay on the query and location inform from the
devices to service providers and transfer results from the service providers to the smart
devices.
Service provides which provide the location based services.
Geographical data providers, which are database storing huge amount of geographical
data such as information about coffee shops, temples, bus stand, gas stations
(Technowizz's Blog, 2013)
The below diagram will give a clear idea of LBS Architecture.

Figure 1- Location based services Architecture
The GPS Signals are received from the satellites in to mobile device and this location is
passed to the World Wide Web, then the service provider and the service provider will
communicate with the Geographical data provider to get the geographical data and that data
is passed form the service provider through several mediums to the users mobile device.

9

3.3 USE of GIS in this project.
GIS technology is used to store the graphical information in the form of several layers in to
the virtual data. The map service providing companies have already implemented this system
to store the graphical information of the map. In this project the author will not be developing
the new GIS information service instead the author will use the service from one of the map
service provider.
3.4 Geographical Information System (GIS)
A geographic information system (GIS) is a system designed to capture, store, analyze
manage and present all type geographical data. GIS allows us to view, understand, question,
interpret, and visualize data in many ways that reveal relationships, patterns, and trends in the
form of maps, globes, reports, and charts. The Geographical information system is the union
of cartography, statically analysis and computer science technology. GIS digitally makes and
manipulates spatial areas that can be application oriented. GIS uses a technology called
spatial data infrastructure, which means has no restriction for boundaries. In general GIS is an
information system that integrates, stores, edits, analyzes and display geographical
information for decision making. GIS help to answer questions and solve problems by
looking at the data. The below image will give a clear picture on Geographical Information
System and how it is used to store location information. (ISD-GIS Home, 2013)

Figure 2- Storing Location Information Using GIS
10

3.5 Use of GPS in this Project
GPS is technology used to identify the users location on the map. In this project author will
be using the GPs technology to identify the users location and provide the services
depending on the users location to the user.
3.6 Global Positing System (GPS)
3.6.1 Introduction
Global positioning system (GPS) was declared and fully controlled by department of defense
in United States since from 1995. It is widely used by the military and the civilians
applications. It is the only system that allows anyone with a GPS capable device to detect the
users location on the earth without any special training or knowledge. Even before 1995, the
partially completed system received a good publicity, that application is the Persian Gulf War
during 1991. This system allowed the military to effectively plan and locate the movement of
the troops across a desert landscape that was lacking landmarks for the navigations. Today
GPS is widely used in many mobile applications such as vehicle tracking, person health, and
environment sensing and wellness application. GPS is the best tool for tagging data with the
locations. Today smart phones comes with the build in GPS receivers. This GPS technology
consumes more amount of power e.g.: on average one GPS location fix requires turning on
the GPS chip for 25 seconds at 462mW power consumption, this is a huge consumption of
power compared to all the other services in a mobile device. GPS receivers computes it
location by measuring the distance from the receiver to multiple GNSS satellites, to do this
GPS receivers need three pieces of information, they are.
A precise time
A set of Visible SVs and their location at time.
Distance from the receiver to the SV at that time.

3.6.2 Technical operations
Global Positioning System (GPS) functions using a constellation of orbital satellites that
broadcast signals that are received by GPS receivers. The devices receive the signals and
calculate the users position. The orbital constellation contained 24 satellites in 6 difference
circles of orbits. But the current GPS system used 31 active satellites in non-uniform
arrangements in order to improve the accuracy of the location and take action at the time of
11

satellite failure. The devices containing the GPS receivers will not be able to reliablyreceive
signals from all the satellites but it can be theoretically seen due to the signal degradation
from the atmosphere or building. As long as the devices can receive signals from 4 satellites
it can calculate the location. (P. Massatt and W. Brady, 2002)

Figure 3 - How GPS signals are used to calculate the location, in smart devices

In order to calculate the position the GPS receivers must have locks form at least 4 satellites
signals. For the public use these signals are broad cast in the frequency (1575.42 MHz) and
uses special modulation methods to get the signals from various satellites that don not
interfere with each other although they are on the same frequency. Each satellite broadcast its
specific correct location and the calibrated time signal. All the satellites in the constellation
continuously calibrate their clock among each other, so that they all run on the same time.
Depending on the receivers distance from the satellite, the signals are received from the
satellite in a small different time. The smart devices can detect the location using 3 signals,
these devices are capable of detecting the distance from three satellites and commutates its
relative position on the earth. The below diagram will give a clear idea on how the smart
devices uses the signals from the satellites to calculate the users location. (GPS.gov, 2013)

12

3.6.3 GPS Signals
There are 31 GNSS satellites above the earth, each satellites orbit the earth twice every day.
A set of stations on the ground monitor these satellites trajectory and health and the satellites
parameters to the satellites. These parameters include two kinds of information; they are the
ALMANAC which contains the orbit and the status information and the EPHEMERIS which
contains the precise values of the satellite strategy. All these satellites are time synchronized
within few microseconds. The satellites simultaneously and continuously broadcast time and
orbit information through CDMA signals at 1.575 GHz to the earth. And the bit rates of the
packets send by the satellite is 50bps. A full data packet broadcast from the satellites is
30seconds long and consist of 6 second long frames. Each data packets consist of
EOHEMERIS of the transmitting satellite and the ALMANAC of all the satellites. The
EPHEMERIS informations are continuously updated by the ground stations. In theory the
EPHEMERIS data include in the SV broadcast is only valid for 30Minutes. The below
diagram will give a clear picture of the data packets send from the GNSS satellites to the base
station. (Global Positioning System (GPS), 2013)

Figure 4 - data packets send from the GNSS satellites to base station


13

3.7 Use of Google Map in this project
A Google map is the open source mapping service provided by Google. In this application the
author will be using this service to present the map and the graphical information on the
mobile devices.
3.8 Google maps
Since the Google launched the Google maps in 2005, it has an enormous impact on the way
people think, learn and work with geographical information. It provides an easy access to
cultural and spiritual information, Google maps also provides the users with the ways to
understand their world and their community of their interest. The customizable map features
and dynamic presentation tools in the Google maps make each one an attractive option for
someone waiting to learn or teach geographical information and makes maps more
customizable for the users. For academic researchers, Google mapping applications are also
provide the powerful ability to share and host projects, create customized KML(Keyhole
Markup Language) files and easily communicate with their own research findings in the
geographical information. Recognizing their potential for revitalizing map collections and
geographic educations authors felt many academic were also going to be active in using the
Google maps for variety of purposes such as promoting their services and developing their
own Google KML for their users.
Google maps also provide various other services such as Google rise finder, Google transit,
traffic, navigation, route planner. Google maps also provide APIs to embedded maps with
other websites are applications. Google maps also uses the JavaScript extensively, as the
users navigate through the maps for each drag, the grid squares are downloaded from the
server to display the locations, when a users searches for a location or a business, those
results are downloaded in the back ground and then inserted in to the map view without
refreshing the page. Google also introduced a java application called Google maps for
mobile, which can be run on the java based mobile platform such as Android, IOS. The
Google maps navigation for Android OS was released on November 2009. Since then the
smart phone application developers started developing application related to Google maps.
But today goggle maps for the smart devices have improved a lot and capable of tagging and
adding information with the maps. Now days Google maps on the smart phones are used for
various purposes such as finding nearest shops, getting location to enormous locations.

14

3.9 Bing Maps
Bing map is a web mapping service provided by Microsoft. It is widely used in Windows
computers and Windows mobile operating systems. It is based on the existing mapping
technology used by Microsoft such as Microsoft MapPoint and Terra server. The original
version of the Bing maps id lacking of its distinguishing features including 3Dmaps and
birds eye view. After the release of windows Live in 2005it become the public face of the
virtual earth platform. Microsoft added the ability to view 3D maps using the .Net managed
controls and managed interfaces. The Bing maps frequently update and expand the
geographical information covered by the imagery. Currently Bing maps stores more than 165
terabytes of high regulation geographical images. This makes the images more clearly in the
Bing maps compared to Google maps. . (PCWorld. 2014)

Figure 5 Difference between Google Map sand Bing Maps
The above image shows the color difference in Google and Bing maps. As you can see from
the above image the Bing maps images are very clear and high resolution compared to
Google maps. (PCWorld. 2014)
15

The Bing maps also supports various features such as Street view Maps, Road view, Aerial
view, Birds- Eye view, Street Side view, venue maps and 3D maps. This makes the Bing
maps very user friendly to the users. The Bing maps also has features to calculate the distance
and path guidance for driving, Walking and transit transport, but this is effective only in
European union and America. Bing Maps also has provides services to monitor the traffic for
major highways and roads, but this features work only in 72Cities in United States of
America. The Bing maps also provide services for the users to share maps and embedded
maps in to the websites for free.
The Bing maps also provide Multiple APIs for the application developers to include the Bing
maps. The Bing APIs include AJAX control, Widows app store control, WPF control, REST
services and spatial data services. The Windows app store has two APIs that can be used to
embedded mapped in to windows 8 application they are java script based Bing map AJAX
V7 control and .NET API for the windows 8 application that uses C# or c++. The Bing Maps
AJAX V7 is the universal mapping control that not only supports Windows and Mac pcs it
also supports many mobile platforms such as Android, IOS and Blackberry. The Bing REST
service is the best service performing tasks such as geocoding, reverse- geocoding, and
routing and static imagery. The REST based API can be accused by any mobile platforms.
The Bing Spatial data service is based on the rest service that offer the three key
functionalities they are batch geocoding, Point of interest and ability to store and expose the
users spatial data. These services are used for the placing the markers or displaying a
building name on the map. (Bing Maps. 2014)





16

3.10 Use of Map Collaboration in this Project
Map collaboration is the technology used to draw shapes such as straight lines, circles and
polygon on the map. In this application author will be using this technology to draw circles
depending on the users traveling distance and draw polygons to connect the temples with the
shortest path.
3.11 Map Collaboration
It is the Technique used to interact with two or more coordinates on the map. It typically
requires activity coordinates and corresponding among coordinates to collaborate with.
Mobile celebration focus on the process and tools that allow users to collaborate with maps
and other portable devices. In the mobile celebration domain, maps are logical components to
the user interface, the users are inherently distributed through a graphical region and the
information can possess geospatial components that a map can easily visualize to the users.
Due to the various on the mobile screen size its hard to display the same information for all
the users at the same time, but using the information cutter on map based and the map based
interfaces and various techniques helps to give better isolation of the map to users.

Figure 6 - Drawing on Map
The above image shows the drawing overlay on Google map. The drawing controls are
shown as callout and the three types of shapes such as Circle, Polygon, and straight line can
be drawn. The drawing is one of the interaction methods that has employed with the success
of location based information. The touch interaction and the drawing with figures is the faster
17

methods of specifying the location or an area. A digital Mapbase workspace presents
opportunities present shared feedbacks to the users. Example, the map can automatically
update its location using the GPS to interact with the application.
Drawing on Google maps is already well supported in Google maps in a relatively
rudimentary fashion. Users can just specify the points or the coordinates to form the lines,
polygons, circles via Google maps drawing overlay tools. As shown in the Figure 7. The
Google maps also provide facilities for adding continuous lines. The continuous lines
facilities the creation of curved lines and complex shapes, but each points must be specified
separately.in order to support the area and line drawing Google maps was developed with
continuous line drawing technology. In order to support this type of drawing an HTML5
canvas was inserted in to the Google maps application. This canvas element controls the size
view and the drawing on the Google maps application. The Google maps also prove a overlay
canvas called zoom controls, therefore users can still interact with the map while the canvas
was active. There are to methods used to draw shapes on the map uses can uses the touch
system and their figures to draw the map as they like or they can simply specify the type of
drawing and provides the coordinates or the radius so that the map will automatically draw
the shapes. (S. Sarker, D. E. Campbell, J. Ondrus, and J. S. Valachich, N.A.)

Figure 7- Drawing on map using fingers and touch system
The above figure Shows how shapes can be drawn using the fingers and the touch system.
18

3.11.1 Map Markers
Custom Map makers are widely used in almost all the LBS application today. Markers are
used to identify the location on the map. Markers have slandered icons for the Google map
look and feel. Google maps also provide the ability to change the markers according to the
developers needs through API. The markers in Google map are objects of type Markers and
are added to the map with the function called GoogleMap.addMarker(markerOptions). These
map makers are drawn against the device screen rather than the map surface, therefore the
tilting, zooming and rotating will not change the orientation of the map markers. The below
code snippet will show the code used to added markers to the map.

Figure 8- code snippet to custom markers

Markers can be customized according to the users needs, defining the marker icon involves
number of properties that may affect the visual look of the marker. The markers support
customization through the properties such as position, ladling, snippet, drag gable, visible,
anchor and icon. It is also possible to change the color and the visibility of the default
markers by passing the Bitmap descriptor object to the icon () function. We ca use the default
colors in the BitmapDescriptiorFactory object, or set the custom color to the marker using the
BitmapDescriptorFactory.defaultMarker(float hue) function. The Map makers also provide
the facility to display the info window with the marker. By default info will display only if
user taps the marker, only one info window can be displayed at a time. The info window is
also drawn against the device screen and centered above the associated marker. The below
image will give a clear idea on Mapmakers and its info window.
19


Figure 9 - Map Marker with Info window

As you can see from the above image the yellow color shape is the map marker for that
particular location. Once that user clicks the marker it displays the info window with the
description of the particular marker. The markers can also have hyperlinks that link to other
pages for more information as shown in the above diagram.





20

3.12 Use of Geo Fencing in this project
Geo Fencing is used to create virtual boundaries on the map with the help of the shapes like
circles and polygon. In this project author will be using this technology to create a virtual
boundaries and the restrict the information to be displayed for the users with in the user
expected distance or boundaries.
3.13 Geo- Fencing
This is one of the advanced technologies used in Google maps to represent the information or
some details in a user friendly manner. Geo-fencing is widely used in almost all the Android
map application. Today LBS, the position of the user is determined only when a user actively
participate in the service session. It is maintained at the clients application in the mobile
devices and the services backend located at the remote server. This makes a position fixed
just after establishing the services session between the users device and the remote server.
For example, if a user wanted to know the nearby restaurants around his location.
Geo-fences are the imaginary boundaries that are defined around a particular region. These
boundaries can be a polygon or circle, the Google maps provides the facilities to draw circle
or a polygon depending on the services need for the user or depending on the users interest.
Geo-fencing can be created simply proving the address or landmarks. Geo- fencing also
allows to track activates of a particular user in a particular location. This will help to create a
geo-fence alert and also helps to monitor the users movements accordingly. Circles and the
polygons are mainly used in the geo fence application. The below images will give a clear
idea on how the geo- fence (Circles and polygons) are used in Google maps.

Figure 10- Geo Fencing in Google Maps

21


3.13.1 Drawing Polygons
The Polygons are the object similar to the polyline; polygons consist of series of coordinates
in ordered sequences. It is very simple to create polygons on Google maps API v2, just call
the pre build class and pass the polygon coordinates. The Polygon object in the Google maps
has the ability to autocomplete the polygon, example if we pass the three coordinates to the
polygon function, it will draw the three continuous polylines and it will automatically connect
the last coordinate with the first coordinate provided to make it a polygon. The sample code
snippet to draw polygon on Google map is shown below.

Figure 11- Code snippet to draw polygon
3.13.2 Drawing Circles
The Google Maps API v2 includes specific class called circles, which helps to draw circles
on Google map. To construct a circle the user has to provide the center coordinates and the
radius in meters to the circle function. The below code snippet will show the code used to
draw circles on Google maps.

Figure 12 - Code snippet to draw circle
22

4.0 Technical Research
4.1 Android
Android is an open source mobile operating system provided by Google. It is more user
friendly and most popular mobile operating system compare to all the other mobile operating
systems in the world. In this project author will be developing the application for the mobile
devices that use android operating system.
4.1.1 Introduction
Android is the latest generation open platform for smart mobile phones launched by Google.
On November 12, 2007 the Open Handset Alliance released the Google android SDK for the
first time, since then the concept of the Android platform is attracting more and more
programmers in to mobile computing .It is a package of software designed only for mobile
devices which includes an operating system, middleware and core applications. The android
SDK is a powerful tool which provides necessary APIs for developers to develop applications
on android Platform. The development of the android applications is done using the Java
programming language. Android platform is an open system architecture, which includes
development and debugging environment, it also support many scale user experiences which
includes rich media support, optimized graphics system and a powerful browser. We can also
use an Android development tool (ADT) is the plugin for Eclipse IDE, designed to give good
experience and interactive environment for the development of Android applications. It also
enables reuse and replacement of components and an efficient data base support. It also
supports various wireless communications such as Bluetooth, Wi-Fi, GSM, CDMA, HSPDA
. (Android - An Open Handset Alliance Project, N.A.). Android Platform also support Video
Camera, GPS, 3D-accelerometer and Compass, provides rich APIs for the maps and location
applications.users have the ability to access Google maps freely at any time and implement
location based mobile service in the smart mobile at low cost. Android is not only promoting
the technology of innovation, it also help to reduce the development cost and enables the
developers to develop the applications with unique characters.
Android applications are written in java programming language. This written code is
combined and packed in to an Android package called .apk file. This apk file is common for
all Android devices and can be published on the Android store called Google Play, where
users can just visit the site and install it to the compatible Android devices. (kebomix, 2010)
23

4.1.2 Android Architecture
Android Architecture consists of five levels they are Applications, Application Framework,
Libraries, Android runtime and Linux Kernel. The below diagram will give a better picture of
the android Architecture.

Figure 13 - Android Architecture
4.1.2.1 Applications

It is a set of core application are on the top level of the frame work. This includes
applications like SMS app, web browser, contacts app, maps application, email client . All
the application in the application level are written using the Java programing language.



24

4.1.2.2 Application Frame work

Android developers have full access to the same framework APIs used by the core
applications. This application architecture is designed to reusing of all the components to the
developers for the application development. This technology allows every components to be
replaced by the user. And all the under lying applications are the set of services and system,
which includes a rich extensible set of activities that can be used to build a good application,
including Grids, text views, lists, spinners, buttons, web browser and even a map view.
Which can be embedded to any application in just few lines of code. The content providers
that enables the application to access data from other application e.g.: messaging can access
data such as contact numbers, images, videos . it has a notification manager that enabling all
the application to show custom alerts in the status bar. It also has an activity manager which
manages the life time of each application. (Android Developers. 2013)

4.1.2.3 Libraries

Android also includes a set of C and C++ libraries used by various components of the android
system development. These capabilities are exposed to developers through application
framework. Some of the main libraries are shown in the above figure.

4.1.2.4 Android Runtime

Android includes a set of core libraries that provides most of the functionality to the core
libraries of the java programing language. Every application in Android runs in its own
process given by the OS and each application has its own instance of Dalvik Virtual machine.
Dalvik is a functionality that helps the device to run multiple Virtual Machine Efficiently.
Dalvik Virtual machine has executing files in .dex format which was optimized for minimal
CPU and memory usage. The virtual machine is a registered based and runs classes complied
by Java compliers that are transformed to .dex at the time of compilation, using dx tool that
are shipped with the SDK. The Linux Kernel can run multiple instance of the Davik Virtual
25

machine and also can provide underlying functionalities such s low level memory and
threads.(Android Developers. 2013)

4.1.2.5 Linux Kernel

Android totally relies on Linux kernel for the core system services such as memory
management, network stack, process management, driver model and security. This also act as
a hardware abstraction layer between hardware and the applications.
4.1.3 Anatomy of an Android Application

Android applications has four building blocks they are activity, intent receiver, services and
content providers. It not necessary for every application to have all four, but to create a usable
application, it must have at least two of these components. Once the user decided what
application to be written with what components, they should be listed in the file called
AndroidManifest.xml. It is the place where the components of the application are declared
with their capabilities and requirements. (C. Haseman). Below we will look in detail on the
four building blocks of the android application.

4.1.3.1 Activity

Activity is the common and mostly used building block out of all four. An activity is usually
a single screen in an application; every android application must have at least one activity.
Each activity is implemented as a single class that extends the activity main class. This class
will display a user interface. Most of the android application consist of multiple activities are
screens. E.g.: An email application will have a main activity that shows all the menus such as
inbox, outbox, spam, trash. When a user select a menu from the main activity, which will
take the user to second respective activity. Every time a new screen open the previous screen
is paused and put to the history stack, this will help the user to navigate backward through the
previously opened screens in the history. This screen can also be removed from the history
26

stack when it is inappropriate to remain. Moving from screen to screen is accomplished by
resolving intents, to navigate forward an activity calls start activity. The system will look for
all the intent filters to pick the intent that best matches the intent, then the new activity is
informed of the intent m, which caused it to be launched. The process of handling intents at
the run time which start activity is called. It also offers some benefits such as activities can
reuse functionalities from other components simply by making request through intent,
activities can be replaced at any time by a new activity with an equivalent.
4.1.3.2 Intent Receiver

It is used when an application needs to execute in a reaction of an external event. E.g.: phone
rings and you failed to pick up or something happen interning on your social network, in this
situation intent receivers dont display a UI, but they will send a Display notification of what
has happen. These intent receivers are also register in AndroidManifest.xml file, but you can
also register them using context.registerReceiver method. There is no need for the application
state to be running for the instant receivers to be called, the system will automatically start
the application whenever the intent receiver is triggered.

4.1.3.3 Service

It is a code that lives long and it runs without a UI. e.g.: Media player playing songs from a
playlist, in the media player application there will be at least two activities, which allows the
users to choose the songs and play them. However they must playback itself should not be
handled by the activity, because the users will expect the music to keep playing even if they
navigate to new screen or application. In this situation the media player will start a service
using Contect.startService method to run the media player in the background to keep the
music continuously playing. When an application is connected to a service, you can
communicate with the application through the interface exposed by the service.


27

4.1.3.4 Content Provider

Applications can store their data in files or in a SQLite database. Content provider is useful if
you want the application top share the data with other application. Content provider is a class
that implements a slandered set of methods to let other applications store and retrieve the type
of data that is handled by the content provider.

4.1.4 Location Based Mobile service design

Android also provides map display, control functions and location support for application
development. Map view is used to display a view of a map, it can get inputs such as up,
down, zoom in and zoom out to support the movement in the map view. The map view also
supports multi-layer overlay which help the users to draw coordinates, display pictures and
text on the map. The map view uses the file system and network running in the background,
so all the threats runs as an activity life cycle. Before using the map it is necessary to get a
API key from Google for using that service. Google map view can be added to android
simply by adding the below code

Figure 14 - Code to add Google map view
We can also use Android location based API to collect users current location and display it on
the map view. The below code will help to locate the users location and display it on the map
and also using the controller helps to move the map view to current location.
28


Figure 15 - Code to locate the users current location on map

Map view types can be changed easily. E.g.: changing from satellite view to street view or
change the view traffic from hidden to visible can be done easily with the below code.
myMap.setSatellite (true);
myMap.setTraffic (false);

29

4.1.5 Distance calculation on Map
Calculating the distance between two locations on the map is same as calculating the distance
between two points on the sphere. Each coordinates on the maps has a latitude and longitude
values. To find the distance between two latitude and longitude coordinates there are numbers
ways or laws such as Havresine formula, Spherical Law of Cosines and Equirectangular
approximation are available.
4.1.5.1 Spherical Law of Cosines
The Spherical law of Cosines is used to calculate the distance between two points on a
sphere. Spherical law of cosines is the theorem relating the side and the angles of the
spherical triangle which analogous the ordinary law of cosines for a trigonometry plane.

Figure 16 - Calculating Distance using Spherical Law of Cosines

According to the figure 16, we can assume that the point Z is the north pole of the sphere and
consider the plane P as the tangent to the sphere at the point Z. Extent the ray from the center
o of the sphere through the point X to the plane P. U is the intersection between the projected
ray and the plane. Someway extent the ray from O through Y to P and the interaction point is
W. Now calculate the length of the segment UW in the plane P using Euclidean law of
cosines applied to the triangle UZW. To calculate this distance the length of the ZU and ZW
30

are needed. Then finally apply the Euclidean law of cosines to the triangle OWU, the angle
of UOW is C. which will give the distance between the X and Y Points in the Sphere.
(Wolfram MathWorld. 2014)
The spherical law of cosines also produces the simple equation to calculate the distance
between two points on the sphere. The equation is shown below.



The above formula is the formula for Spherical law of cosines, in this formula

D Difference in distance between two pints
- Latitude
- Longitude
R - Earths radius (mean radius = 6,371km)

4.1.5.2 Spherical law of cosines for Angles

Angles are the congruence relation for the spherical geometry. We can also use the spherical
law of cosines for the angle to provide the distance between two coordinates on map. We can
assume our triangle XYZ is on a unit sphere, with angles , , and the side length as a, b, c
with the corresponding center angles A,B,C. since each segment on the sphere is a part of the
general circle. We can define the polar point of a line segment to the center of the circle.
Then two possible choices we can make are right hand rule or the left hand rule. ( Spherical
Trigonometry. 2014)
31


Figure 17 - Spherical law of cosines for Angles
The dual Triangle XYZ is the triangle whose vertices are the polar points of the sides XYZ.
Draw several triangles on the sphere and their duals. Give a triangle with side lengths A, B, C
and the opposite angles as , , the dual triangle formed from the polar points has side
lengths - , - , - and the angles - A, - B, - C. now by applying the spherical law of
cosines to the dual triangle can obtain the distance between X and Y. (Spherical
Trigonometry. 2014)

Basically the Spherical Law of Cosines is based on the Haversine formula, but due to the
computational precisions are limited and now a days use of 64 bit floating point numbers the
spherical law of cosines formula is bit lacking of accuracy. (Geographic Information Systems
Stack Exchange. 2014)



32

4.1.5.3 Haversine formula
The haversine formula is used to calculate the distance between two points on the earth
surface.it the special case of the general spherical trigonometry. The Harversine rule directly
relates to the side and the angles of the spherical triangle. The haversine formula is only an
approximation because the earth is not the perfect sphere. The radius of the earth varies from
6378.14Km from the equator and 6356.78Km at the poles. Because of the slight changes on
the earth radius the vincentys formula cab be used to correct it in Harversine method of
calculating distance. The Haversine formula is shown below. (Haversine formula |
MrReid.org. 2014)

Figure 18- Harversine formula
Here d is the distance between two points with latitude and longitude and r is the radius of the
earth. Although Harversine formula has some difference from the actual distance because of
the radius of the earth and since that approximation differs only 0.1% in the distance it is
widely used in the map based application to calculate the distance between two coordinates
on the map.
In a given unit sphere, if there is a triangle on the surface of the spheres is defined by great
circles connecting U, V and W on the Sphere. As shown the below diagram.

Figure 19 - Harversine rule on sphere
If the lengths of three sides are UV, UW, VW and the angle of the Conner opposite to c is C.
Then this law of Harversine can be used. (Latitude & Longitude Haversine Formula. 2014)

33

4.1.6 Data base for Android Application

The major asset for every android application is the data base support. A database system is
needed to store structural data, unless the application deals with the simple data available.
Android uses a data base system called SQLite database. It also an open source and stand-
alone SQL database, which is widely used in many popular applications. SQLite is a light
weight transactional database that occupies a very small amount of memory and storage.
Therefore it is the best choice for mobile operating systems such as Android. A database
created for a particular application can be accessed only by that application; other
applications running on the devices dont have the capability of accessing other applications
database. Once the database is created it is stored in the /data/data/<package
name>/databases location on the android device. (Android SQLite database, 2013)
4.1.6.1 Introduction to SQLite

It is the open source Database which is embedded in to the Android Devices. SQLite support
all the standard features like SQL syntax, Transections, procedures, views and prepared
statements. In addition it needs only a very low memory at the run time about 250Kilobytes.
SQLite is a software library that implements a self-contained; sever less, no configuration,
transactional SQL database engine. It is the most widely developed SQL database engine in
the world. SQLite supports the data types such as TEXT (String), INTEGER and REAL
(double), all the other data types must be converted in to one of these three types before
saving the data in to the database. SQLite is available in all the Android devices, using this
SQLite on the android devices does not need any setup or the administrator privileges. The
SQQL statements for creating, updating and deleting must only be defined and the database
will automatically manage for the users by the android application. (Android SQLite
database, 2013)


34

4.1.6.2 Using the SQLite Database
Android provides full support for SQLite databases. All the databases created in the Android
platform will be accessible by name to any class inside the application, not outside the
application. The recommended method to create a new SQLite database is to create a
subclass of SQLiteOpenHelper and override on create method, in which the SQLite
command will automatically executed to create tables inside the database. The below diagram
will clearly explain the method to create a database in SQLite.

Figure 20 - Method used to create a database in SQLite

You can then get the instance of the SQLiteOpenHelper class and start the implementation
using the constructor that is being defined. To write and read from the database use the class
getWritableDatabase () and getReadableQuery () respectively. SQLite queries can be
executed using the method SQLiteDataebase Query. This can accept various query
parameters such as table to query, projection, column, selection and grouping. Every SQLite
query will return a cursor that points to all the rows found by executing the query. The cursor
is the mechanism used to navigate to the results from the query. (Android SQLite database,
2013)

35

5.0 Analysis
This section will justify the selection of each technology that is used to implement the Jaffna
temples Location based application.
5.1 Selecting Map
The are two third party open source maps available for adding maps to this application they
are Google Maps and Bing Maps
5.1.1 Google Maps
It is the one of the popular web mapping service provided by Google. This technology
empowers many map and location based services such as website maps, ride finder, transit,
street view, route planner, travelling distance estimate and real time traffic report. This
service is used by more than 50% of the smart phones used in earth. The Google maps
encloses almost all the parts of the world, it provides high resolution satellite and aerial
images for the most urban areas of the world. The Google maps are featured to display the
satellite and natural human made landmarks, including novelties as large writing visible in
the imagery. Although Google map uses the uses the satellite images most of the urban cites
images are taken by the simple aircraft and those images are embedded in to the application
to make the map more user friendly to the user. The Google maps also have features called
Aerial view or the bird eye view. This feature is available only to most popular and
economically highly featuring cities. Using this aerial view user can view a building in all the
four directions like a bird viewing the building by flying around it. The Google map
application also uses advance Google markers to display the government building,
restaurants, shopping malls, bus stands, temples and hotels with their names, this will help the
users to identify the location or the place very easily and navigate through the map. Google
map also uses core engines and the map satellite images hosted in Google. It also uses tools
such as custom location icons, location coordinates, metadata and custom images in the map
interface to make it more user-friendly and suitable for the real needs.
Google map also provide the Google Maps API service which help the developers to interact
with Google maps into their websites and mobile application. This service is totally free and
currently has no ads. By using the Google Maps API service the developers can embedded
the Google Maps services in to their application, this help the developers to make the use of
this service and use features like web mapping, navigation, geo Fencing and other web
services makes the developers application highly usable by the users.
36

5.1.2 Bing Maps
This is also another web mapping service provided by Microsoft. It uses the technology
called Geospatial analysis to embed the geographical information in to the map services.
Geospatial analysis is the approach of applying the statistical analysis and other informal
techniques in to the data as geographical and geospatial services. It also uses the
Geographical information system (GIS) to store large amount of geographical data, which
can be further used to manipulate, analyze, manage and present the geographical data to the
user. The Bing map also has features such as Street map, road view, Aerial view, Birds-eye
view, street side view, venue maps and 3D maps. It also has features to calculate and monitor
the driving, walking and transit direction. The Bing map also provides the features to monitor
real time traffic.
Although the Bing map has all the features same as Google maps, the Bing map fails in
display the business and location search. The Bing map has markers to display the business
locations but it is not that effective as Google maps. Although the Bing map gives the Google
location search results in Europe and America, it fails to give the accurate location and place
details when it comes to Asia. The Bing map also Provide APIs for the developers to add the
maps to enrich the performance and users friendliness of their application. The Bing map
SDK can be used in Android devices as well. The Bing map SDK uses AJAX control 7.0 to
support the android developers. This made the android developers to control the Bing maps
without the use of JavaScript. The AJAX controls are wrapped in to libraries which made
accessing the Bing spatial services and Bing Maps REST services very simple.
Although the Bing Map APIs provide the simple implementation steps, the most developers
who used the Bing map on the android device for their development, they say that it is not
that effective with android devices. And also Bing map fails in displaying the accurate
location in rural areas of the world especially in Asia.

37

5.1.3 Conclusion
The both third party Map services provide the functionality to add maps to the application.
They also have features like street view, road view, aerial view, birds eye view and 3D map
view. Both maps have the APIs to add the maps to any application and use it according to
their needs. Although the Bing maps is very easy to configure in the application, the
developers who have used this application in the android devices say that it lacks with the
functionalities such as displaying the markers for the correct locations.
When it comes to popularity Google maps is very popular compared to all the other map
services available in the world. The Google maps also provide very accurate in results in
areas mainly in Asia compared to other map service providers. Since Android is also product
of Google the support wise the Google map is very effective for the android development.
By considering the scope of this application, the application must display the Jaffna district
which is located in Asia. The both Bing maps and the Google maps have the same features
but the Bing maps fails to display the accuracy of the location when it comes to Asia this is
where the Google maps take its place. Therefore I had decide to use the Google maps for the
development of this application.





38

5.2 Selecting technologies for drawing shapes on map
There are mainly two technologies available for drawing shapes on the map they are map
collaboration and Geo Fencing.
5.2.1 Geo -Fencing
Geo fencing is the technology that is used to create virtual boundaries on the map. Geo-
fencing is widely used in almost all the Android map application. Today LBS, the position of
the user is determined only when a user actively participate in the service session. It is
maintained at the clients application in the mobile devices and the services backend located
at the remote server. This makes a position fixed just after establishing the services session
between the users device and the remote server. The Geo fencing also provide the users to
interact with the maps by drawing shapes such as drawing shapes and placing markers on the
map. Geo fencing also has some advance features by tracking the users location and
provides the users with the important places that are available for the users in that location
that are suitable for the user.
5.2.2 Map collaboration
Map collaboration technique used to interact with two or more coordinates on the map. It
typically requires activity coordinates and corresponding among coordinates to collaborate
with. The map collaboration is the main aggregation of maps and user generated contents.
The map collaboration is used by group or the individual to take a several dusting forms to
interact with the maps. The latest maps providing the map collaboration techniques to store
share and collaborate with the map. The collaboration application varies with different
features of collaborating. The map collaboration can be done with different features
depending on the map capability such as Google maps provide the ability to collaborate with
open street view. In which users can see the real street and store information and share it with
other users. The map collaboration technology also provides the users a functionality to
interact with real buildings and 3D shapes to interact with the map features so that the users
can simply identify the place by seeing it rather than reading the location names or following
the path. The map collaboration technology also gives the user a great way of dealing with
map markers, using this technology even a document can be added to the marker. E.g.: if a
user is searching for the restaurants on the map, using the map markers on the restaurant the
Menu card of the restaurants can be added to the marker.
39

Although map collaboration gives the user the rich experience of using the maps, it consumes
huge data usage for displaying the open street view and 3D building views. It also takes huge
amount of time for the application to load each and every image on the map. When using the
map collaboration on the mobile devices it consumes huge memory this may affect the
performance of the device.
5.2.3 Conclusion
The both technologies Map collaboration and Geo Fencing can be used for the drawing
shapes on the map. Map collaboration is suitable for individual to intact with the map by
adding location, intact with street view and 3D buildings to share it with people. This is more
suitable for single use application when it comes to the dynamic applications the map
collaboration consumes huge time, data usage and battery power. Since the size of the mobile
devices is very small compared to the desktop map collaboration is not much suitable for the
mobile devices.
Geo Fencing is the simple technology that is used for creating virtual boundaries on the
map. It also uses technologies such as GPS and Network service provider to uses location
with accurate results.
The scope of this application is very simple, it has to locate the closest temple and display the
path, therefore 3D and Street View are not necessary for the application. Since it is a Mobile
application it is important to consider about the devices memory and the battery power.
Therefore the author had decided to use Geo Fencing to draw shapes and create virtual
boundaries on the Map.






40

5.3 Selecting Algorithm to Calculate Distance.
This section will justify the suitable theorems to calculate the distance between two points on
the map. Mainly there are two formulas available to calculate the distance between two points
on the map. They are Spherical law of cosines and Harversine formula.
5.3.1 Spherical Law of Cosines

The spherical law of cosines is branched from the simple spherical geometry; it deals with the
relationship of the side and angles of the spherical polygons, defined by the number of
intersecting great circles on the sphere. It is widely used in the astrology, geodesy and
navigation. The spherical polygon on the surface is defined by the number of great circles
arc, which are the intersection of the surface with the plane goes through the center of the
sphere. These types of polygon can have various sides. These sides triangles can be treated as
a number of spherical triangles.in this type of situation the spherical law of cosines can be
used to calculate the distance between two points on the sphere.
Although the spherical law of cosines is widely used in astrology and navigation it is just an
approximation, the exact distance cannot be calculated using this method. The spherical law
of cosines is widely used to calculate the larger distance but it lacks in the accuracy when
calculating the short distance on the map. According to the spherical law of cosines they
assume the earth to be in a regular sphere, where in reality it is not a regular sphere. Most of
all the spherical law of cosines is extracted from the harversine formula.

5.3.2 Haversine Formula

The harversine formula is used to calculate the distance between two locations on the map. It
is widely used in navigation industries. The harversine formula remains practically well-
conditioned for the numerical computational even when calculating the small distance on the
map. The researchers also say that the harversine formula mathematically and
computationally gives the accurate results. In harversine formula the intermediate result c is
the great circle distance in radians. The great circle distance will be also in the same radians.
Most computing is required for the arguments of the trigonometric function to be expressed I
radians. To convert lon1 lat1 and lon2 lat2 from degrees, minutes and seconds to radians. The
41

harversine needs to convert the decimal degrees to radians and multiply the numbers of the
Degree by pi/180. The harversine formula also has some weakness because the earth is not
the perfect sphere. The radius of the earth varies from 6378.14Km from the equator and
6356.78Km at the poles.

5.3.3 Conclusion

The both formulas are used to calculate the distance between two points on the sphere. Both
have some benefits and drawbacks. The spherical law of cosines is widely used in the
industry and it is extracted form harversine formula. It gives the good approximation when
calculating the larger distance on the map. The use of cosines is much easy for the
computation and do not require much process.
The Harversine formula is the old technique used for calculating distance on the map.
Harversine formula can give an accurate result for the shortest distance calculation. But it
needs lot of computational process to do the calculation. It also assumes the earth as a sphere
therefore the calculation may not be accurate while calculating the larger distance.
The application which the author has proposed is specific only for the Jaffna district. Where
the whole Jaffna district lies with in the 60 Km radius and the scope of the application is to
find the nearest temple, therefore the application will deal only with the short distances.
When it comes to computational power, the smart devices are capable of running huge
application in very small amount of time; therefore the computational process will not be an
issue in this application. According to the research it says that the spherical law of cosines is
not good for calculating the short distances on the map. Therefore By consider the advantages
and drawbacks of the each formula and scope of the project i decided to use harversine
formula for calculating distance between two location on the map in this application.




42

5.4 Requirement Specification
The scope of this section is to list down the functionalities of the proposed system. The
requirement specification can be categorized in to four main sections, they are.
1) Functional Requirements
2) Nonfunctional requirements
3) Hardware requirements
4) Software requirements
According to the proposed system the functional and non-functional requirements can be
integrated with in the system to satisfy the requirements found through the analysis section.
The hardware and the software requirements are required to design and develop the proposed
system accordance to the results found through the analysis section.
5.4.1 Functional Requirements
When it comes to the functional requirements the proposed application must be able to get
input from the users, read values from the database for the user specified criteria and display
those results using polygon and circles on the map. Some of the main core functional
requirements of the application are listed below.
The application must take text input.
Application must have a functionally to insert and fetch data from database.
Application must display the fetch results.
Application must call the Third party application such as Google maps in to the
current application.
Application must display markers on the map.
Application must calculate the shortest path.
Application must plot polygon points depending on the shorted distance calculated, on
the map and connect those points to make a polygon.
Application must display the travelling route on the map.
Application must allow the device to send and receive GPS Signals


43

5.4.2 Nonfunctional Requirements
This section will discuss about the characteristics the system should have security, accuracy
and the performance level of the system.
Performance Requirement - the proposed system must have a high level of processing
since dealing with mathematical algorithms and the maps calculations. The good
performance is necessary for the proposed system. The high computation of the
system will accord while calculating the shortest path and communicating with the
database.

Response Time the system must have a good response time while getting the user
input and doing algorithmic calculations. The response time should be reasonable and
should be acceptance for the real time use of the application.


Accuracy The application must maintain at least 75% of accuracy throughout the
system. Because while getting the GPS location the 100% accuracy cannot be
expected in any system and the temples shown on the map must have a accuracy of
more than 75% , to make this application used in the real world situation.

Accessibility - This is not a server side application therefore it can use by one person
in each device at a time.


Security - Since this application uses the network service provider, it is important to
ensure that the system does not uses unwanted or distribute the users personal
information or the device information to any one, without users knowledge.

Portability The system will come as a setup package with all the necessary libraries
necessary for the system to perform it functionality efficiently and allowing the end
users to install the application in any android supported mobile devices without any
additional setups.


44

5.4.3 Hardware Requirements
The minimum hardware required to deploy the proposed system is the Mobile device with the
following hardwares listed below.
1.3 GHz Processor
512MB RAM
1GB ROM
100MB Disk space
GPS receiver
UMTS/GSM/EDGE Network Receiver
WI-FI Receiver (optional if network available)

5.4.4 Software Requirements
The software needed to develop and execute the system are listed below
Operating system Windows 7 or Windows 8
Designing Images Adobe Photoshop CS6
Programing Language Java development environment with Android bundle support
Additional Frameworks Google Map API and Java SDK
Mobile Operating System - Android 2.3 Gingerbread or greater








45

6.0 Selection of Methodology

Methodology is a set of code practice, which is used during the development of software in
order use the available resources and time in a manner that will help to complete the project
as a successfully. According to (Jason Char vat, published by Wiley, NJ, 2003) Over the
years, even those involved in managing projects have observed that projects have common
characteristics that can be formalized into a structural process, which allows them to manage
projects more effectively. Each phase can typically be brought to closure in some logical way
before the next project phase begins; and each phase results in discrete milestones or
deliverables, which provide the starting point for the next phase. When it comes to software
development methodology there are lot of techniques and models available such as
Prototyping model, Linear Sequential Model, Spiral model, Agile Model, Rapid application
Development (RAD) model.

By considering the advantages and the disadvantages of each model and since my project
scope is very small and the time allocated for the development is also very small. I found that
the use the Rapid application development (RAD) model will highly suite my project
compared to other models. RAD is more capable because it is much faster and less error
handling code and also it reduces the risk of over running of time. RAD will helps to build
application faster, cheaper and better. Another great advantage of Rapid application
development model is to provide a vision to the system by creating GUI.

46

6.0.1 Chosen Development Methodology Model.

Rapid application Development Model

Rapid application development (RAD) is an incremental software development process
model that emphasizes an extremely short development life cycle (A Process Model for
Software Architecture, 2007).
According to James Martin, Rapid Application Development is a development lifecycle
designed to give much faster development and higher-quality results than those achieved with
the traditional lifecycle. It is designed to take the maximum advantage of powerful
development software that has evolved recently

RAD is a software development methodology, uses minimal planning favor of rapid
prototyping. The main aim of the RAD is to reduce the time and cost compared to all the
other development methodology. Before starting with the RAD it is important to pre detail
and information to develop the system should be well defined.it is a well flexible
methodology compared to all the other metrologies. The below diagram will give a clear
picture on life cycle of Rapid Application Development methodology. (Rapid application
development. 2013)

Figure 21 - Rapid Application Development (RAD) model

As you can see from the figure 21 not like other metrologies, RAD gives a chance to
redesign or redevelop everything Incase if there is any changes or modification has to be
done. Therefore it is a most flexible metrology and widely used in research based projects.
47

6.2 System Mythology selections

By considering this project requirement and the time limitation of this project I have chosen
RAD Rapid application development methodology for this project. RAD methodology
analysts use special techniques and tools to speed up the analysis, design and implementation
phases of the project. In this case computer Aided Software engineering tools, JAD Joint
application design, visual programing languages that simplify the speed up programing and
code generation that automatically produce from design specification. It is the combination of
SDLC phases and the use of these tools and techniques used to improve the speed and the
quality of the application that is developed.

6.2.1 Stages in RAD Methodology

The RAD methodology mainly has four stages.
Requirement Planning
User design
Construction
Implementation

Requirement Planning
This stage consists of all the review of the area that are directly associated with the proposed
system. This review will produce a broad definition of the requirement specification in terms
of functionalities that the system will support. The deliverables from the requirement
planning stage will include the outline of the system area model and the definition of the
system scope and the cost justification are decided from this stage.





48

User Design
The user design consists of the detailed analysis of the business activities that are related to
the system that is to be developed. The key users, meeting in workshops, decompose business
functions and define entity pass associated with the system. The complete the analysis by
crating the action diagram defining the interacts between process and data. The following
analysis, design of the system is outlined in this stage. System procedures are designed and
the preliminary layouts of the screen are developed. The prototype of the critical procedures
are developed and reviewed. The plan for implementing the system must be prepared in this
stage. (Alan Dennis and Barbara Haley Wixom)

Construction
In this stage a small team of developers working directly with users, finalize the design and
build the system. The software construction process consist of several series of design and
building steps in which the users have the opportunity to test their requirements and review
the resulting software implementation. This stage also includes the preparing for cutover
production. In addition to the tested software, the construction stage deliverables include
documentation and instructions necessary to operate the new application, routine and
procedures need to put the system into operation.


Implementation
This stage involves the implementation of the new system and managing the changes in the
old system environment to the new environment. This may act as the implementation bride
between the old system and the new system by converting the data and training users. The
user acceptance is the final point of the implementation stage.

49

6.2.2 Advantages of RAD Methodology

RAD methodology helps to deliver the system faster in the minimum cost and in insured
quality. Deliverables are easy to port because they make greater use of high level abstraction,
scripts, APIs and intermediate codes. Since the development is conducted at the high level of
abstraction because RAD tools operate at that level. RAD offers the users with easy visibly of
the system because of the prototyping , greater flexibility because the developers can redesign
the system at will and reduction of the manual coding because of APIs, wizards, Code
generators and code reuse. In addition to it RAD tends to shorten the development cycle and
minimize the defects because case tools will generate much of the code for the development
of the application.

6.2.3 Disadvantages of RAD methodology

RAD methodology also has some of the disadvantages. The cost of the integrated tools and
hardware covers a sufficient amount of money. In RAD methodology it is hard to gage the
progress because there are no classic milestones or could less efficient code is not hard
crafted. Another main disadvantage is that there is possibilities of loss of the scientific
precision because no formal methods are used or can accidently empower a return to the
uncontrolled practices of the early days of the software development. It also has the danger
the requirement may not converge because interest of the customers may change from one
iteration to another.
50

7.0 System Design
7.1 Flow Chart


Figure 22- Flowchart diagram for overall System
This is the overall Flowchart of the proposed application. The application will start and then
get the user input for the search criteria. Then the search criteria will be send to the database
to fetch results, if any results found then the application will display the temples to the user
and then draw a circle on the map, then the shortest path to visit those temples will be
calculated and at last the polygon will be drawn on the map. If no results found in the
database it will automatically goes back to get the users input to search the temples.
51

7.2 Use Case Representation


Figure 23 - Use case diagram for overall System

Use Case Elements Description
Use Case Name Main Screen
Primary Actor User
Use Case Description This is the main activity in the application that
has links to all the other activities. All the other
activities are linked from this main screen.
Pre Conditions None
Post Conditions None
Frequency of use One for the first time, when the application
loads.
Special Requirements
Alternatives None



52

Use Case Elements Description
Use Case Name Search Temples
Primary Actor User
Use Case Description Using these Process users will provide the
search related information.
Pre Conditions Database connection must be established.
Post Conditions Users selection must be post at the end of the
process.
Priority Must
Frequency of use Users can change the search criteria any
number of times.
Special Requirements Database
Alternatives None


Use Case Elements Description
Use Case Name Display Temples
Primary Actor User
Use Case Description Using this Process users selection of temples
will be send to the data base and the results are
cached and displayed.
Pre Conditions Database connection must be established.
Post Conditions Results from the database must be post at the
end of the process.
Priority Must
Frequency of use Users can search and get results from the
database any number of times.
Special Requirements Database
Alternatives None


53

Use Case Elements Description
Use Case Name View Map
Primary Actor User
Use Case Description The results from the database for the users
selection will be displayed on the map. With
the geo fencing like circles and the polygon
points will be plotted and the polygons will be
connected.
Pre Conditions Google map API, GPS services and Database
connection must be established.
Post Conditions none
Priority Must
Frequency of use Users can view the map for each search they
provide
Special Requirements Google map API and GPS services
Alternatives None


54

7.3 System Modules
The process of this application is divided in five main modules.

Search Module This is the main user activity in the application, using this activity
users will provide the search location, radius kilometers, temple type and the number
of temples to search. This module will collect the users selections and send the
values to the next module.

Search Results Module This module will collect the information send from the
search module and send those values to the database to find and fetch the results
related to the search information provided and the results from the database will be
displayed in this module.


Database Module This module directly linked to the database and if any quarry
comes to this module, it will send the query to the database and catches the results and
send the results to the following modules.

Location Module This module will help to identify the users location using the GPS
and the Network service provider.

Map Module This module will extract the Google map services form the Google
service to display the map and depending on the results send from the database
module it will display markers on the location and draw a circle boundary depending
on the users search criteria. This module will also display the polygon points and
depending on the shortest distance between the origin points this will draw the
polygon on the map.
In this section each process will be explained with the activity diagram and finally over all
class diagram will be presented at the end of this session.



55


7.3.1 Search Module

Figure 24Activity Diagram (Search Module)

In this Process first the display search window will be displayed to the user. And depending
on the users selection will be cached and the cached vales will be validated and if the values
are good then those values will be posted to the search results process.
56

7.3.2 Search results Module


Figure 25- Activity Diagram (Search Results Module)


In this process the post values from the search module will be collected and validated and if
those values are good and then the database process is called and the vales are send to the
database process to search for the results, if the results exist then the results are displayed in
the display search results module.
57

7.3.3 Database Module


Figure 26- Activity Diagram (Database Module)

This is the database module, this module will first get the database query and then it will
validate the query to check if there is any syntax error in the query. If it the valid query then
the database process is called and the query is passed into the database process. The database
process will return the results for that particular query and those results are cached and
displayed on search results activity.

58

7.3.4 Map Module


Figure 27 - Activity Diagram (View Map Module)
In this Module the coordinates of the temples that are cached from the database module are
passed then the coordinates are validated, if the coordinates are valid the display map process
is called and the map is displayed. Then the map markers process is called and the
coordinates are passed in, this will plot the temples on the map. Then the draw circle process
is called and the radius is passed in, this will draw the circle on the map. Then the polygon
process is called and the coordinates are passed in, this will plot the coordinates on the map
and the draw the polygon for the plotted points and at last the display map view activity is
called to display all the stuff on the Screen.
59

7.4 Over all Class Diagram

Figure 28- Over all Class Diagram
60


The above figure is the overall class diagram for the proposed application. The class diagram
is generated using the tool called eUML2 Studio Evaluation. The variables and the methods
in the each class are displayed separately and the classes are lined with each other. The
Db_results is the main database base class which will handle all the database activities in the
proposed application and it has two sub classes called Temple Adapter and View Holder.
These classes imported to the class called kovil, the Kovil class is the bride between the
application and the database, and this will handle all the values that come and go out of the
databse to the application. DB handler is the class that is used to fetch information from the
database e.g.: the DB handler class has a method called Get Temple () which will
communicate with the database and get the required temples for the query. View Map is the
class used to view map on the application, the view map class also has methods to calculate
the shortest distance on the map, draw polygon, draw circle and display the markers on the
map.

61

7.5 Sequence Diagram
This is the overall Sequence diagram of the proposed application. The main class calls the
search class on create method and the search criteria is send to db_results class from where
the search criteria is send to DB_handler, from DBhandler the results are send to Temple
Adapter to Dbresults from Dbresults the Database results are send to search results. Then the
view map methods are called which then calls the distance calculation and compare distance
form Distanceinfo class. Then the view map will call its own method to draw polygon, circles
and display markers.
Figure 29 - Sequence Diagram
62

8.0 Implementation
8.1 Development Environment
Since the system is the android application. I have used java programing language for the
development of this application. I have used adobe Photoshop cs6 for designing the back
ground images in the application and eclipse development environment with java 7 runtime
environments long with android development kit. I have also used some third party
application such as Google Map API v2 for the development of this application.
8.2 System Development
The system was implemented according to the design proposed in the above section. The
implementation section is done in the module wise as shown in the design. The design was
mapped in to code and some of the major section of code in the implementation section is
explained below.
8.2.1 Search Module

8.2.1.1 User Input

The above code will help to create an interface for the users to give input to the application.
In the application author uses two tools to get input from the users they are Spinners and Edit
text. The Spinners act as the dropdown menu and the Edit text is the simple text input tool.in
the above code author is initiating the each tools id to the variable, so that that user input can
be collected and used for further process.




63

8.2.1.2 Explicit Intent

The above code will helps to get the users selection or the input values from the respective
tools and assign it to the variables so that the users search criteria can be passed to other
intents using explicit intent, the putExtra(); is the method in the explicit intent which will pass
the values from one activity to another. As you can see from the above code snippet the user
input values are collected and assigned to the respective variable inside the putExtra method
then the putExtra method is passed in to the next intent.

64

8.2.2 Database Module
This module will take care of all the database actions between the application and the
database.
8.2.2.1 Creating database

The above code snippet is the basic field need to create the database. To create the database
the following fields must be provided Database version, Database name, Table name and the
column names. Then the array list is created to store the column values for the database as
shown in the above snippet.

This code snippet will first check for the version of the database is the database version
matches with the current version or newer than the old version it will add the values to the
database.
65

8.2.2.2 Inserting values to the database

This section of code will helps to add temples to the database. The method will take the
argument of the temple list called kovil, then it will open the writable database and then
arrange the values to be inserted with the database column variables, then the arranged
temple list is passed in to the database insert method which will insert the values in to the
database.
8.2.2.3 Fetching values from Database

The above method will take two arguments the temple type and the number of temples.
Depending on those arguments the application create the SQL quarry and the quarry will be
passed in to the database to fetch the results and each section of results is bonded as the string
and returned through the variable results.
66

8.2.2.4 Count total records

The above code snippet will take the no arguments to the method, using the select quarry. It
will open the database in the readable mode and pass the quarry to the database. Then using
the cursor for the selected results the count function is used to count the total number of
records in the database.

8.2.3 Search Results Module
This module will display the results for the users search.
8.2.3.1 Temple Adapter

This is the temple adapter calls which extend the array adapter. This class will take the values
from the database and pass it in to the call called Kovil, in the kovil class the database results
are arranged in to the kovil array list and those results are taken in to the adapter called
tAdaper.

67

8.2.3.2 Displaying the DB Results

This function called collect will take the arguments such as temple type and the limits from
the users input and create a SQL quarry for the users selections. Then it will pass the quarry
to the database to fetch results.

In the front end using the text view the collect function from the class DBhandler is called
and temple type, limit is passed as the arguments and the results are directly taken in to the
text view to display it to the user.





68

8.2.4 Location Module
8.2.4.1 Network Service provider Location

The above code snippet helps to get the location of Network service provider of the users
service provider.it will get the location of the tower from where the users is getting the
network signals. The LocationManager is the prebuild class in the Google API, using this
Location manager we can call the network provider to give last known location or the tower
from where the last signal is received. Using the function called getLatitude() and the
getLongitude() which are prebuild function in the location manager , we can get the latitude
and the longitude of the service provider location. Which are then displayed in the text view
called latlong. This location can also be used as the uses location to provide the service for
the user.
8.2.4.2 GPS Location

69

The above method is used to get the best location of the user first it will call the location
manager of the GPS provider and initiate the location time depending on the GPS time
interval we set it will check if the time period is expired or not, if expired ten it will ask for
the new GPS location if the GPS location cannot be received it will ask the location of the
network service provide to identify the users location.
8.2.5 Map Module
This module it used to display map and map objects to the user.

8.2.5.1 Importing Google maps

The above code helps to import the Google maps in to the application. The
com.google.android.gms.maps.GoogleMap will import the whole library in to the
application and Google Map mmap we can call the only the map service in to the
application.





70

8.2.5.2 Drawing Circles on Map

The above code will help to draw the circle on the map. This function will take two
arguments such as center location and the radius, since the author is testing the application
with the mock location; the author has set the center to a default location. Then the function
get the radius as the argument sin the user provide the radius in KM first the author converts
it to meters by multiplying the radius with 1000 then it is passed in to the application to draw
circle on map.
8.2.5.3 Drawing Polygons on the Map

The draw polygon function will take the array list as the argument. First it will call the default
polygon class and set its default fields and add the initial point of the polygon. Then it will
take the array and check it there is any points in the value with less than 0 values if not it will
add the polygon points and pass those points to the addpolygon function in the Google map
API class.
71

8.2.5.4 Displaying Markers

This function is used to create markers on the map. This function takes three arguments such
as latitude, longitude and the temple name. Depending on the latitude and longitude it will
place the marker and add the temple information to the markers detail section.

8.2.5.5 Calculating distance Harversine Formula

The harversie formula will take the arguments of two latitude and two longitude points of the
location, then it will convert the degree to radians and use the harversine formula to calculate
the distance between two locations on the map. The above function can calculate the distance
in kilometer and then it can be converted to meters using the function HarversineInM();
which will return the distance between two location in meters.

72

8.2.5.6 Calculating distance Spherical Law of Cosines

This is a mathematical function which will take the two latitude and longitude and return the
distance between those two locations. The R is the mean distance between the earth and the
satellite therefore that is constant and R=6371. At last the function will return the distance.
8.2.5.7 Checking map service

The services ok method is used to check whether the map service is available for the
application.it will return the success message if the service is available if not that will return
the error message and reason for why the map is not loading.


73

8.2.5.8 Setting default location

The above code will help to set the mock location on the map. It takes in three arguments
such as latitude, longitude and the zoom level. Depending on the latitude and the longitude it
will set the default location on the map and using the camera update function that will set the
zoom level for the map.

74

9.0 Testing
9.1 Test Plan
The testing for this application is done according to the implementation stages mentioned in
above section. The application was tested under three testing strategies. The three strategies
are mentioned below.
Unit Testing
Integration Testing
System Testing
9.2 Unit Testing
The objective of unit testing is to assess the functionality of the section or segment of code,
usually in the functional level. This testing method is used to ensure the building block
components of the system are working perfectively and independent to each other.
9.2.1 Search Module
Main Screen
Test case 1.0
Case title Application launching or running at the start
Description Application should launch successfully with
no errors. At this point the application must
be ready to accept user input and the user can
now interact with the application
functionality now.
Input Launch the application
Expected output The main screen in the application must start
with our any errors and the button to search
temples must be displayed.
75

Actual output

Test result Target achieved



User Search

Test case 1.0
Case title Accepting user input and passing to the next
activity
Description At this point the application must accept the
user input and pass the user selected values to
the next activity.
Input Accepting users selected values
Expected output Accept the user selected vales and pass it to
the next activity.
76

Actual output



Test result Target achieved

77

9.2.2 Search Results Module
Display the DB Results
Test case 3.0
Case title Get associated results from database
Description The application must pass the user selected
dated to the database and get the results from
the data base.
Input User selected values
Expected output List of temples must be displayed on the
screen.
Actual output

Test result Target achieved



78

9.2.3 Location Module
Test case 4.0
Case title Display users GPS Location
Description The application must communicate with the
Network service provider to get the users
location details or use GPS to communicate
with the users current location and display
for the user.
Input Location Request through GPS or Location
Service provider
Expected output Display the Latitude and the Longitude of the
users location.
Actual output

Test result Target achieved


79

9.2.4 Map Module
Displaying the Map
Test case 5.0
Case title Viewing temples on map
Description The application must display the Google map, the markers for
each temple location for the results that are acquired from the
database, draw circle according to the users expected kilometers
and the polygon points must be plotted and the polygon points
must be connected with straight lines.
Input Database results
Expected output The application must display the map with circle, map markers for
each temples and the polygon must be drawn for temples
depending on the distance.
Actual output

Test result Target achieved


80

8.3 Integration testing
Integration testing is the extension of the unit testing, once the unit testing is integrated with
the logical program. The integrated testing is the process of examining the work behavior of
the particular unit after embedding with program. This process will identify the problems that
occur while combining several units into one.
The main components of this application are
Mapping and LBS
Geo- Fencing

In the integration testing the mapping and LBS are tested separately, which helps to build the
mapping application with high amount of security, the mapping application is secured by
providing the SHA1 finger print to the Google code services and API key that is returned
from the Google is used I this application to ensure the security of the mapping section of this
application. The application also uses the geo fencing algorithm, which uses to create virtual
fencing on map. Since this service is provided by Google, therefore the security and the
privacy of the users are well conserved. And all the other algorithms that are used in this
application are well developed to ensure the security and the privacy of the users.
The proposed system is also developed in a way that the output of one component is taken as
the input to other component. Since all the main modules have been tested in the unit testing
section and those testing was success and input and the output gives the result according to
the expectation.







81

8.4 System Testing
System testing is done at the end of the development process after integrating all the
components in the system to ensure the accuracy of the application. The objective of this
system testing is to verify the location of each temple is provided accuracy and the geo
fencing are done with in the users expected range.
The system was tested after completing the development process and the results as follows.
Input Output Accuracy (%)
Users provide search criteria Pass the user selected vales to
the next activity
100
Search criteria Send the search criteria to the
database and catch results
from the database.
100
Database results Display markers on the exact
temple location
70 90
User selected distance Draw the circle on the map
depending on the users
selected distance
80 - 95
Database results Plot the polygon points on the
map and connect the points to
make a polygon
50 - 70

Therefore the overall system accuracy is almost 80% to 90 %. This accuracy level is above
the required accuracy level of 75%.





82

10.0 Limitation and Further Enhancements

Limitation
This application can perform only one function at the time.
The application will be accurate only for the short distance.
Application can do only one search at a time.
Only the temples in the database can be displayed to the user.
Jaffna clock tower is the only mock location added to this system.


Further Enhancement
Keeping the temple data in the remote server.
Allows users to add new temple to database.
Getting users feedback in the application.
Showing the direction to temples through the rode rote.
Making the application supportable for older versions of Android
Adding more Temples to the database.
Displaying the details of each temple.
Making the location pointers more accurate.
Reducing the use of GPS and use other technologies to improve the battery power.
Adding features for the users to give comments on each temple.
Using the latest Google map API V3 to improve user friendliness of map.




83

11.0 Conclusion
The main objective of this project is to develop a mobile application that locates the nearest
temples in Jaffna depending on the users requirement. The application must also find the
temples depending on the users preferred area and provide the user with the shortest path to
visit those temples. To achieve the goals of this project author has done research on the
various topics such as Location Based services, Geographical Information System, Global
Positioning System, Map Collaboration, and Geo fencing. Researchers conducted on these
technologies helped the author to gain the knowledge on these technologies, made it possible
for completing this project successfully. The technical research helped the author to know
how they can be used in this application to achieve the final goal of this project. In this report
author also have done researches on Android mobile devices and its framework. This made
the author to understand the key components of the Mobile application and how the research
technologies can be implemented in to these devices to achieve the goal of the project.
This report also includes methodology section and how that methodology will help to
accomplish the task of this project in the given time. This report consists of analysis section
which will discuss on the suitable technology for this project, how and when can be
implemented in this application. This report also contain designing , implementation and
testing section which will explain about the reasons for selecting the particular technology,
how the design of the system was created , how the system was implemented and how the
system was tested to make it a successful project.
The researches and the techniques used in this report made the author to make this project a
success one. Also it made this application to the standard that can be used in the real world
environment.
Although this successful and can be used in the real word. The author suggests that there are
some alterations that can be made for this application to make it even suitable for the real
world environment. Those suggestions are discussed in the further enhancement section in
this report. By considering the overall functionalities of this application the author is really
stratified and recommends that this application can be used in real environment to find the
nearest temples from the users location and get the shortest path to visit that temple.


84


11.1 Critical Appraisal

The objective of this project is to develop a mobile application that helps the uses to identify
the nearest temples from the users location and calculate the shortest path to visit those
temples and display it to the user. The solution for this project was found using the research
section. Author had done many researches on the topic that are relevant for the development
of this application; these researches helped the author to gain more knowledge on those
technologies and how to use those technologies in the application. During the development
of this application author has faced many difficulties and how the author overcome those
difficulties to make this project as successful one is discussed below.
First of all the author is extremely new to the java programing language and android
application development, therefore it took a long time for the author to learn the basic of
these technologies and languages, but when the author have learned the basics of the android
platform then the development part has become just simple to develop it according to the
proposed design.
In the development stage author first started with developing the application with the remote
database and use of JSON to communicate with the application and the database. But after
several tries the author was unable to get the data from the remote database in the way the
application needed it. Therefore the author decided not to waste time on remote server
database and decided to use the local SQLite database for storing temples for this application.
Because the author is new to SQLite database, in the implementation time author has faced
several difficulties but using the stackoverflow.com to post each difficulties and getting
suggestion from users the author was able to overcome those difficulties very easily. This had
given the author the experience to tackle difficult situation without the help of others.
The Author had spent lot of time to develop the map module; the main challenging task in
this application is adding the Google map to this application and drawing shapes on the map.
Adding Google maps to the application is not the easy task; the author has spent 3days to get
the map loaded in to the application. The season for this long duration is because the author
was not aware of submitting the correct project name, android package name and SHA1
fingerprint to the Google in order to get the APIKEY for this application and most of all the
85

Google map API v2 must be switched on in the developers Google API console account and
agree the terms and conditions to use the Google maps API. It took a lot of time for the
author to understand these formalities to get the Google maps in to the application. Although
this look a lot of time this has given the author an idea basic know of registering for the
Google API and using it in the application.
Another main difficulties faced during this application is the testing; testing with the mock
location can be done by the author at any place. But testing the application in the real
environment consumes more time and money. Since the author was unable to travel to Jaffna
for testing the application, the author has given the application to the some public users in the
Jaffna district to test this application in the real environment. In this case the author has to
believe on the people who tested this application in the real time.
Although the author had faced lot of problems from the initial stages till the end of the
development and testing of the system. But due to the continuous support of my supervisor
the author was able to overcome all the problems and complete this project as a successful
one. Most of all the author had learned lot technologies and techniques about android and
how they can be used in the mobile application development. Through which the author have
gained a lot of knowledge. This is a really a challenging work and the author is fully satisfied
with the final output of this application and hope this knowledge and experience will help the
author throughout his carrier.


86

12.0 References

A Process Model for Software Architecture, 2007 [online]
https://www.google.lk/url?sa=t&rct=j&q=&esrc=s&source=web&cd=2&ved=0CDUQFjAB
&url=http%3A%2F%2Fciteseerx.ist.psu.edu%2Fviewdoc%2Fdownload%3Fdoi%
[Accessed: 20 October 2013]
Android SQLite database, 2013. Android SQLite database and content provider - tutorial.
[ONLINE] Available at: http://www.vogella.com/articles/AndroidSQLite/article.html.
[Accessed 15 October 2013].

Android Developers. 2013. Android, the world's most popular mobile platform | Android
Developers. [ONLINE] Available at: http://developer.android.com/about/index.html.
[Accessed 18 October 2013].
Bing Maps. 2014. Bing Maps: Choose Your Bing Maps API . [ONLINE] Available at:
http://www.microsoft.com/maps/choose-your-bing-maps-api.aspx. [Accessed 05 March
2014].
C. Haseman, Android Essentials, PDF Electronic Book, 2008. Available from:
http://androidos.cc/dev/index.php. [Accessed 18 October 2013].
Department of Hindu Religious and Cultural Affairs. 2013. Department of Hindu Religious
and Cultural Affairs. [ONLINE] Available at: http://www.hindudept.gov.lk/web/. [Accessed
27 August 2013].
PCWorld. 2014. Google Maps vs. Bing Maps: A Showdown of Satellite Images | PCWorld.
[ONLINE] Available at:
http://www.pcworld.com/article/258328/google_maps_vs_bing_maps_a_showdown_of_satel
lite_images.html. [Accessed 05 March 2014].
GPS.gov, 2013. Welcome to GPS.gov. [ONLINE] Available at: http://www.gps.gov/.
[Accessed 15 October 2013].
ISD-GIS Home. 2013. San Bernardino County ISD-GIS Home. [ONLINE] Available at:
http://gis.sbcounty.gov/default.aspx. [Accessed 25 October 2013].

87

Global Positioning System (GPS), 2013. How does the Global Positioning System (GPS)
work ?. [ONLINE] Available at: http://www.pocketgpsworld.com/howgpsworks.php.
[Accessed 25 October 2013].
Haversine formula, 2013. Calculate distance and bearing between two Latitude/Longitude
points using Haversine formula in JavaScript. [ONLINE] Available at: http://www.movable-
type.co.uk/scripts/latlong.html. [Accessed 25 October 2013].
Geographic Information Systems Stack Exchange. 2014. algorithm - Why is law of cosines
more preferable than haversine when calculating distance between two latitude-longitude
points? - Geographic Information Systems Stack Exchange. [ONLINE] Available at:
http://gis.stackexchange.com/questions/4906/why-is-law-of-cosines-more-preferable-than-
haversine-when-calculating-distance-b. [Accessed 03 March 2014].
Haversine formula | MrReid.org. 2014. Haversine formula | MrReid.org. [ONLINE]
Available at: http://wordpress.mrreid.org/2011/12/20/haversine-formula/. [Accessed 03
March 2014].
Jason Charvat, published by Wiley, NJ, 2003 [online]
https://www.google.lk/search?q=Jason+Charvat%2C+published+by+Wiley%2C+NJ%2C
+2003&aq=f&oq=Jason+Charvat%2C+published+by+Wiley%2C+NJ%2C+2003&aqs=chro
me.0.57j0.159&sourceid=chrome&ie=UTF-8 [Accessed: 20 October 2013]
kebomix, 2010. Android System Architecture. [Online] Available at:
http://kebomix.wordpress.com/2010/08/17/android-system-architecture/ [Accessed 20
October 2013].
Kolodziej, K. &Hjelm, J. (2006). Local Positioning Systems: LBS Applications and Services,
CRC Taylor & Francis.
Kupper, A. (2005). Location-Based Services: Fundamentals and Operation. Wiley.
SQLite. (N.D.a). About SQLite. Retrieved from October 06, 2013, from
http://www.sqlite.org/about.html
Latitude & Longitude Haversine Formula. 2014. Latitude & Longitude Haversine Formula.
[ONLINE] Available at: http://www.longitudestore.com/haversine-formula.html. [Accessed
03 March 2014].

88

Location-Based Services - Chronology - Geoawesomeness. 2013. Location-Based Services -
Chronology - Geoawesomeness. [ONLINE] Available at:
http://geoawesomeness.com/knowledge-base/location-based-services/location-based-
services-chronology/. [Accessed 15 October 2013].
Location-based service (LBS): Categories of Methods, Techniques and Technologies. 2013.
Location-based service (LBS): Categories of Methods, Techniques and Technologies.
[ONLINE] Available at: http://www.mediabuzz.com.sg/archives/2012/march/1529-location-
based-service-lbs-categories-of-methods-techniques-and-technologies. [Accessed 15 October
2013].
P. Massatt and W. Brady, \Optimizing Performance through ConstellationManagement,"
Crosslink: The Aerospace Corporation magazine of advancesin aerospace technology, vol. 3,
no. 2, summer 2002. [Online].
Available:http://www.aero.org/publications/crosslink/summer2002/03.html

Rapid application development. 2013. RAPID APPLICATION DEVELOPMENT. [ONLINE]
Available at: http://www.cs.bgsu.edu/maner/domains/RAD.htm. [Accessed 25 October
2013].
Spherical Trigonometry. 2014. Spherical Trigonometry. [ONLINE] Available at:
http://www.johndcook.com/spherical_trigonometry.html. [Accessed 03 March 2014].

Steiniger, S., Neun, M., &Edwardes, A. (2006). Foundations of Location-Based Services.
Retrieved January 13, 2012, from
http://www.geo.unizh.ch/publications/cartouche/lbs_lecturenotes_steinigeretal2006.pdf

S. Sarker, D. E. Campbell, J. Ondrus, and J. S. Valachich, Mapping the need for mobile
collaboration technologies: a _t perspective," International Journal of e-Collaboration, vol.
6,no. 4, pp. 32-53

Technowizz's Blog, 2013. Location Based Services Part II: LBS Network Architectures |
Technowizz's Blog. [ONLINE] Available at:
http://technowizz.wordpress.com/2010/01/12/location-based-services-architectures/.
[Accessed 13 October 2013].
89

Telecom Systems, 2013. TCS | Location Based Services (LBS) | Overview . [ONLINE]
Available at: http://www.telecomsys.com/products/location-based-services/default.aspx.
[Accessed 25 October 2013].
Wolfram MathWorld. 2014. Spherical Trigonometry -- from Wolfram MathWorld.
[ONLINE] Available at: http://mathworld.wolfram.com/SphericalTrigonometry.html.
[Accessed 03 March 2014].







90

Appendix

S-ar putea să vă placă și