Directions - Routes

2 posts / 0 new
Last post
Directions - Routes


I am working on a project where I need to update a map with one route at a time, so for example if the user clicks the table of clients the specific client's address will be used in a directions/route look up. What I am struggling with finding an answer to is, can I remove a route from my map once it is looked up? Currently when I click on my table, I can get a route to a specific client, however when I click another name it updates the map with with another route alongside the originally clicked event.

You can use the removeLayer
You can use the removeLayer function to remove an existing route highlight. Here is the line I use: map.removeLayer(highlight);