TomTom Maps for JavaScript
    Preparing search index...

    Function withCurveSections

    • A copy of a route with its curves and curvy stretches found again, with thresholds of your own.

      Parameters

      • route: Route

        The route, with its geometry, and its guidance instructions when it has them.

      • options: CurveDetectionOptions = {}

        The thresholds, calculateRoute's curveDetection among them.

      Returns Route

      The route with new sections.curve and sections.curvyStretch, each left out when it finds none. Its other sections stay as they are.

      • Tune the thresholds on routes you already have, with no new request. Calling getCurveSections and getCurvyStretchSections yourself does the same, as long as you pass the new curves to the second.
      • The curves read the route as it came back: a maneuver needs its guidance, and a severity its speedLimit sections. Ask for both when you calculate it.
      // Count the sweeping bends of up to 500 m too
      const wider = routes.features.map((route) => withCurveSections(route, { curve: { maxRadiusInMeters: 500 } }));
      await routingModule.showRoutes({ ...routes, features: wider });