mustAvoidLinkIds deprecated?

9 posts / 0 new
Last post
gwestern
mustAvoidLinkIds deprecated?

Hello, I have been attempting to set up a directions request that specifies a street that must be avoided, using the Leaflet plugins.

The request accepts the mustAvoidLinkIds option without error, but it does not appear to have any effect on the result. Has that option been removed in this API, or am I doing something wrong? Is there still a way to avoid a specific street?


MQBrianCoakley
The parameter has not been
The parameter has not been deprecated. Can you post a request that is not following the parameter?

gwestern
Thanks for the quick response

Thanks for the quick response. I've pasted my example below. The route that I'm requesting is one that MapQuest naturally tries to route using L Street. The link ID that I'm using is supposed to be for L street, but the route does not change when I add the option. Maybe something's wrong with my syntax?

I got the link ID here: https://open.mapquestapi.com/directions/#findLinkId

 

        var map = L.map('map', {
            layers: MQ.mapLayer(),
            center: [38.575210, -121.483426],
            zoom: 12
        });

        var dir1 = MQ.routing.directions();
 

        dir1.route({

            locations: [
              "1215 21st St, Sacramento, CA",
              "1630 K St, Sacramento, CA"
            ],
            options: {
                mustAvoidLinkIds: [56640547]
            }
        });

        map.addLayer(MQ.routing.routeLayer({
            directions: dir1,
            fitBounds: true
        }));


MQBrianCoakley
I use the code above in the
I use the code above in the Try It Now sample and it avoids L St and takes K St.

gwestern
That is very strange; for me

That is very strange; for me it launches a mapquest map displaying a route taking L street when I run that code in Visual Studio.

What is the Try It Now sample you're referring to?


MQBrianCoakley
There are Try It Now samples
There are Try It Now samples in the user guide.

gwestern
I just pasted the code below

I just pasted the code below into the "Routing with an advanced location object" JS Fiddle example in the page you provided and received the same response; it routed via L St.

 


MQBrianCoakley
Looks like there may have
Looks like there may have been a data update this morning during the regular maintenance window. If link id 47884393 is used it looks like L St is avoided.

gwestern
Great, I can confirm that it

Great, I can confirm that it is now working. Thanks.