Mapbox Android SDK: 6.7.0
The requirement in the application we are developing is that we have to add multiple markers in different LatLng positions and also rotate them with some bearing. In the old mapbox version(4.2.1), we could do it without any issues.
////Working code with MapBox SDK 4.2.1////
MarkerViewOptions markerViewOptions = new MarkerViewOptions();
IconFactory iconFactory = IconFactory.getInstance(this);
Icon arrowIcon = iconFactory.fromResource(R.drawable.compass_needle);
markerViewOptions.icon(arrowIcon);
markerViewOptions.position(new LatLng(position)).rotation((float) headDirection);
marker = mapboxMap.addMarker(markerViewOptions);
////For updating////
marker.setPosition(new LatLng(aircraftLocation));
marker.setRotation((float) headDirection);
mapboxMap.updateMarker(marker);
In the latest Mapbox update, MarkerView and MarkerViewOptions is deprecated. We are trying to achieve the same functionality with Marker and MarkerOptions. But we are unable to rotate the markers.
We also tried using the SymbolLayer. Rotate function is available here but we are unable to set a LatLng position for a marker.
How to proceed with the latest SDK to achieve this?