Question

I need to find shortest path from one place to another place.

For example, when I enter into a particular shopping mall, I have to find the shortest path from my current shop to my destination shop within the same mall in offline mode.

As per my search, I finalized to implement this concept in A* Algorithm. Can anybody tell me whether it's a correct way? Other than this, is there any other way to implement this?

Was it helpful?

Solution

You may use dijkstra algorithm for this, though A* has an advantage but dijkstra has more resources. A* for me is harder to understand.

You can create static nodes or vertices and use them for dijkstra. Just traverse on the nodes, and make sure that you can measure the distance of each node or vertex so that you can compare the shorter one, then eventually you can have the shortest path. You may create a map that contains nodes or vertices with distances for each related vertices to help you program. This is a bit of a challenge.

I don't have my codes right now but I guess the net can better help you. Good luck with this. Happy coding.

enter image description here

Dijkstra's algorithm

OTHER TIPS

Just check these link for offline map library.

1) Osmdroid. 2) Tutorial 3) Mapsforge 4) Offline map using mapsforge

By using the below method you can calculate the shortest distance between two Geopoints without the use of internet.

/******** Method for Calculating distance between two locations *******/
public float DistanceBetweenPlaces(double lat1, double lon1, double lat2, double lon2)
{
    float[] results = new float[1];
    Location.distanceBetween(lat1, lon1, lat2, lon2, results);
    return results[0]; // Returns the shortest distance between two Geopoints
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top