TomTom Maps for JavaScript
    Preparing search index...

    Function getSectionOverlap

    • The stretch two sections of one route share, by point index.

      Parameters

      • section: RouteSpan

        A section of the route, of any type; a leg section only with its point indexes.

      • other: RouteSpan

        Another section of the same route, likewise.

      Returns RouteSpan | undefined

      The shared stretch, or undefined when they share no segment, as two sections meeting at one point don't.

      const { country = [], toll = [] } = route.properties.sections;
      const france = country.find((section) => section.countryCodeISO3 === 'FRA');
      const tollsInFrance = france ? toll.filter((section) => getSectionOverlap(section, france)) : [];