googlemaps / android-maps-compose

Jetpack Compose composables for the Maps SDK for Android
https://developers.google.com/maps/documentation/android-sdk/maps-compose
Apache License 2.0
1.14k stars 135 forks source link

Ability to render GroundOverlays on top of map content such as buildings #526

Open zalexbag opened 7 months ago

zalexbag commented 7 months ago

Is your feature request related to a problem? Please describe. GroundOverlays always render below map content (specifically buildings that are enabled via isBuildingEnabled = true in MapProperties for instance) and there isn't any way to make GroundOverlays be rendered on top (i.e. their z index is always below everything else on the map).

Describe the solution you'd like Add an API that offers the ability to for GroundOverlays to be rendered above other map content, and especially for buildings as that is needed for my team's use case where we want buildings to be drawn below our GroundOverlay image.

Describe alternatives you've considered We tried working with the various shape APIs (Circle, Polygon, and Polyline) to see if any of those rendered above map content and found that none of those do either, though those also don't offer the same functionality we need which only GroundOverlay offers anyways.

Additional context Below you can see examples of how buildings are always rendered on top of GroundOverlay, Circle, and Polygon:

GroundOverlay Circle Polygon
fpom-groundoverlay fpom-circle fpom-polygon
wangela commented 7 months ago

If you would like to upvote the priority of this issue, please comment below or react on the original post above with :+1: so we can see what is popular when we triage.

@zalexbag Thank you for opening this issue. 🙏 Please check out these other resources that might help you get to a resolution in the meantime:

This is an automated message, feel free to ignore.

lucanicoletti commented 6 months ago

Have you tried specifying the zIndex in the GroundOverlay function to be higher than 0f(the default)?

zalexbag commented 6 months ago

@lucanicoletti yes I did test changing the zIndex to a few different non-zero values including Float.MAX_VALUE and buildings still render on top of the GroundOverlay.

zalexbag commented 6 months ago

Oh and one other point of context to add to that, in the Maps Android SDK documentation for Shapes in the Z-index section they state the following:

The z-index specifies the stack order of this shape, relative to other overlays (other shapes, ground overlays and tile overlays) on the map. An overlay with a high z-index is drawn above overlays with lower z-indexes. Two overlays with the same z-index are drawn in an arbitrary order.

Note that markers are always drawn above other overlays, regardless of the z-index of the other overlays.

This is referring to shapes, but I would infer the behavior is the same for other overlay types and in this case for GroundOverlay. So the way I see it, the zIndex is meant to layer with regards to other overlays but has no effect when non-overlay elements are displayed like buildings or (as they mentioned) map markers.