Hi how, can I hide de default direction markers and replace with my own?
Best regards,
Diogo
Hello @Diogo Barata,
After searching for that option on the Google Maps documentation without success, I found some interesting workarounds that might help you.
1) When using the SetDirections Action you can also use a JS Block to suppressMarkers from the directions object from Google Maps (you can read more about that here). This will remove any marker that gets created by the Google Maps Directions API. Unfortunately, I wasn't able to change that config in run-time because the parameter can only be changed before the initialization (or creation) of the route.
2) After the previous step you will see that no marker is created, but now, you might want to create your own markers, right? Ok, that's the tricky part. What I found on those workarounds is that people are creating their own markers whenever a direction/route is created. So you would need to create 2 markers (one for the origin and the other for destination).
3) You can use 2 marker blocks and set the location of them to origin or destination. Then, just set the icon that you want by using the IconURL from optionalConfigs of the marker. I recommend downloading or creating your own resized icons as the size of them will be just the exact same as the one from the image you attached to the marker. Play with the visibility of the marker with an IF around the markers and that's it!
You can see the previous steps in action on the sample attached.
Please bear in mind that we didn't make all the necessary tests to ensure that it will work on all edge cases. We are continuously working to provide more events and API methods, so I suggest you keep tuned.
Can you please check if the current sample attached to this answer meets all your needs?
Tiago Pereira
Hi Tiago Miguel Pereira ,
Thanks for the help. That solved my problem. Thanks.
Best Regards,