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
41 lines (40 loc) • 1.63 kB
TypeScript
import { Feature, MultiPolygon, Polygon, Properties } from "@turf/helpers";
/**
* Takes two {@link Polygon|polygon} or {@link MultiPolygon|multi-polygon} geometries and
* finds their polygonal intersection. If they don't intersect, returns null.
*
* @name intersect
* @param {Feature<Polygon | MultiPolygon>} poly1 the first polygon or multipolygon
* @param {Feature<Polygon | MultiPolygon>} poly2 the second polygon or multipolygon
* @param {Object} [options={}] Optional Parameters
* @param {Object} [options.properties={}] Translate GeoJSON Properties to Feature
* @returns {Feature|null} returns a feature representing the area they share (either a {@link Polygon} or
* {@link MultiPolygon}). If they do not share any area, returns `null`.
* @example
* var poly1 = turf.polygon([[
* [-122.801742, 45.48565],
* [-122.801742, 45.60491],
* [-122.584762, 45.60491],
* [-122.584762, 45.48565],
* [-122.801742, 45.48565]
* ]]);
*
* var poly2 = turf.polygon([[
* [-122.520217, 45.535693],
* [-122.64038, 45.553967],
* [-122.720031, 45.526554],
* [-122.669906, 45.507309],
* [-122.723464, 45.446643],
* [-122.532577, 45.408574],
* [-122.487258, 45.477466],
* [-122.520217, 45.535693]
* ]]);
*
* var intersection = turf.intersect(poly1, poly2);
*
* //addToMap
* var addToMap = [poly1, poly2, intersection];
*/
export default function intersect<P = Properties>(poly1: Feature<Polygon | MultiPolygon> | Polygon | MultiPolygon, poly2: Feature<Polygon | MultiPolygon> | Polygon | MultiPolygon, options?: {
properties?: P;
}): Feature<Polygon | MultiPolygon, P> | null;