Recently friends need two point route and multi-point route to draw this function, help to get a bit, write this blog to share with you.
Two-point Route
Is the beginning and the end of the two latitude and longitude points, gold draw the route, you can achieve the solid line and dashed function
:
Related properties:
New polylineoptions (); Mpolylineoptions.setdottedline (true); // sets whether to be dashed Mpolylineoptions.geodesic (false); // whether it is a geodetic curve Mpolylineoptions.visible (true); // whether the segment is visible Mpolylineoptions.usegradient (false); // Set whether a segment uses gradient colors // Set Line color, width Mpolylineoptions.color (Getwalkcolor ()). Width (getroutewidth ());
Multi-point Route
This can be used to record a walking trajectory, and to draw a route in countless coordinates.
: (I measured 10 points)
Related code:
//start position and map interface size controlAmap.movecamera (Cameraupdatefactory.newlatlngzoom (list.get (0), 7)); Amap.setmaptextzindex (2);Amap.addpolyline ((Newpolylineoptions ())//Manual Data Testing//. Add (New Latlng (26.57, 106.71), New Latlng (26.14,105.55), New Latlng (26.58, 104.82), New Latlng (30.67, 104.06)) //Collection Data. AddAll (list)//the width of the line. Width (setdottedline) (true). Geodesic (true) //Color. Color (Color.argb (255,255,20,147)));
Source Address Download: Https://github.com/DickyQie/android-gaode-map
Android-------Gold Map Two-point route and multi-point route drawing