0

i am developing an android application that use map view.

i can add point to the map, zoom, get current location and animate to point.

but how to get direction between 2 points?

when user click on point to show direction between current location and clicked location.

Thanks

2 Answers 2

1

but how to get direction between 2 points?

Math. This has nothing to do with Android. It has little to do with maps, even. It has everything to do with math.

Depending on the distances involved, you might be able to get away with treating things as plain Carteisan coordinates and do the necessary trigonometry. Over a significant distance, though, the curvature of the Earth starts to play a role, and the math will get harder.

You might consider using a search engine to find whatever versions of the formulas you would like to use.

2
  • i do not want to calculate direction ..... i neeed to draw the path from current location to choosed location inside my image view that use android google maps.
    – Alex
    Commented Feb 19, 2011 at 14:15
  • @ahmed: You may wish to update your question to reflect that. Your question, as written, gives no indication that this is your intent. Commented Feb 19, 2011 at 14:23
0

in order to show a direction on maps (android) you can try to make an Overlaying custom route on your application.

We shall further assume that the route returned may contain additional information such as the local slope of the route (which could be important if one is negotiating the route in a wheelchair, for example). Since this requires a network access that could block the main UI thread if there are network difficulties, we shall also use this example to introduce the important skill of putting time-consuming or potential UI-blocking tasks on a background thread. and use AsyncTask to run the process in the background. To use AsyncTask we must subclass it.

maybe this is helped you out.

1
  • me too, use asynctask to avoid blocking UI apps and internet. sometimes it makes force close
    – DevYudh
    Commented Dec 10, 2011 at 21:01

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