mapbox / mapbox/mapbox-maps-android
`SymbolLayer`'s `symbolZElevate` does not work when `iconRotationAlignment` is `IconRotationAlignment.MAP
Nobody has claimed this yet.
- Dominant language
- Kotlin
- Stars
- 578
- Forks
- 161
- PR merge metrics
- No merged PRs in 30d
Description
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"))
}
)
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue on Android 12 with Maps SDK 11.1.0 using the provided Kotlin example, comparing MAP with AUTO and VIEWPORT rotation alignment over a fill extrusion. Trace the symbol-layer rendering behavior for symbolZElevate and iconRotationAlignment. Done means the marker renders on the extrusion top with MAP alignment as it already does with the other settings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100