Jaffna Temples - FYP - Sathyabaman

Embed Size (px)

Citation preview

  • 8/10/2019 Jaffna Temples - FYP - Sathyabaman

    1/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

    6th

    March 2014, Colombo

  • 8/10/2019 Jaffna Temples - FYP - Sathyabaman

    2/101

    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)

    mailto:[email protected]:[email protected]:[email protected]:[email protected]
  • 8/10/2019 Jaffna Temples - FYP - Sathyabaman

    3/101

    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 shortestpath 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 GeoFencing

    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 ofall the entire project will give a good

    idea on mobile app development using the location based services.

  • 8/10/2019 Jaffna Temples - FYP - Sathyabaman

    4/101

    iii

    Acknowledgement

    I am greatly thankful to my supervisor Mr. Balachandran Gnanasekaraiyer for assisting andguiding 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.

  • 8/10/2019 Jaffna Temples - FYP - Sathyabaman

    5/101

    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

  • 8/10/2019 Jaffna Temples - FYP - Sathyabaman

    6/101

    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 GeoFencing 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

  • 8/10/2019 Jaffna Temples - FYP - Sathyabaman

    7/101

    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

  • 8/10/2019 Jaffna Temples - FYP - Sathyabaman

    8/101

  • 8/10/2019 Jaffna Temples - FYP - Sathyabaman

    9/101

    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

  • 8/10/2019 Jaffna Temples - FYP - Sathyabaman

    10/101

    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 5Difference 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

    http://c/Users/baman/Desktop/FYP%20Final/Jaffna%20Temples%20Final%20doc%20v4.docx%23_Toc381864746http://c/Users/baman/Desktop/FYP%20Final/Jaffna%20Temples%20Final%20doc%20v4.docx%23_Toc381864746http://c/Users/baman/Desktop/FYP%20Final/Jaffna%20Temples%20Final%20doc%20v4.docx%23_Toc381864746
  • 8/10/2019 Jaffna Temples - FYP - Sathyabaman

    11/101

    x

    Abbreviations

    LBSLocation Based Services

    GPSGlobal Positioning System

    GIS - Geographical Information System

    API - Application programming interface

    RAD - Rapid application development

    REST - Representational State Transfer

    WPFWindows Presentation Foundation

  • 8/10/2019 Jaffna Temples - FYP - Sathyabaman

    12/101

    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,

  • 8/10/2019 Jaffna Temples - FYP - Sathyabaman

    13/101

    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.

  • 8/10/2019 Jaffna Temples - FYP - Sathyabaman

    14/101

    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 userswith 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 mustdisplay 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.

  • 8/10/2019 Jaffna Temples - FYP - Sathyabaman

    15/101

    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 ResearchThis 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.

  • 8/10/2019 Jaffna Temples - FYP - Sathyabaman

    16/101

    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 suitabledevelopment 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 thesystem 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.

  • 8/10/2019 Jaffna Temples - FYP - Sathyabaman

    17/101

    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 handlethe 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

  • 8/10/2019 Jaffna Temples - FYP - Sathyabaman

    18/101

    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/10/2019 Jaffna Temples - FYP - Sathyabaman

    19/101

    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.

  • 8/10/2019 Jaffna Temples - FYP - Sathyabaman

    20/101

    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 developingthe 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 theform 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

  • 8/10/2019 Jaffna Temples - FYP - Sathyabaman

    21/101

    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-uniformarrangements in order to improve the accuracy of the location and take action at the time of

  • 8/10/2019 Jaffna Temples - FYP - Sathyabaman

    22/101

    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)

  • 8/10/2019 Jaffna Temples - FYP - Sathyabaman

    23/101

    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 theALMANAC 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

  • 8/10/2019 Jaffna Temples - FYP - Sathyabaman

    24/101

    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.

  • 8/10/2019 Jaffna Temples - FYP - Sathyabaman

    25/101

    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 originalversion of the Bing maps id lacking of its distinguishing features including 3Dmaps and

    birdseye 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 5Difference 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)

  • 8/10/2019 Jaffna Temples - FYP - Sathyabaman

    26/101

    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 keyfunctionalities 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)

  • 8/10/2019 Jaffna Temples - FYP - Sathyabaman

    27/101

    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 theshortest 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

  • 8/10/2019 Jaffna Temples - FYP - Sathyabaman

    28/101

    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.

  • 8/10/2019 Jaffna Temples - FYP - Sathyabaman

    29/101

    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 andare 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.

  • 8/10/2019 Jaffna Temples - FYP - Sathyabaman

    30/101

    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.

  • 8/10/2019 Jaffna Temples - FYP - Sathyabaman

    31/101

    20

    3.12 Use of GeoFencing in this project

    GeoFencing 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 userexpected 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 usersinterest.

    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 usersmovements 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

  • 8/10/2019 Jaffna Temples - FYP - Sathyabaman

    32/101

    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

  • 8/10/2019 Jaffna Temples - FYP - Sathyabaman

    33/101

    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 thefirst 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)

  • 8/10/2019 Jaffna Temples - FYP - Sathyabaman

    34/101

    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 includesapplications 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.

  • 8/10/2019 Jaffna Temples - FYP - Sathyabaman

    35/101

    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 allthe 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

  • 8/10/2019 Jaffna Temples - FYP - Sathyabaman

    36/101

    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

  • 8/10/2019 Jaffna Temples - FYP - Sathyabaman

    37/101

    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 theynavigate 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.

  • 8/10/2019 Jaffna Temples - FYP - Sathyabaman

    38/101

    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.

  • 8/10/2019 Jaffna Temples - FYP - Sathyabaman

    39/101

    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);

  • 8/10/2019 Jaffna Temples - FYP - Sathyabaman

    40/101

    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 numbersways 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 Zis the north pole of the sphere and

    consider the planePas the tangent to the sphere at the point Z. Extent the ray from the center

    o of the sphere through the point Xto the planeP. Uis the intersection between the projected

    ray and the plane. Someway extent the ray from Othrough YtoPand 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 ZUand ZW

  • 8/10/2019 Jaffna Temples - FYP - Sathyabaman

    41/101

    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

    DDifference 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)

  • 8/10/2019 Jaffna Temples - FYP - Sathyabaman

    42/101

    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)

  • 8/10/2019 Jaffna Temples - FYP - Sathyabaman

    43/101

    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 anapproximation 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 Won the Sphere. As shown the below diagram.

    Figure 19 - Harversine rule on sphere

    If the lengths of three sides are UV, UW, VWand the angle of the Conner opposite to c is C.

    Then this law of Harversine can be used. (Latitude & Longitude Haversine Formula. 2014)

  • 8/10/2019 Jaffna Temples - FYP - Sathyabaman

    44/101

    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//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)

  • 8/10/2019 Jaffna Temples - FYP - Sathyabaman

    45/101

    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 asubclass 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 beexecuted 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)

  • 8/10/2019 Jaffna Temples - FYP - Sathyabaman

    46/101

    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 calledAerial 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 webservices makes the developers application highly usable by the users.

  • 8/10/2019 Jaffna Temples - FYP - Sathyabaman

    47/101

    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 informaltechniques 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 per