Claire Ann
Claire Ann

Reputation: 11

Google Maps Android: How can i draw a route line to see directions

How to create a route in google map for my android location. I had a straight line only but I want to do is an accurate line connecting may start and end locations. Thanks in advance!

Upvotes: 1

Views: 1703

Answers (4)

Subhalaxmi
Subhalaxmi

Reputation: 5707

Use URL

"http://maps.googleapis.com/maps/api/directions/json?"
                + "origin=" + start.latitude + "," + start.longitude
                + "&destination=" + end.latitude + "," + end.longitude
                + "&sensor=false&units=metric&mode=driving";

phrase the lat n long value and Add poly line as per the Start and End Point.

For More Details http://blog-emildesign.rhcloud.com/?p=822

Upvotes: 1

tyczj
tyczj

Reputation: 73721

I created a library that will draw directions on a map between 2 points using google directions API.

its as simple as it gets

https://github.com/tyczj/MapNavigator

Upvotes: 1

Shadow
Shadow

Reputation: 6899

Use Google map direction parser. Tutorial is here.Hope this might help.

http://wptrafficanalyzer.in/blog/drawing-driving-route-directions-between-two-locations-using-google-directions-in-google-map-android-api-v2/

Upvotes: 0

Didac Perez Parera
Didac Perez Parera

Reputation: 3814

you need to use Google Directions API. You will have to generate an URL and parse the XML/JSON result. I do recommend to use my library that creates a set of objects which may help you to paint lines in the map. https://github.com/perezdidac/google-directions-api. Let me know if it helps you.

Upvotes: 0

Related Questions