Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vector graphics used for google map marker

Is there a way to use vector graphics to be google maps marker? I know that google maps takes a bitmap for a marker, but I have a vector graphics (coming from server) and I am not sure how to display that as marker?

Thank you

like image 417
Snake Avatar asked Nov 10 '22 09:11

Snake


1 Answers

Technically, if you are able to render your vector image as a Drawable, you can use it as a map marker. Vector drawables on Android are complicated but maybe you already solved that problem.

You need to programmatically create a writable Bitmap with the desired size (specify your constant size in dips to adjust it to the screen density), create a Canvas based on that Bitmap, set the bounds on your Drawable then draw it on the Canvas. Your Bitmap will then contain the rendering of your Drawable and you can create a Marker from it.

like image 184
BladeCoder Avatar answered Nov 15 '22 12:11

BladeCoder