index.d.ts 976 B

1234567891011121314151617181920212223242526272829303132
  1. import { Feature, Point } from 'geojson';
  2. import { AllGeoJSON } from '@turf/helpers';
  3. /**
  4. * Takes a Feature or FeatureCollection and returns a {@link Point} guaranteed to be on the surface of the feature.
  5. *
  6. * * Given a {@link Polygon}, the point will be in the area of the polygon
  7. * * Given a {@link LineString}, the point will be along the string
  8. * * Given a {@link Point}, the point will the same as the input
  9. *
  10. * @function
  11. * @param {GeoJSON} geojson any Feature or FeatureCollection
  12. * @returns {Feature<Point>} a point on the surface of `input`
  13. * @example
  14. * var polygon = turf.polygon([[
  15. * [116, -36],
  16. * [131, -32],
  17. * [146, -43],
  18. * [155, -25],
  19. * [133, -9],
  20. * [111, -22],
  21. * [116, -36]
  22. * ]]);
  23. *
  24. * var pointOnPolygon = turf.pointOnFeature(polygon);
  25. *
  26. * //addToMap
  27. * var addToMap = [polygon, pointOnPolygon];
  28. */
  29. declare function pointOnFeature(geojson: AllGeoJSON): Feature<Point>;
  30. export { pointOnFeature as default, pointOnFeature };