Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I change the Start and End marker image in Google Maps v3 API for Directions

I have a route plotted fine on using DirectionsRender but I cannot find out how to replace the generic Google markers with my own.

I know and use this in a normal Google Map situation but finding it difficult to do this with the directions markers for start and end.

Thanks for any advice, pointers or gentle mocking if this is a silly question :D

Michael

like image 943
Michael Law Avatar asked Nov 30 '10 10:11

Michael Law


1 Answers

The DirectionRender takes an option called markerOptions. Quoting from the API docs:

All markers rendered by the DirectionsRenderer will use these options.

So, if you want to set the markers use MarkerImage (as philar has indicated).

Your other option is to pass suppressMarkers: true to the DirectionRender's options and then simply use your own markers.

like image 199
Sean Vieira Avatar answered Oct 01 '22 04:10

Sean Vieira