How to Draw line between two points in google map in android? - android

Merged with Draw line between two points in google map in android [duplicate].
I am new in android.I want to draw a distance line between to points in Google map.I can't do this. Please help me in solve my problem

Related

How to draw a curved line between two coordinates using Osmdroid library

I have found that Google map provides PolylineOptions but I haven't been able to find anything for Osmdroid.
If any one can suggest a solution with an example it would be very helpfull.
You may not be able to draw a real curved line, but you should be able to create a Polyline which would appear to be curved. Polyline composes from straight line segments which are not curved.
It's seems that also the Google Map API you are referring to supports only Polylines without curves. See Google Map documentation
A Polyline is a series of connected line segments that can form any shape you want and can be used to mark paths and routes on the map.
Polylines and Polygons are supported by the Osmdroid library. Detail can be found in the Osmdroid documentation.
You can create Polyline easily:
List<GeoPoint> geoPoints = new ArrayList<>();
geoPoints.add(start);
//... add other points that should form the curve
geoPoints.add(end);
//add your points here
Polyline line = new Polyline(); //see note below!
line.setPoints(geoPoints);
map.getOverlayManager().add(line);
The tricky part would be to compute the points between your two known coordinates.

Android Studio - V2 Maps - check if polyline intersects other polyline

i am getting a fully loaded map in my android app, and i am getting some directions waypoint using the directions API. What i would like to accomplish now is check if the desired route form A to B intersects with another polyline.
Can someone shed some light into this?
Thank you very much, cheers!
Loop for each straight line in first polyline
Loop for each straight line in second polyline
Test if both straight lines intersect. They both intersects if there exists one point that both line share.
Line equation if endpoints are known:

Android GoogleMap draw line through a known way

I am using Google Map Api V2 and I can marker or draw a line between two points.But I try to draw a line through the route of a bus.So Route,Ways,Stopping places...etc of the bus are already known.First of all, I tried to find all LatLong values of the route and I draw it as polylines but I guess it is wasting time.So I want to draw line without find out all LatLong points of route of the bus.Is there any way ?
Thanks for the help..
You can use the Directions API to get the directions between two points, but this probably wont match your bus routes.

is it possible to draw on road based on a location near it

I am currently developing an application that tracks your path, so it always draws on the map. I want to know if it is possible to draw on the road, since my application gets my location and its not precise, its always near(about 30 m radius) me. I want it not to add it where it is, but on the nearest road
You can draw the path on the map using the Ployline class of Google Map as below:
Polyline line=myMap.addPolyline(new PolylineOptions().add(new LatLng(location.getLatitude(),location.getLongitude())).color(Color.RED));
For more details about it please refer here

Displaying rout between two points in GMap, in android

I want to display the rout in google map, between two points(Latitudes and longitudes), and I am able to draw straight line between these points, now I want to display rout.
Please guide me or suggest some link.
http://maps.google.com/maps?saddr=START&daddr=DESTINATION&output=kml
Connect the coordinates and draw some lines to show your route.

Categories

Resources