2

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?

animuson
  • 52,378
  • 28
  • 138
  • 145
malavika
  • 1,311
  • 3
  • 18
  • 51

3 Answers3

3

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

rahstame
  • 2,110
  • 4
  • 23
  • 53
2

Just check these link for offline map library.

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

Community
  • 1
  • 1
Make it Simple
  • 2,299
  • 4
  • 32
  • 57
  • I have one doubt on this. The internet permission has added in manifest.xml file. Then how could you tell this is for offline mode? – malavika Aug 02 '13 at 09:51
  • 1
    Link-only answers are frowned upon here at Stack Overflow, as if the links ever went dead, the answer would become useless. Please include the important parts of the links here in the answer, and provide the links as further reference. If it is a link to a product or service, explain how you can use said product or service to answer the question rather than *just* providing a link. – animuson Aug 12 '13 at 16:11
1

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
}
arshu
  • 11,725
  • 3
  • 21
  • 20