This is the code i have done to implement. I need to implement an application, where i need to add my own route in google map. I have tried it with direction API but it draw like this. Image which draw route like this.
I only need to draw a single poly line on road on my way. So please suggest me a better way that how can i implement it.
try this code:
public void addPolylineToMap(GoogleMap map, List<LatLng> route) {
final PolylineOptions polyline = new PolylineOptions();
for (LatLng point : route) {
polyline.add(point);
}
polyline.width(5)
.color(Color.RED);
map.addPolyline(polyline);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.