index.d.ts 1.2 KB

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