29 lines
1.2 KiB
TypeScript
Executable File
29 lines
1.2 KiB
TypeScript
Executable File
import { Units, BBox, Feature, Polygon, FeatureCollection, Properties } from "@turf/helpers";
|
|
/**
|
|
* Takes a bounding box and a cell depth and returns a set of triangular {@link Polygon|polygons} in a grid.
|
|
*
|
|
* @name triangleGrid
|
|
* @param {Array<number>} bbox extent in [minX, minY, maxX, maxY] order
|
|
* @param {number} cellSide dimension of each cell
|
|
* @param {Object} [options={}] Optional parameters
|
|
* @param {string} [options.units='kilometers'] used in calculating cellSide, can be degrees, radians, miles, or kilometers
|
|
* @param {Feature<Polygon>} [options.mask] if passed a Polygon or MultiPolygon, the grid Points will be created only inside it
|
|
* @param {Object} [options.properties={}] passed to each point of the grid
|
|
* @returns {FeatureCollection<Polygon>} grid of polygons
|
|
* @example
|
|
* var bbox = [-95, 30 ,-85, 40];
|
|
* var cellSide = 50;
|
|
* var options = {units: 'miles'};
|
|
*
|
|
* var triangleGrid = turf.triangleGrid(bbox, cellSide, options);
|
|
*
|
|
* //addToMap
|
|
* var addToMap = [triangleGrid];
|
|
*/
|
|
declare function triangleGrid<P = Properties>(bbox: BBox, cellSide: number, options?: {
|
|
units?: Units;
|
|
properties?: P;
|
|
mask?: Feature<Polygon> | Polygon;
|
|
}): FeatureCollection<Polygon, P>;
|
|
export default triangleGrid;
|