index.d.cts 906 B

123456789101112131415161718192021222324
  1. import { GeometryObject, FeatureCollection } from 'geojson';
  2. /**
  3. * Takes a {@link FeatureCollection} and returns a FeatureCollection with given number of {@link Feature|features} at random.
  4. *
  5. * @function
  6. * @param {FeatureCollection} featurecollection set of input features
  7. * @param {number} num number of features to select
  8. * @returns {FeatureCollection} a FeatureCollection with `n` features
  9. * @example
  10. * var points = turf.randomPoint(100, {bbox: [-80, 30, -60, 60]});
  11. *
  12. * var sample = turf.sample(points, 5);
  13. *
  14. * //addToMap
  15. * var addToMap = [points, sample]
  16. * turf.featureEach(sample, function (currentFeature) {
  17. * currentFeature.properties['marker-size'] = 'large';
  18. * currentFeature.properties['marker-color'] = '#000';
  19. * });
  20. */
  21. declare function sample<T extends GeometryObject>(fc: FeatureCollection<T>, num: number): FeatureCollection<T>;
  22. export { sample as default, sample };