This is the documentation of version 1.0.0-rc.4. Go to the latest version, 1.0.0-rc.5.
TomTom Maps for JavaScript
    Preparing search index...

    Function getCurveSections

    • Finds the curves of a route: the stretches where the road keeps turning the same way.

      Parameters

      • route: Route

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

      • options: CurveSectionsOptions = {}

        The thresholds a stretch has to reach to count as a curve.

      Returns CurveSectionProps[]

      The curves, in order along the route.

      • calculateRoute fills sections.curve when its sectionTypes names curve, with these thresholds from its curveDetection.curve. Call this, or withCurveSections, to find them again with others.
      • A curve ends at a straight longer than maxStraightInMeters, or where the road turns the other way, so an S-bend is two curves.
      • A sharp corner between two straights, as at most junctions, is no curve: the road doesn't bend there. A roundabout is, and on a route with guidance a curve at a junction names its maneuver, as CurveSectionProps sets out.
      • Where a route turns back at a waypoint, as at the end of a dead-end road, it makes no curve.
      • Each curve's severity reads the route's speedLimit sections, when it has them.
      // Only the hard curves, to warn a passenger prone to motion sickness
      const hard = getCurveSections(route, { maxRadiusInMeters: 50, minHeadingChangeInDegrees: 60 });