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
75 lines (47 loc) • 2.91 kB
Markdown
# @turf/rectangle-grid
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
## rectangleGrid
Creates a grid of rectangular polygons with width and height consistent in degrees
### Parameters
* `bbox` **[BBox][1]** extent of grid in \[minX, minY, maxX, maxY] order. If the grid does not fill the bbox perfectly, it is centered.
* `cellWidth` **[number][2]** width of each cell, in units
* `cellHeight` **[number][2]** height of each cell, in units
* `options` **[Object][3]** Optional parameters (optional, default `{}`)
* `options.units` **Units** the units of the cell width and height value.
Supports all valid Turf [Units][4].
If you are looking for rectangles with equal width and height in linear units (e.g. kilometers) this is not the module for you.
The cellWidth and cellHeight is converted from units provided to degrees internally, so the width and height of resulting polygons will be consistent only in degrees. (optional, default `'kilometers'`)
* `options.mask` **[Feature][5]<([Polygon][6] | [MultiPolygon][7])>?** if passed a Polygon or MultiPolygon,
the grid Points will be created only inside it
* `options.properties` **[Object][3]** passed to each point of the grid (optional, default `{}`)
### Examples
```javascript
var bbox = [-95, 30 ,-85, 40];
var cellWidth = 50;
var cellHeight = 20;
var options = {units: 'miles'};
var rectangleGrid = turf.rectangleGrid(bbox, cellWidth, cellHeight, options);
//addToMap
var addToMap = [rectangleGrid]
```
Returns **[FeatureCollection][8]<[Polygon][6]>** a grid of polygons
[1]: https://tools.ietf.org/html/rfc7946#section-5
[2]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
[4]: https://github.com/Turfjs/turf/blob/master/packages/turf-helpers/README_UNITS.md
[5]: https://tools.ietf.org/html/rfc7946#section-3.2
[6]: https://tools.ietf.org/html/rfc7946#section-3.1.6
[7]: https://tools.ietf.org/html/rfc7946#section-3.1.7
[8]: https://tools.ietf.org/html/rfc7946#section-3.3
<!-- This file is automatically generated. Please don't edit it directly. If you find an error, edit the source file of the module in question (likely index.js or index.ts), and re-run "yarn docs" from the root of the turf project. -->
---
This module is part of the [Turfjs project](https://turfjs.org/), an open source module collection dedicated to geographic algorithms. It is maintained in the [Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create PRs and issues.
### Installation
Install this single module individually:
```sh
$ npm install @turf/rectangle-grid
```
Or install the all-encompassing @turf/turf module that includes all modules as functions:
```sh
$ npm install @turf/turf
```