How to make Symbol added via PointAnnotationManager appear above all other Layers
I create Fill, Line and a Symbol (For text) layers on the map using GeoJson. I then have the functionality where a user clicks on the map and I add a Symbol via the PointAnnotationManager. However I can't figure out how to make sure these Symbols are displayed above all other layers I add programatically :/
Hoping to avoid having to add logic where the Symbols the user adds are SymbolLayers because of the complexities with tapping on existing symbols.
You can see the symbol with the Text 4 is underneath the Zone layer:
`// Your geojson source // final source = GeojsonSource()
// add source to map map.style.addSource(source)
// add layers, attention the sort map.style.addLayer(FillLayer) map.style.addLayer(LineLayer) map.style.addLayer(SymbolLayer)
// or map.style.addLayerAt({above: otherLayerId})
// then add new Point with update geojson source on map click event map.style.addGeoJSONSourceFeatures(...)
// or update whole geojson final geojson = map.style.getSource(id) as GeojsonSource geojson.update(..)`
@brandon-watkins-avcrm Layers appear in the order they've been added to the style(if the ordering is not specified explicitly), annotation manager internally adds a layer upon initialization, you could either:
- reorder your code to create point annotation manager after the rest of the layers are added to the style
- specify layer position explicitly:
positionparameter for layers:mapboxMap.style.addLayerAt(layer, position)belowLayerIdfor annotation managers:mapboxMap.annotations.createPointAnnotationManager(below: layerId)
Thanks I will give these a go today!