node-red-contrib-tak-registration
Version:
A Node-RED node to register to TAK and to help wrap files as datapackages to send to TAK
29 lines (28 loc) • 1.1 kB
JavaScript
import rectangleGrid from "@turf/rectangle-grid";
/**
* Creates a square grid from a bounding box.
*
* @name squareGrid
* @param {Array<number>} bbox extent in [minX, minY, maxX, maxY] order
* @param {number} cellSide of each cell, in units
* @param {Object} [options={}] Optional parameters
* @param {string} [options.units='kilometers'] used in calculating cellSide, can be degrees,
* radians, miles, or kilometers
* @param {Feature<Polygon|MultiPolygon>} [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 a grid of polygons
* @example
* var bbox = [-95, 30 ,-85, 40];
* var cellSide = 50;
* var options = {units: 'miles'};
*
* var squareGrid = turf.squareGrid(bbox, cellSide, options);
*
* //addToMap
* var addToMap = [squareGrid]
*/
export default function squareGrid(bbox, cellSide, options) {
if (options === void 0) { options = {}; }
return rectangleGrid(bbox, cellSide, cellSide, options);
}