TomTom Maps for JavaScript
    Preparing search index...

    Function getSectionBBox

    • Calculates the bounding box for a route section.

      This function computes a bbox by sampling coordinates from the section at three key points:

      • Start point (startPointIndex)
      • Middle point (midpoint between start and end)
      • End point (endPointIndex)

      Parameters

      • route: Route

        The route containing the section

      • section: SectionProps

        The section to calculate the bbox for

      Returns OptionalBBox

      The bounding box as [minLng, minLat, maxLng, maxLat], or undefined if the section or route is invalid

      • Samples three points for efficiency while maintaining good accuracy
      • Returns undefined if the route has no coordinates or section indices are invalid
      • Uses existing bbox utilities for consistent calculation
      const section = route.properties.sections.countries[0];
      // section = { id: 'section-1', startPointIndex: 0, endPointIndex: 3, countryCodeISO3: 'NLD' }

      const bbox = getSectionBBox(route, section);
      // Returns: [minLng, minLat, maxLng, maxLat] spanning the section, or undefined