Select to view content in your preferred language

Directions Widget Limiting Travel Modes

1244
5
06-22-2021 01:17 PM
JohnPaulAlbana
Emerging Contributor
 

Hi, I'm trying to limit the travel modes in the direction's widget. Is there a simple way to get rid of the travel modes in the directions widget? I only want Driving Distance and Walking distance.

Thank you!

 

HQWhr

0 Kudos
5 Replies
Noah-Sager
Esri Regular Contributor

Hi @JohnPaulAlbana, thanks for the question. The available Travel modes are based on the ArcGIS Online org settings. If you define the Travel modes you want in your org, then define the URL to your org using https://developers.arcgis.com/javascript/latest/api-reference/esri-config.html#portalUrl

in your app, then you will only see the options you defined in the Directions widget Travel mode dropdown.

0 Kudos
JohnPaulAlbana
Emerging Contributor

@Noah-Sager  Hi, it might be a silly question but where can I find my portal URL? I already have checked in ArcGIS Online and I can confirm that my administrator has set the directions to only show distance travel modes

this is what I have and it seems to not work.

esriConfig.portalUrl = "https://ctq.maps.arcgis.com/arcgis"

0 Kudos
Noah-Sager
Esri Regular Contributor

That looks correct to me, but the error message in the console is about CORS. I would try testing the app in something like Codepen or another https location rather than from http from your localhost.

0 Kudos
JohnPaulAlbana
Emerging Contributor

Hi @Noah-Sager ,

I get the same error in code pen. Is there a certain setting that I need to turn on/off to allow this?

JohnPaulAlbana_0-1624461755609.png

 

0 Kudos
Noah-Sager
Esri Regular Contributor

Strange, it works for me with codepen and my org. I'm not sure if there is a setting to allow this, but I found this doc, maybe this will help?

https://doc.arcgis.com/en/arcgis-online/administer/configure-security.htm

 

0 Kudos