How to draw a line on a map between 2 GPS points - android

I want to draw a line from one gps point to another.
Is there a way which uses the streets on the map? And not just the air line?
Does anyone have an example code for android programming in eclipse?
I didn't find any suitable way in google which I will understand. I'm just a beginner.
Thank you for the outset. :)

You can check this blog post I wrote on this topic exactly:
Google Maps V2: Draw Driving Direction on Map:
There is also a sample project there that you can use.

yes there is its called Google Directions API

Related

Detect deviation from selected route in android map

I want to draw route between two points. I did this successfully. But how to know if the user deviated from drawn path or not. So that I can suggest user to notify alternative path to reach their destination. Like what google map navigation did. Am working on it and till now I could't find any answer for this. Please suggest some approach to me to find deviation from selected route.
Thanks in advance.
Use PolyUtil.isLocationOnPath(...) from Google Maps Android API utility library.

Google Maps Drawing Tools for Android

I need to make an Android app where the users have an option to draw a polyline on Google Maps and when the touch is removed, then do some action with the plotted polyline. Drawing and performing action is secondary. But the question is how could I achieve this?
Is there any predefined drawing tool (something like http://googlegeodevelopers.blogspot.in/2011/11/make-your-map-interactive-with-shape.html for JavaScript) to be used in google maps, or do I need to go with customization? Please suggest, or provide any links.
And can we extract the points to compare them with the ideal answer which was to be traced?
But the question is how could I achieve this?
With code. ;)
do I need to go with customization?
Yes. You would have to code all the functionality yourself. AFAIK there is no library that does that and of course Google Maps Android API v2 doesn't (and most probably won't) provide such functionality because it is too specific. I still think this would make a pretty useful library.
And can we extract the points to compare them with the ideal answer which was to be traced?
Yes. That would be simple after you are done with everything else.
Polyline polyline = ...
List<LatLng> extractedPoints = polyline.getPoints();
Simply use google maps api Google map API v2 following link might help you with the code.
code reference

Google Maps Android API v2 - DirectionsRenderer

I already searched on StackOverflow and Google. But i didn't find a real answer. I think there is just no DirectionsRenderer in the Android API. But can you acknowledge this?
If there is not DirectionsRenderer, how could i use the Android API to show a GoogleMaps and draw a Route on the Map?
I want to draw a nice route. Not just lines between the coordinates of each route-section which are also delivered from the Directions-Request.
I think there is just no DirectionsRenderer in the Android API. But can you acknowledge this?
There is no DirectionsRenderer in Maps V2. You can tell this by reading the documentation.
how could i use the Android API to show a GoogleMaps and draw a Route on the Map?
There is nothing in Maps V2 to support this.
I want to draw a nice route. Not just lines between the coordinates of each route-section which are also delivered from the Directions-Request.
You will need to find some Web service that will serve up coordinate information for the route with sufficient granularity (e.g., every 10m) to give you your "nice route", then use a Polyline or something like that for actually rendering the route.
SO i found out that it is possible to just take the legs, then the steps and within the steps you will find the "points".. when you decode the points string its a very detailed list of all coordinates.
with this coordinates, you can easily draw a nice route on the map.
so it's possible without the need of a additional Web-API.

Android Route Overlay

First, sorry for my bad English.
My question should be quite simple I think, but I didn't find an understandable example on google.
I'm working on an Android app, which can display a route of several gps points.
I've succeeded with displaying a start and endneedle on the google maps map.
Now I would like to show the route as a line between the individual points as well and thats the point where I don't know how to do it.
I would be really happy if someone could show me a simple example of how I can create line Overlays in Google Maps.
Thanks for your answers.
Here is an example for you.
Take a look ,I think this will help you.

how google map draw on canvas in android?

can anybody tell me or send me some links if there is any..which tells how Google map draw on canvas in android. what is the logic behind that.
any help will be highly appreciative.
thanks alot
You will need to download the Google APIs to start. You will then need to tell your project to use the APIs, specifically maps. You can follow the documentation here.

Categories

Resources