You can see the component I created in the picture. Here are the different vehicles and their latitude and longitude values. I am routing according to these values. What I want to add at this stage is that there is a layer button on the top right of the map and I want my vehicle codes in the popup that opens when I click on this layer button. Vehicle24, Vehicle30... When I click on vehicle24 from the popup that opens, I want only vehicle24's routes to appear. Is this possible, I can't make any progress. Thanks in advance for your help. I will add the codes I used below
See my answer on StackOverflow. Basically you'll want a custom control that handles map interaction with react-leaflet and updates the route accordingly, like in this fiddle
Same Question in Stackoverflow https://stackoverflow.com/questions/73404013/how-to-add-layer-in-react-leaflet-routing-machine-and-filter-by-vehicle-code
You can see the component I created in the picture. Here are the different vehicles and their latitude and longitude values. I am routing according to these values. What I want to add at this stage is that there is a layer button on the top right of the map and I want my vehicle codes in the popup that opens when I click on this layer button. Vehicle24, Vehicle30... When I click on vehicle24 from the popup that opens, I want only vehicle24's routes to appear. Is this possible, I can't make any progress. Thanks in advance for your help. I will add the codes I used below
TrackingMap.tsx
Routing.tsx
FakeData.ts