I am trying to add a custom marker in React Google Maps and have each marker rotate based on the direction that the item is heading on the road.
I am able to make the rotation work when I use path
for an svg instead of a url
referencing an image. The problem with path
is that I cannot get fillColor
to work, only strokeColor
. It would also be nice to have a complex shape and path
is somewhat restricting in the type of shape that you can add to it, because cannot pass multiple paths into the string.
Please note that heading
is getting the proper direction via my api and I have verified that it works.
Here is my current code, any help is appreciated. Thanks!
const createIcon = (heading) => ({
width: '15px',
url:
'my image path',
rotation: heading || 0, // set the rotation prop to indicate direction
});