locationIndexOnPath static method

int locationIndexOnPath(
  1. LatLng point,
  2. List<LatLng> poly,
  3. bool geodesic, {
  4. num tolerance = defaultTolerance,
})

Computes whether (and where) a given point lies on or near a polyline, within a specified tolerance. The polyline is not closed -- the closing segment between the first point and the last point is not included.

@param point our needle @param poly our haystack @param geodesic the polyline is composed of great circle segments if geodesic is true, and of Rhumb segments otherwise @param tolerance tolerance (in meters) @return -1 if point does not lie on or near the polyline. 0 if point is between poly0 and poly1 (inclusive), 1 if between poly1 and poly2, ..., poly.size()-2 if between polypoly.size() - 2 and polypoly.size() - 1

Implementation

static int locationIndexOnPath(LatLng point, List<LatLng> poly, bool geodesic,
        {num tolerance = defaultTolerance}) =>
    locationIndexOnEdgeOrPath(point, poly, false, geodesic, tolerance);