简体   繁体   中英

android: show direction in google maps

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

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM