index.d.ts 1.3 KB

12345678910111213141516171819202122232425262728
  1. import { BBox, Feature, Polygon, MultiPolygon, FeatureCollection, Point, Properties, Units } from "@turf/helpers";
  2. /**
  3. * Creates a {@link Point} grid from a bounding box, {@link FeatureCollection} or {@link Feature}.
  4. *
  5. * @name pointGrid
  6. * @param {Array<number>} bbox extent in [minX, minY, maxX, maxY] order
  7. * @param {number} cellSide the distance between points, in units
  8. * @param {Object} [options={}] Optional parameters
  9. * @param {string} [options.units='kilometers'] used in calculating cellSide, can be degrees, radians, miles, or kilometers
  10. * @param {Feature<Polygon|MultiPolygon>} [options.mask] if passed a Polygon or MultiPolygon, the grid Points will be created only inside it
  11. * @param {Object} [options.properties={}] passed to each point of the grid
  12. * @returns {FeatureCollection<Point>} grid of points
  13. * @example
  14. * var extent = [-70.823364, -33.553984, -70.473175, -33.302986];
  15. * var cellSide = 3;
  16. * var options = {units: 'miles'};
  17. *
  18. * var grid = turf.pointGrid(extent, cellSide, options);
  19. *
  20. * //addToMap
  21. * var addToMap = [grid];
  22. */
  23. declare function pointGrid<P = Properties>(bbox: BBox, cellSide: number, options?: {
  24. units?: Units;
  25. mask?: Feature<Polygon | MultiPolygon>;
  26. properties?: P;
  27. }): FeatureCollection<Point, P>;
  28. export default pointGrid;