mapbox-maps-android
mapbox-maps-android copied to clipboard
`SymbolLayer`'s `symbolZElevate` does not work when `iconRotationAlignment` is `IconRotationAlignment.MAP
Environment
- Android OS version: 12
- Devices affected: Pixel 4A
- Maps SDK Version: 11.1.0
Observed behavior and steps to reproduce
When a marker (feature) is added in a SymbolLayer,
with iconRotationAlignment(IconRotationAlignment.MAP) and symbolZElevate(true),
the marker does not not render on the roof/top of a fillExtrusion
Expected behavior
I expected that the marker will appear on the top of any fill extrusion, regardless of the settings for iconRotationAlignment.
Notes / preliminary analysis
It appears not to work only when set to IconRotationAlignment.MAP
When the iconRotationAlignment is not set(default), OR set as either iconRotationAlignment(IconRotationAlignment.AUTO) or iconRotationAlignment(IconRotationAlignment.VIEWPORT), the marker will correctly appear on the top of the fillExtrusion.
Additional links and references
My code:
mapView.mapboxMap.getStyle { style ->
val altitude = 2000.0
val point = Point.fromLngLat(103.92979463782774, 1.1844947609581453, altitude)
val circle = TurfTransformation.circle(point, 2000.0, TurfConstants.UNIT_METERS)
val myCircle = Feature.fromGeometry(circle, null, "circleFeature")
.also { it.addNumberProperty("altitude", altitude) }
val geoJsonSourceFillExtrusion = geoJsonSource("circleFeature") {
feature(myCircle, "circleFeature")
}
style.addSource(geoJsonSourceFillExtrusion)
style.addLayer(
fillExtrusionLayer(
layerId = "LAYER_ID",
sourceId = "circleFeature",
) {
fillExtrusionColor(Color.RED)
fillExtrusionOpacity(0.5)
fillExtrusionHeight(Expression.get("altitude"))
}
)
val myMarker = Feature.fromGeometry(point, null, "myMarker")
val myMarkerGeoJsonSource = geoJsonSource("myMarker") {
feature(myMarker, "myMarker")
}
style.addSource(myMarkerGeoJsonSource)
val marker =
BitmapUtil.bitmapFromDrawableRes(context, R.drawable.red_marker)
if (marker != null) {
style.addImage("myMarker", marker)
} else {
Log.e(TAG, "Error getting myMarker bitmap")
}
style.addLayer(
symbolLayer(
layerId = "MARKER_LAYER_ID",
sourceId = "myMarker",
) {
iconRotationAlignment(IconRotationAlignment.MAP)
iconRotate(25.0)
symbolZElevate(true)
iconImage(Expression.literal("myMarker"))
}
)
}
@xueyangp this seems like a bug. We'll take a look, thanks!