index.d.cts 1.3 KB

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