I am designing the android mobile application project using java. I downloaded the map from http://downloads.cloudmade.com/ . I got infromation (lat & lon) of each node but there is no information about distance value. I am facing the problem to calculate the shortest path. These day I found the possible solution but it is still confused. Here is the website seems to be useful: http://wiki.openstreetmap.org/wiki/Distance_maps#Checking_routing_connectivity_of_an_OSM_file . But I cannot find the ROUTE.OSM from the cloudmade.com As I know, the well-known method is Dijkstra's algorithm. Is there any existing method to get the shortest path between nodes under android development environment ? Many Thanks!!!! asked 19 Mar '12, 08:16 yenyip |
Well, apart from the useful advices, you are still missing the answer to your question: how to calculate the distance on the WGS'84 sphere between two points defined by P1(Lat1,Lon1) and P2(Lat2,Lon2)? If you don't minde, try this: X1=cos(C x Lat1) x cos(C x Lon1); X2=cos(C x Lat2) x cos(C x Lon2); Y1=cos(C x Lat1) x sin(C x Lon1); Y2=cos(C x Lat2) x sin(C x Lon2); Z1=sin(C x Lat1); Z2=sin(C x Lat2); (main-circle)distance(P1,P2)=R x acos(X1 x X2 + Y1 x Y2 + Z1 x Z2); Where R=6378137 and C=PI/180=0.0174532925 and distance in meters. Assumed, latitude and longitude are given in decimal degrees (if in radians, take C=1). answered 28 Mar '12, 17:39 sanser |
If I understand you right you want to make a routing engine for android. For the first this have been done before and you might be better of using one of those open source implementations. The first thing you have to learn is how the osm data is. There are a lot of tags that describe who can travel where and how fast and so forth. In the end you want to create a weighted graph of this data that you can store. Then you can run dijkstras algorithm on that graph. When you finaly have a route you can calculate the distance from point to point and add them up. As you might imagine this is quite the task and it will take a lot of development to get the routing engine fast enough that you can use it. My recomendations is that you take a look at some of the open source applications for android that supports offline routing, and try to reuse their code. answered 23 Mar '12, 04:23 Gnonthgol ♦ |
Did you ever had a look at the OSM wiki, the endless source of knowledge? At Routing you get an overview about routing with OSM data. Or go to the Android section and search for apps that are opensource and have routing features. answered 22 Mar '12, 20:20 stephan75 Thanks stephan75. Actually I have tried to use the apps listed in Android section. I have read the OSM wiki but still cannot get the distance values. Normally, which method should be used ?
(23 Mar '12, 03:47)
yenyip
|
Please elaborate. What exactly do you want to compute?
The shortest path between two variable nodes. The application receives the input (starting point and destination) from the user and calculates the path by Dijkstra's algorithm
Please how did you get infromation (lat & lon) of each node??