How to block some ways in Leaflet Routing Machine to that ways don't bring in the route?

20 Views Asked by At

I saw the library Leaflet Route Machine https://www.liedman.net/leaflet-routing-machine/tutorials/. But I need that some ways will be blocked, to don't bring it on the result of the route between de point orign and destine.

Example of code I do:

// Crie um mapa Leaflet
var map = L.map('map').setView([latitude, longitude], 13);

// Adicione uma camada de mapa, por exemplo, OpenStreetMap
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
    attribution: '© OpenStreetMap contributors'
}).addTo(map);

// Crie um controlador de rotas com o provedor de serviços de roteamento desejado
var control = L.Routing.control({
    waypoints: [
        L.latLng(origemLat, origemLng),
        L.latLng(destinoLat, destinoLng)
    ],
    routeWhileDragging: true
}).addTo(map);

How to block some ways to don't bring it on the route of result between a point A and B?

0

There are 0 best solutions below