Skip to content

Custom markers, cluster circles and compass image are missing from the map in 11.10.2 #3548

Description

@cooltey

MapLibre Android Version

11.10.2

Android SDK Version

SDK 35

Device

Samsung S24 pro

What happened?

Hi, the Wikipedia Android app uses the library to display nearby articles with a custom marker image and also show clusters with a custom circle drawable.

Starting from the 11.10.2, including the Compass image, custom markers and custom cluster circles are missing:

map.uiSettings.setCompassImage(AppCompatResources.getDrawable(requireContext(), R.drawable.ic_compass_with_bg)!!)

Setting cluster circles and markers


const val CLUSTER_TEXT_LAYER_ID = "mapbox-android-cluster-text"
const val CLUSTER_CIRCLE_LAYER_ID = "mapbox-android-cluster-circle0"

private fun setUpSymbolManagerWithClustering(mapboxMap: MapLibreMap, style: Style) {

    symbolManager = SymbolManager(binding.mapView, mapboxMap, style, null, null, ClusterOptions())

    // Clustering with SymbolManager doesn't expose a few style specifications we need.
    // Accessing the styles in a fail-safe manner
    try {
        style.getLayer(CLUSTER_TEXT_LAYER_ID)?.apply {
            this.setProperties(
                textField(Expression.toString(Expression.get(POINT_COUNT))),
                textSize(Expression.literal(22f)),
                textColor(ResourceUtil.getThemedColor(requireContext(), R.attr.paper_color)),
                textFont(CLUSTER_FONT_STACK),
                textIgnorePlacement(true),
                textAllowOverlap(true),
            )
        }
        style.getLayer(CLUSTER_CIRCLE_LAYER_ID)?.apply {
            this.setProperties(
                circleRadius(24f),
                circleColor(ContextCompat.getColor(requireActivity(), ResourceUtil.getThemedAttributeId(requireContext(), R.attr.secondary_color))),
                circleOpacity(0.8f),
                circleStrokeColor(ResourceUtil.getThemedColor(requireContext(), R.attr.paper_color)),
                circleStrokeWidth(2.0f),
            )
        }
    } catch (e: Exception) {
        L.e(e)
    }
}

Source code

When digging into the changes compared with the previous release, I cannot find a specific change related to the markers and cluster circles.

Please help provide guidance to see if it's a bug from our side that we need to update. Or should something be updated on the library side? Thanks!

Steps to reproduce

  • Check out this PR and install to an Android device.

Renderer

No response

Relevant log output

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions