Hello,
We have built a custom map application using Arcgis/core 4.24.7. Per the documentation for the route api, you can solve it using just the api key but thats not the case when you go to solve method in code. always requires you to enter route params. I initialize a route params object with my api key and stops needed. This is the error I get back when the solve method is rejected
TypeError: t.toJSON is not a function
at l._writeNetworkFeatures (RouteParameters.js:5:3920)
at l.writeStops (RouteParameters.js:5:2346)
at f (write.js:5:472)
at d (write.js:5:1835)
at l.write (JSONSupport.js:5:657)
at l.toJSON (JSONSupport.js:5:690)
at e.toQueryParams (queryUtils.js:5:187)
at route.js:5:1591
at Generator.next (<anonymous>)
at asyncGeneratorStep (asyncToGenerator.js:3:1)
below is my route layer angular code
//test stop coordinates
let combinedLatLongs: LatLong[] = [{lat: 25.881941, lon: -80.234704 }, {lat: 25.863912, lon: -80.234184}];
let allStops: Stop[] = [];
combinedLatLongs.forEach(s => {
allStops.push(new Stop({geometry: {latitude: s.lat, longitude: s.lon}}))
})
//create stops for fiber route
const newRouteLayer = new RouteLayer({
})
this._map.add(newRouteLayer);
const routeParams = new RouteParameters({
//comes from angular env
apiKey: environment.esriKey,
stops: allStops
});
let loaded = await newRouteLayer.load();
if(loaded){
await newRouteLayer.solve(routeParams)
.then((resolved: any) => {
newRouteLayer.update(resolved)
}, failed => {
console.log(failed);
});
}
also want to ask why route layer solves with RouteLayerSolveResult but routeLayer.update() is expecting a RouteLayerUpdateRouteLayerSolveResult object.
big disconnect from the docs. please help