index.d.ts 1.2 KB

12345678910111213141516171819202122232425262728
  1. import { Units, BBox, Feature, Polygon, FeatureCollection, Properties } from "@turf/helpers";
  2. /**
  3. * Takes a bounding box and a cell depth and returns a set of triangular {@link Polygon|polygons} in a grid.
  4. *
  5. * @name triangleGrid
  6. * @param {Array<number>} bbox extent in [minX, minY, maxX, maxY] order
  7. * @param {number} cellSide dimension of each cell
  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>} [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<Polygon>} grid of polygons
  13. * @example
  14. * var bbox = [-95, 30 ,-85, 40];
  15. * var cellSide = 50;
  16. * var options = {units: 'miles'};
  17. *
  18. * var triangleGrid = turf.triangleGrid(bbox, cellSide, options);
  19. *
  20. * //addToMap
  21. * var addToMap = [triangleGrid];
  22. */
  23. declare function triangleGrid<P = Properties>(bbox: BBox, cellSide: number, options?: {
  24. units?: Units;
  25. properties?: P;
  26. mask?: Feature<Polygon> | Polygon;
  27. }): FeatureCollection<Polygon, P>;
  28. export default triangleGrid;