android-maps-compose
android-maps-compose copied to clipboard
Define custom marker images with Composables
For cases where info windows aren't flexible enough, or the marker images need to be dynamic in some way, it'd be great to be able to use a @Composable to render the marker images.
With Views, this was possible by creating a view and using View.drawToBitmap, which should roughly also be possible with a ComposeView (with caveats, due to the use of software rendering).
if were possible to load an url image would be amazing 🤩
https://issuetracker.google.com/issues/220892485
IconGenerator from android-map-utils provides a recipe that looks helpful to take inspiration from, combined with (Abstract)ComposeView and View.drawToBitmap as @alexvanyo suggests. (In case someone is looking for a more spelled out approach.)
@alexvanyo: I've proposed a pattern for this in #258. That PR adds it to Clustering markers, but I'm considering bringing the same approach to regular Markers as well (a Composable content arg instead of a BitmapDescriptor). Would greatly appreciate your feedback (does it work the way you expect?).
Using the Clustering class works really well for rendering Markers from Composables....except how should we set the anchor, infoWindowAnchor, flat and draggable MarkerOptions?
The goal isn't to use Clustering for all markers, but we're testing the Composable marker rendering on that first. Barring any major issues, we'll try porting that over to regular Markers, which is where you'll be able to use anchor, infoWindowAnchor, etc.
Any news on this issue?
:tada: This issue has been resolved in version 2.14.0 :tada:
The release is available on:
v2.14.0- GitHub release
Your semantic-release bot :package::rocket:
Thank you @mosmb for contributing the # 2 most popular feature request in this project!
Thank you to both of you @wangela & @kikoso Can't wait to deprecate my homemade solution at work and use this!