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
87 lines (59 loc) • 2.37 kB
Markdown
# @turf/points-within-polygon
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
## pointsWithinPolygon
Finds [Points][1] that fall within [(Multi)Polygon(s)][2].
**Parameters**
- `points` **([Feature][3] \| [FeatureCollection][4]<[Point][5]>)** Points as input search
- `polygons` **([FeatureCollection][4] \| [Geometry][6] \| [Feature][3]<([Polygon][7] \| [MultiPolygon][8])>)** Points must be within these (Multi)Polygon(s)
**Examples**
```javascript
var points = turf.points([
[-46.6318, -23.5523],
[-46.6246, -23.5325],
[-46.6062, -23.5513],
[-46.663, -23.554],
[-46.643, -23.557]
]);
var searchWithin = turf.polygon([[
[-46.653,-23.543],
[-46.634,-23.5346],
[-46.613,-23.543],
[-46.614,-23.559],
[-46.631,-23.567],
[-46.653,-23.560],
[-46.653,-23.543]
]]);
var ptsWithin = turf.pointsWithinPolygon(points, searchWithin);
//addToMap
var addToMap = [points, searchWithin, ptsWithin]
turf.featureEach(ptsWithin, function (currentFeature) {
currentFeature.properties['marker-size'] = 'large';
currentFeature.properties['marker-color'] = '#000';
});
```
Returns **[FeatureCollection][4]<[Point][5]>** points that land within at least one polygon
[1]: https://tools.ietf.org/html/rfc7946#section-3.1.2
[2]: https://tools.ietf.org/html/rfc7946#section-3.1.6
[3]: https://tools.ietf.org/html/rfc7946#section-3.2
[4]: https://tools.ietf.org/html/rfc7946#section-3.3
[5]: https://tools.ietf.org/html/rfc7946#section-3.1.2
[6]: https://tools.ietf.org/html/rfc7946#section-3.1
[7]: https://tools.ietf.org/html/rfc7946#section-3.1.6
[8]: https://tools.ietf.org/html/rfc7946#section-3.1.7
<!-- 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/points-within-polygon
```
Or install the Turf module that includes it as a function:
```sh
$ npm install @turf/turf
```