I am trying to use a feature layer from ArcGIS Online to be an input facility in my closest facility parameter. I just recently started using ArcGIS JavaScript API and I saw someone's example in this forum which looks similar to this:
The code runs but returns no results:
In your codepen you are mixing 3.x and 4.x code; that won't work. Here's a slightly modified version of your code that gets and sets the facilities before you start trying to call the solver:
https://codepen.io/john-grayson/pen/oNZgPYX
Hi @JohnPaulAlbana, can you post a link to an app that reproduces this issue? On something like Codepen would be great. You can omit the apiKey if you are using one. Then I can investigate further.
Hi @Noah-Sager , thanks for coming by, here is the codepen link:
The first error you see when loading the app is: Uncaught (in promise) ReferenceError: facilities is not defined
So we need to get the locations of the features into a facilities variable. There is some good doc to go through here: https://developers.arcgis.com/documentation/mapping-apis-and-services/routing/closest-facility-routing/
I can take a closer look next week as well.
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.