I'm using the SymbolManager
to display two symbols on the map. Here is an example:
The dark symbol is because of the fact that I'm testing the project on the Emulator, but the Line goes under the symbol, as it should be. The problem comes with the other symbol (finish flag). After I'm ready with the drawing of the line, the following code block is called:
symbolManager = new SymbolManager(mapView,mMapboxMap,style);
symbolManager.setIconAllowOverlap(true);
symbolManager.setIconIgnorePlacement(true);
SymbolOptions symbolOptionsFinishFlag = new SymbolOptions()
.withIconImage(IMAGE_FINISH_FLAG)
.withIconSize(2.0f)
.withLatLng(newLatLngs.get(newLatLngs.size()-1));
symbolManager.create(symbolOptionsFinishFlag);
LatLngBounds.Builder builder = new LatLngBounds.Builder();
builder.includes(newLatLngs);
LatLngBounds bounds = builder.build();
final CameraUpdate cu = new CameraUpdateFactory().newLatLngBounds(bounds,300);
mMapboxMap.easeCamera(cu,5000);
I checked some examples in the Mapbox site and it seems to be correct. However, the Symbol
is under the Line
, how can I bring on top of it?
Although SymbolManager
s can be useful means for providing an abstraction over the methods needed to add symbols to a map, you may get some more flexibility by working with native SymbolLayer
s directly. This example shows how to add symbol layer icons to a map, and this example shows how to specify layer ordering when new layers are added. So, by adding two symbol layers for your start and finish icons, and a line layer for the line between them, you could use style.addLayerBelow(finishFlagLayer, "name_of_line_layer")
.