For getting the Route image in Android:
Add your all Lat and Long into a List and after that convert your complete list of lat and long into encoded poly line string with the help of Google Poly line Encoding techniques.
After that create Map box account and use static image API of map box with valid token
Now use StaticPolylineAnnotation:
List<StaticPolylineAnnotation> list = new ArrayList<>();
list.add(StaticPolylineAnnotation.builder()
.polyline(polilineString)
.strokeWidth(1.0)
.strokeColor(56, 69, 181)
.build());
Note: PolilineString is your encoded string got from Google Poly line Encoding techniques
- Create a MapboxStaticMap:
MapboxStaticMap staticImage = MapboxStaticMap.builder().user("mapboxaccountusename")
.accessToken("Mapbox Token")
.styleId("Your Style id")
.staticPolylineAnnotations(list)
.cameraAuto(true)
.retina(true)
.build();
- Get url of image using
String imageUrl = staticImage.url().toString();