Seeking Suggestions for Incorporating Traffic Information in Routing Implementation using RouteLayer

180
1
06-20-2023 07:21 AM
abhishek_595
New Contributor III

Hi, 

I am currently working on implementing Routing with Live Traffic Information. During my implementation, I discovered the RouteLayer, which provides information for DirectionLines. However, I have noticed that the directionLineType in my code only returns values such as "segment" and "maneuver-segment". I am looking for additional data related to traffic conditions along the route, specifically for directionLineTypes like "heavy-traffic", "slow-traffic", and "moderate-traffic". I would greatly appreciate any suggestions or possible solutions to incorporate this traffic information into my implementation.

 

RouteWithTraffic() => {
const routeLayer = new RouteLayer({
  stops,
  returnStops: true,
  apiKey: process.env.REACT_APP_API_KEY ,
  returnDirections: true,
  returnRoutes:true,
  startTime: "now",
 
});
map.add(routeLayer);
view.when().then(async () => {
  await routeLayer.solve({  apiKey: process.env.REACT_APP_API_KEY }).then(results=>{

    var directionLines = results.directionLines.items;
    directionLines.forEach(result => {
    console.log("directionLineType",result.directionLineType)
 
      var graphic = new Graphic({
        geometry:result.geometry,
        symbol:result.symbol,
      })
      view.graphics.add(graphic);
    });
 
  routeLayer.update(results);

  // Zoom to the extent of the solve route.
  view.goTo(routeLayer.routeInfo.geometry);

  });


});
0 Kudos
1 Reply
abhishek_595
New Contributor III

@williambohrmann3 , Can you also help  me with this .

0 Kudos