Dear all,
We have a web application that uses the closest facility analysis tool. We have recently upgraded our Portal to 11.3 and our code to the latest ArcGIS JS version (4.33). This is the function within the application that runs the analysis and retrieves the attributes:
function findClosestFacility(startFeature: Graphic, featuresetFacilities: FeatureSet) {const params = new ClosestFacilityParameters({facilities: featuresetFacilities,incidents: new FeatureSet({ features: [startFeature] }),returnRoutes: true,returnFacilities: true,defaultTargetFacilityCount: 1,});closestFacility.solve(closestFacilityUrl, params).then((results) => {console.log(results)showRoutes(results.routes.features);setDistanceToFacility(results.routes.features[0].attributes.Total_Length)setTimeToFacility(results.routes.features[0].attributes.Total_WALKTIME) // this one is now undefinedif (currentDestination !== params.facilities.features[0].geometry.x || searchAddress || searchClear) {view.current.goTo({ target: results.routes.features[0] });}setCurrentDestination(params.facilities.features[0].geometry.x)setSearchClear(false)},(error) => {console.log(error);});}
Solved! Go to Solution.
In case anyone wonders, we were able to solve the issue. Since the update, it was necessary to define the method "impedanceAttribute" to be able to retrieve the WALKTIME.
Hi @no33mis, thanks for posting your question here. I'm not 100% sure what's occurring, but I have some hunches.
When you upgraded the Portal version, did this update the default travel mode? Or did you have some other customizations that might have reverted back to default values during the upgrade?
Additionally, you can use the fetchServiceDescription() method to return the travel mode of the service.
https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-networkService.html#fetchSer...
const { supportedTravelModes } = await networkService.fetchServiceDescription(
config.routeServiceUrl,
apiKey,
);
const driveTravelMode = supportedTravelModes.find(({ name }) => name === "Driving Distance");
In case anyone wonders, we were able to solve the issue. Since the update, it was necessary to define the method "impedanceAttribute" to be able to retrieve the WALKTIME.