index.d.ts 1.2 KB

12345678910111213141516171819202122232425262728
  1. import { Coord, Feature, MultiPolygon, Polygon, Properties } from "@turf/helpers";
  2. /**
  3. * Takes a {@link Point} and a {@link Polygon} or {@link MultiPolygon} and determines if the point
  4. * resides inside the polygon. The polygon can be convex or concave. The function accounts for holes.
  5. *
  6. * @name booleanPointInPolygon
  7. * @param {Coord} point input point
  8. * @param {Feature<Polygon|MultiPolygon>} polygon input polygon or multipolygon
  9. * @param {Object} [options={}] Optional parameters
  10. * @param {boolean} [options.ignoreBoundary=false] True if polygon boundary should be ignored when determining if
  11. * the point is inside the polygon otherwise false.
  12. * @returns {boolean} `true` if the Point is inside the Polygon; `false` if the Point is not inside the Polygon
  13. * @example
  14. * var pt = turf.point([-77, 44]);
  15. * var poly = turf.polygon([[
  16. * [-81, 41],
  17. * [-81, 47],
  18. * [-72, 47],
  19. * [-72, 41],
  20. * [-81, 41]
  21. * ]]);
  22. *
  23. * turf.booleanPointInPolygon(pt, poly);
  24. * //= true
  25. */
  26. export default function booleanPointInPolygon<G extends Polygon | MultiPolygon, P = Properties>(point: Coord, polygon: Feature<G, P> | G, options?: {
  27. ignoreBoundary?: boolean;
  28. }): boolean;