Shortest Path Navigation Application on GIS

advertisement
Shortest Path Navigation
Application on GIS
Supervisor: Dr. Damitha Karunaratne
Thilani Imalka
2007/MCS/023
Road Map
Introduction
 Motivation
 Architecture/Design
 Implementation
 Problems encountered and solutions
 Testing
 Future enhancements

Introduction
 Geographical Information Systems (GIS)
 Information system
 Store, capture, analyze, manage and present all forms of
geographically referenced data.
 Currently there are many number of GISs are available
such as Google Earth, Yahoo Map etc...
 Shortest Path



Navigation is a main application in location based
systems.
Shortest path analyses - commonly based on vector maps.
Used to calculate the shortest path between two points in
a network or route.
Shortest Path Algorithms

In graph theory, It’s the problem of finding a path between two
vertices (or nodes) such that the sum of the weights of its
constituent edges is minimized.
 Ex: On a road map; vertices  locations & edges  roads.

Dijkstra's algorithm –
 Solves the single-source shortest path problem, with non
negative edge path costs, common in routing.

Bellman-Ford algorithm
 Label correcting algorithm, computes single-source shortest
paths in a weighted digraph

A* search algorithm, Floyd Warshall algorithm and Johnson's
algorithm.
GIS Navigation related Applications

MapQuest
 Its a map publisher and a free online Web mapping service
owned by AOL.
 Lets users automatically find their locations and locate nearby
points of interest; ex: airports, hotels, banks and ATM

Google Maps
 Free web mapping service application and technology
provided by Google.
 Google street view is a new feature of Google Maps which
provides 360 panoramic street-level views of various U.S.
cities.

Yahoo Maps
Motivation




The road network is much more complex.
It’s very difficult to find and navigate through an
optimal path between two locations without any
guidance.
There’re some commercially available GIS navigation
applications exists, but they are very expensive and
cant utilize them into public.
Some freely available web navigation systems exits,
But can’t applicable to Sri Lankan road network.
Goals and Objectives

Goals




Design a user friendly; web based application to
calculate the shortest path or route between user given
locations.
Returns a map with the shortest route being highlighted.
To calculate the shortest path, Use the famous shortest
path algorithm, Dijkstra’s.
Objectives

Minimize Cost.
Operates in an easy manner.
Save time.
Applicable to Sri Lankan road network.

Manage resources.



Scope








User should enter the exact starting location and end location in the
given GUI (text boxes).
Locations should be given as coordinates (longitudes, latitudes).
Two ways of doing that.
User should be able to enter the exact starting location and end
location in the given GUI (text boxes), or
By using the pointing device.
System supports only for a single end location, not for multiple
destinations at a time.
Output will highlight the shortest path on the map. But not display
directions, estimated time for the journey etc…
If the given locations are not located exactly on the road, the
system will calculate the nearest road for those locations first.
Related Technology

PostGIS



MapServer


PostGIS is a database which is supporting for Geographic
Information Systems.
Extension for well known PostgreSQL object-relational
database
Open Source development environment for building spatiallyenabled internet applications.
OpenLayers


Pure JavaScript library for displaying map data in most
modern web browsers
No server-side dependencies.
Architecture/Design
Architecture/Design

The system deployed on Tomcat, which is a servlet
container. All the applications are running on top of the
Tomcat.

Using Spring MVC Java application framework.




Very flexible
Entirely based on interfaces.
Easier to test
Using JSP to design user interfaces.



More powerful
Portable to other operating systems
Contains dynamic information
Implementation –Class Diagram
Implementation – Dijkstra’s
algorithm

Initialize single source







Iterate all the vertexes.
Set the distance of those vertexes to infinity
The distance of the source vertex is set to zero.
Iterate all the vertexes.
Extract the minimum distance node
Get the adjacent node for minimum distance vertex
Perform the relaxation

Relaxing and edge (u,v) consists of testing whether the
shortest path to v found so far can be improved by going
through u.

Perform the resulted shortest path
Problems encountered and
solutions

Extracting x,y coordinates of roads from the table




Geometry information stored in the_geom column as MultiLine
strings. Those consists of Line strings.
Line strings are collection of point vectors. Point vectors are
consists of points. Point contains x,y coordinates.
Have to go far to obtain x,y inorder to perform shortest path.
All the roads are isolated.


Each record in the roads table contain information about 1
particular road. Can’t identify whether there’re joins with other
roads by looking at the_geom column.
Had to perform a computation to check x,y coordinates of
each road using the_geom value, and had to check joins of
roads using separate x,y coordinates of each road.
Problems encountered and
solutions

Find out adjacent nodes per each and every vertex






In order to perform Dijkstra’s need to deal with adjacent
nodes per vertexes.
No any information about adjacent nodes available with
data.
It was provided by implementing a static table which is a
simplified version of the roads table.
Even though it generates only once, no matter since the
road network is static.
It contains all the point vice information
The table consists of adjacent node information of each
and every node.
Problems encountered and
solutions

Find out adjacent nodes when roads are intersecting
Problems encountered and
solutions

Identify x,y coordinates of the mouse on click event
and the way to get the nearest road for a point which
is not on the road




Used the openlayers click function to get the longitudes
and latitudes of the clicked position.
Created a circle (zone) for the point with radius = 100
and find whether there any near roads to the point.
If not found increase the radius of the circle by radius * 2
and find near roads.
All the roads resulted as near to the point is stored in an
array. Sort the array according to the distance and
results the 1st element in the array as the nearest road
for the point.
Problems encountered and
solutions

Displaying the shortest path on the map







The result should be seen on the map as a highlighted path
Two ways of generating a dynamic layer.
Generate with OpenLayers – Bit harder as it’s fully deal with
OpenLayer’s java script library.
Generating the layer with dynamically created database table
If so, the resulted graph is represented as vertexes, This table
consists of only one row, which represents the shortest path
for given two locations.
Shortest path information will project on to the dynamically
generated layer.
For every shortest path calculation, this table will delete the
existing record and insert the new record with new geometry
including shortest path information.
Testing


Testing started while implementing the system and
after implementing the system.
Testing the algorithm implementation




Dynamic layer generation to display the highlighted
shortest path



Dijkstra’s algorithm divided into sub functionalities.
Sub functionalities were tested using junit test cases.
After implementing the algorithm if the success rate of jUnit
test cases is 100% the algorithm is correct.
Loading resulted shortest path into the dynamictable and
display the shortest path on a dynamically generated layer
and highlight the path tested manually with samples.
Overall functionality testing
GUI testing
Future enhancements

Provide the main functionality as SOAP web services
which is align to OGC standards. Any one can use.
 Reduce the processing area of the map by cropping
down the map only into the needed points.
 Display more than 1 shortest path, if there are.
 Provide a facility to input text based locations rather
than giving longitudes and latitudes.
 Can provide more information as driving directions,
estimated time for the journey and road conditions etc.
 Traffic conditions of roads can be considered as a
weight here, there should be some mechanism or a
specific person to update the traffic condition
accordingly.
Thank You !!!
QUESTIONS???
Download