I created a database of many important features and locations of my city, and I want to find shortest/fastest path between two locations. Now, I'm calculating the route by using the A* algorithm in Java for Android device, but it takes too much time to calculate and draw a simple route.

Is there any efficient way to store and retrieve the road data from database for route calculation?

  • A* tends to be fast. Did you profile your code? Can you post the results? Commented Sep 24, 2013 at 18:01
  • Is your database a PostGIS/pgRouting database (given the tag that you applied to it) or something else? Commented Sep 25, 2013 at 14:51
  • I am using SQLite Database
    – Arun
    Commented Sep 27, 2013 at 10:03
  • 1
    Have you considered using the spatialite routing code? It implements both A* and Dijkstra's algorithm.
    – BradHards
    Commented Nov 3, 2013 at 3:14

2 Answers 2


Isn't the normal solution to pre-calculate a route index? That's what OSRM does: https://github.com/DennisOSRM/Project-OSRM/wiki/Running-OSRM


Have a look at the Open Source routing software for Android:


They normally use format similar to a graph database. One city should be even possible in-memory on Android (at least with graphhopper). But for bigger sizes you'll need to implement a proper storage solution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.