Skip to content

Point markers rendered invisible (alpha 0) through the legacy GeoJsonLayer/KmlLayer bridges #1723

Description

@jamesarich

Summary

In 5.0.0, every point feature added through the deprecated GeoJsonLayer or KmlLayer classes renders fully transparent. The markers exist (they occupy tap targets) but are invisible.

Expected behavior

Point features render as visible markers (the default marker when unstyled), as they did in 4.x.

Observed behavior

Markers are added with alpha = 0. Two related root causes in the bridges' toModelFeature:

  • GeoJsonLayer hardcodes PointStyle(color = 0, …).
  • KmlLayer passes inline?.mMarkerColor?.toInt() ?: 0 — but KmlStyle.mMarkerColor is a hue (0..360), not an ARGB color, so even a styled placemark produces a value whose alpha byte is 0.

MapViewRenderer.createMarkerOptions then derives the marker's alpha from the style color's alpha channel:

markerOptions.alpha(android.graphics.Color.alpha(it.color) / 255.0f) // -> 0f

Environment details

  1. Any (found via unit test + code inspection; hit in production via maps-compose 8.4.0 → maps-utils-ktx 6.2.0 → android-maps-utils 5.0.0)
  2. Any
  3. android-maps-utils 5.0.0 (data module, introduced by the v5 rewrite feat!: rewrite android maps utils #1658)

Steps to reproduce

val geoJson = """{"type":"Feature","geometry":{"type":"Point","coordinates":[-111.62,41.942]}}"""
val layer = GeoJsonLayer(map, JSONObject(geoJson))
layer.addLayerToMap() // marker is added but invisible

Same with any KML <Placemark><Point> through KmlLayer.

Related smaller gap noticed while debugging: the KML bridge's toLegacyStyle maps IconStyle scale/href/hotSpot but not IconStyle color, so mMarkerColor is never populated from parsed KML at all.

I have a fix ready (GeoJsonLayer encodes the legacy style's alpha into the color; KmlLayer converts the hue via Color.HSVToColor, defaulting to opaque black) with Robolectric regression tests asserting MarkerOptions.alpha == 1f — PR incoming.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions