Vector Marker Support
See original GitHub issueIs your feature request related to a problem? Please describe.
Hi i was trying to add a vector image to marker but realized it only supports BitmapDescriptor
Example icon = BitmapDescriptorFactory.fromResource(R.drawable.ic_icon_png)
Describe the solution you’d like
I think you could change BitmapDescriptor to something more general and accept drawable and than based on that you can create Bitmap or maybe even overloaded function.
Describe alternatives you’ve considered
I have tried this:
Marker(
...
icon = getBitmapFromVector(context,theme)
)
fun getBitmapFromVector(context: Context, theme: Resources.Theme): Bitmap? {
return ResourcesCompat.getDrawable(context.resources, R.drawable.ic_vector, theme)?.toBitmap();
}
also might be usefull for someone
Marker(
icon = getBitmapFromVector(
LocalContext.current,
R.drawable.ic_image,
0xffff0000.toInt()
)
)
fun getBitmapFromVector(
context: Context,
drawableRes: Int,
color: Int = 0x00000000.toInt()
): BitmapDescriptor? {
val drawable = ResourcesCompat.getDrawable(context.resources, drawableRes, null)
if (drawable != null) {
drawable.colorFilter = BlendModeColorFilterCompat
.createBlendModeColorFilterCompat(
color,
BlendModeCompat.SRC_ATOP
)
return BitmapDescriptorFactory.fromBitmap(drawable.toBitmap())
}
return null;
}
Additional context
Using Build.gradle
// Google Maps
implementation "com.google.maps.android:maps-compose:2.1.0"
implementation 'com.google.android.gms:play-services-maps:18.0.2'
implementation 'com.google.maps.android:android-maps-utils:2.3.0'
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top Results From Across the Web
<marker> - SVG: Scalable Vector Graphics - MDN Web Docs
Tip: you can click/tap on a cell for more information. Full support: Full support.
Read more >Marker Vector Art, Icons, and Graphics for Free Download
Browse 40847 incredible Marker vectors, icons, clipart graphics, and backgrounds for royalty-free download from the creative contributors at Vecteezy!
Read more >Scalable vector graphics support—ArcGIS Pro | Documentation
Scalable Vector Graphics (SVG) is a vector image format for 2D graphics. ... You can import SVG files as marker symbol layers within...
Read more >Tissue Orientation Marker For Physicians - Vector Surgical
Vector Surgical's tissue orientation system provides physicians with solutions to support successful surgical outcomes from the OR through recovery.
Read more >Markers with Vector-Based Icons | Maps JavaScript API
This example uses SVG path notation to add a vector-based symbol as the icon for a marker. The resulting icon is a marker-shaped...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
https://issuetracker.google.com/issues/220892485
This issue has been automatically marked as stale because it has not had recent activity. Please comment here if it is still valid so that we can reprioritize. Thank you!