I have for example more than two points on streets in my app, how to draw route between them depending on streets?overview_polyline from Google Directions API working only with 2 points at the time?Is it possible to make Google Directions API one request with many points and get overview_polyline route?
Hope it help Google Maps Directions API
Related
I'm about to learn more on how to draw route between two points using Google Directions in Google Map Android API V2. My question is can i get informations about the drawed road like witch streets are passed by this road .Or can i get this information without drawing the route ? can i get it with the two points only(start- end).
thanks.
something like this is that you need?
https://developers.google.com/maps/documentation/javascript/examples/directions-travel-modes?hl=es-419
after #honeyyy comment I suggest this link
https://developers.google.com/maps/documentation/javascript/examples/directions-complex?hl=es-419
that get all checkpoint in the middle of two points an get information about them
When I draw a route in google map between two coordinates, I am using below Google API URL it works I can get all data, but now I can draw route between many coordinates how can I do this?
http://maps.googleapis.com/maps/api/directions/xml?origin=41.020381,28.936672&destination=41.023722,28.939016&sensor=false&units=metric&mode=driving
You can use waypoints https://developers.google.com/maps/documentation/directions/intro#Waypoints but take into account that the maximum allowed number of waypoints is 23
You can use waypoints, the documentation can be found here:
Google Maps APIs Waypoints
However, since waypoints only support a maximum of 23 waypoints, you'll need to divide the total number of points by 23 to get the interval you need to leave between points to end up with 23. This will not give you an incredibly accurate route, since you'll be missing many of the recorded points.
We found that an alternate solution was to not use the Google Maps Directions API, instead we just record a location as often as possible and then draw these points as a polyline directly onto the map, avoiding the need for any direction requests.
Google maps Direction by default gave us a route that has a mini distance, but for my case I want to draw a custom route is this possible with android google maps api v2 ?
example :
How can I do that in android google maps api v2 ?
P.S :
I already know how to draw route beetween two point but not a custom one just fellowing google directions.
I think you meant waypoint.
Look for waypoint in this link
https://developers.google.com/maps/documentation/directions/
Between your start and end point, you can set up to 8 waypoint for free which will draw a route that connect all of these point between start to finish
If its other kind of custom route you talk about then , I guess you will ended up having to find each route between 2 point at a time
Can i get direction between 2 points with using Google Maps v2 in my Android application ?
I found Polyline but i don't want to draw a line between 2 points.
I found a solution which is using Intent. It can solve this problem but it is not useful because this solution is starting another map application and I want to show direction in my application. Can i do this ?
You cannot get directions using just the Google Maps V2 api. You should use the Google Directions API direction request call. This will return the raw direction data in json which would allow you to draw a Polyline for the directions on the map or show the data in any format you would like.
There isn't any method to do it because it envolves several computing that must be done in Google Maps servers (and they don't allow you to do so many without paying if you hold a business).
So, the only way is making a petition to google maps servers as they describe in the Google Maps Api documentation that #Bobbake4 linked. Then, you'll receive several coordinates that you'll use to draw a polyline which represents your route.
Hopefully, someone has already coded everything and shared gently with us here https://stackoverflow.com/a/15643705/1516973
That's absolutely the best answer covering Android Google Maps routing that I've found in Stack Overflow, so thanks to #Akexorcist and #emil-adz for it.
Hi With the help of LocationManager I managed to find current location in android.
For showing routes between two geo- co-ordinates what should I use so that I wont plot air distance instead will show ground routes or is it with help of json can I plot routes.
I have tried polyLine() but it gives straight line.
To work out the line between two points you need to know what map projection type you are using. Some map projections preserve shape (and therefore angles) others do not. Take a look at http://www.progonos.com/furuti/MapProj/Dither/CartProp/ShapePres/shapePres.html it might help.
If you're using a Mercator projection then I found this page that claims an algorithm in C# that should point you on your way: http://conceptdev.blogspot.co.uk/2009/01/great-circles.html
As for the line segments, ployline will give stright lines between the points. You'll need to use Path and use the Bézier curve methods Path.cubicTo() and Path.rCubicTo() from memory.
Do you have all permission set in the Manifest? Also, you have to enable the location service (is the gps icon in the status bar showing?). It'll take some time for the device to get the location, so see if onLocationChanged is called.
Here you can find the answer for your qustion:
Is there a way to show road directions in Google Map API v2?
and here:
Get driving directions using Google Maps API v2
basically what you should do is make a call to Google Directions API receive the road direction coordinates (many Latlng points), and then draw a polyline between each one of them.