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
71 lines (51 loc) • 2.54 kB
Markdown
# @turf/tag
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
## tag
Takes a set of [points](https://tools.ietf.org/html/rfc7946#section-3.1.2) and a set of [polygons](https://tools.ietf.org/html/rfc7946#section-3.1.6) and/or [multipolygons](https://tools.ietf.org/html/rfc7946#section-3.1.7) and performs a spatial join.
**Parameters**
- `points` **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)<[Point](https://tools.ietf.org/html/rfc7946#section-3.1.2)>** input points
- `polygons` **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)<([Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6) \| [MultiPolygon](https://tools.ietf.org/html/rfc7946#section-3.1.7))>** input (multi)polygons
- `field` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** property in `polygons` to add to joined {<Point>} features
- `outField` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** property in `points` in which to store joined property from `polygons`
**Examples**
```javascript
var pt1 = turf.point([-77, 44]);
var pt2 = turf.point([-77, 38]);
var poly1 = turf.polygon([[
[-81, 41],
[-81, 47],
[-72, 47],
[-72, 41],
[-81, 41]
]], {pop: 3000});
var poly2 = turf.polygon([[
[-81, 35],
[-81, 41],
[-72, 41],
[-72, 35],
[-81, 35]
]], {pop: 1000});
var points = turf.featureCollection([pt1, pt2]);
var polygons = turf.featureCollection([poly1, poly2]);
var tagged = turf.tag(points, polygons, 'pop', 'population');
//addToMap
var addToMap = [tagged, polygons]
```
Returns **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)<[Point](https://tools.ietf.org/html/rfc7946#section-3.1.2)>** points with `containingPolyId` property containing values from `polyId`
<!-- This file is automatically generated. Please don't edit it directly:
if you find an error, edit the source file (likely index.js), and re-run
./scripts/generate-readmes in the turf project. -->
---
This module is part of the [Turfjs project](http://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 module individually:
```sh
$ npm install @turf/tag
```
Or install the Turf module that includes it as a function:
```sh
$ npm install @turf/turf
```