[GIS] Starting with OpenStreetMap for Android

androidopenstreetmaprouting

My goal is to write an Android application where I could select a couple of points in the map and calculate shortest path between them based on my algorithms.

I'm absolutely new to OSM and since googling doesn't give that much info as with Google Maps API for Android (which I can't use in this case due to lack of data that I can get), I have few questions:

  1. What would be the best way for beginner to start with OSM – is there some all-uniting Android API that (everyone) starts with?

  2. Is there some kind of official API documentation that I should follow?

  3. How are routes' coordinates stored and how can I retrieve them?

  4. Are there any really good tutorials that I should follow to start with developing my Android app?

I know how stackexchange pages work but, seriously, googling didn't give me that much information, so here could be something like a links-how-to-start-with-OSM-for-Android list page with short explanation.

Best Answer

thank you for choosing OSM to realize that project :)
Sadly our strength is creating a map and communication/docs is still WIP.

Please understand, that OSM is a geodatabase and thus it can be used in very different ways to create services and offer this data offline.
I say this to make clear e.g. that there is an API, but that isn't tuned for your specific goal, but is a general interface to alter and get data. But now let's go into your questions one by one:

  1. There is no general guide that will teach you how to work with OSM esp. on a spec. platform, as the project goal itself is to collect geodata, but not to preprocess and tune them for consumption. You might checkout http://wiki.openstreetmap.org/wiki/Frameworks to find libs that allow you to display the maps (please respect the tile usage policy), add markers and call routing services. Some might also offer the possibility to make use of offline maps.
  2. Yes there is, but this API doesn't fit your needs:
    http://wiki.openstreetmap.org/wiki/API
    Instead, you might look for a ready to use lib, or get the knowledge to create such functionality on your own (which might be very hard way if you have no expirience with GIS before):
  3. You are looking for a so called "routing graph", that needs to be calculated from precleaned OSM geodata and takes various aspects into account (accessibility, maxspeed, ...). Usually you don't get access to this internal data of a rendering application, as they are specific for a tool and dataset. You might get access of a list of driving directions and the lat/lon coordinate pairs by calling a webrouting-service or adapting a existing routing engine.

  4. You are asking for a very specific tutorial, that the OSM community can't offer also tutorials beside the main goal of contributing to OSM. There is a page dedicated to using OSM, but that is mostly focused on creating your own webmap server infrastructure: http://switch2osm.org

My advise would be to adapt existing routing engines, that already support OSM as input format. This prevents you from dealing with all kind of details to work on OSM and the large dataset and dataschema. You might also use this framework to test your custom algorithms: http://code.google.com/p/trafficmining/
As you need to get Android support, there seems to be only Osmand or Navit (but call me wrong).

Please also keep in mind, that you describe the TSP-problem for routing, that is known to be NP-complete, so scales extremely bad even for small inputsets.