mapbox / mapbox/mapbox-maps-android

`SymbolLayer`'s `symbolZElevate` does not work when `iconRotationAlignment` is `IconRotationAlignment.MAP

Open
#2,291 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

auto-triaged bug :beetle:
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

Screenshot 2024-02-27 at 5 06 40 PM

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.

Screenshot 2024-02-27 at 5 06 17 PM

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.