2

I want to build a road map that works offline on android. I can find the shortest path from A to B. I haven't worked with maps before. Where should I start from? I'm planning to build a database like sqlite with many nodes with position of road using some algorithm like A*. Any idea how I can do this on Android?

Fido
  • 595
  • 1
  • 9
  • 29

2 Answers2

3

Suggestion for offline map library

  1. The most popular Osmdroid. Tutorial
  2. Mapsforge. SO question
Community
  • 1
  • 1
Trung Nguyen
  • 7,442
  • 2
  • 45
  • 87
  • @Fido If my answer helped you, you can upvote and check as the right answer to help future visitor. – Trung Nguyen Nov 22 '12 at 01:04
  • @Yul thanks, i've tried http://www.haakseth.com/?p=30 and got a map. now i want to install my algorithm on it. how can i get the database with coordinates from them? – Fido Dec 01 '12 at 17:46
2

There are several open source navigation softwares: like navit and osmand. But the license is rather restrictive and other limitations. Where graphhopper is Apache licensed and works on the Server+Desktop+Android. Disclaimer: I'm the author, and it is a young project.

If you really want to roll your own system I would not recommed a database. Use a simple array and access the nodes via the array index. Also memory mapped files could be of some help if the graph is too big to fit into the available RAM.

Karussell
  • 17,085
  • 16
  • 97
  • 197
  • i've seen graphhopper project for android but the 'com.graphhopper.android.R' is missing. can this project find path when offline? if yes, how can you get a position of all street in graph? it have so many street, i'm stuck with these data :( – Fido Dec 01 '12 at 17:36
  • normally com.graphhopper.android.R is automatically created. Try to clean and rebuild than restart eclipse or create an issue at the projects' github and I'll fix it. at the momentan you cannot search for streets and get the lat,lon for it but this is on the todo list. – Karussell Dec 02 '12 at 13:15
  • "can this project find path when offline" -> yes – Karussell Dec 02 '12 at 13:16
  • i run project but my eclilpse's hanging, but it's matter. when searching i've a big question: 'find my location' is one of important features. do you think a solution for it? i want my program can work fine with or without internet – Fido Dec 17 '12 at 18:58
  • dont understand your question regarding 'find my location'? you use your GPS (no internet required) or how else would you determine it? – Karussell Dec 17 '12 at 21:37
  • i mean when my system have internet connect, it can find my current location like google – Fido Dec 18 '12 at 06:13
  • 1
    well I still do not get your question. 1. GPS != internet. so yes, even without internet you can get GPS. 2. if you have GPS you get your position and from that you can show that point on the map IF you've downloaded it before. But all that is possible without any routing software just e.g. mapsforge for android – Karussell Dec 18 '12 at 08:06
  • thank you so much. Where do you get the data to install A* on? – Fido Dec 29 '12 at 09:04
  • openstreetmap, have a look into the run.sh where it download it automatically if not available – Karussell Jan 04 '13 at 13:55
  • tks, can you tell me more about that street data? how to get and use it or give me some thing to search. i've tried osmdroid and load the title in offline mode. now i need that offline street data to install algorithm on :) – Fido Jan 06 '13 at 10:36
  • 2
    hey, as i said. just checkout graphhopper and its android example (and its related scripts). it's all open source and you can view the details. The osm data is downloaded to build the routing data. for the android example the mapsforge project is used. check http://download.geofabrik.de/openstreetmap/ (raw osm data) and http://download.mapsforge.org/maps/ (Android offline maps to view streets, additionally you need the routing graph, again see the android example how this works together) – Karussell Jan 06 '13 at 12:25