UNPKG

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

1 lines 5.84 kB
{"version":3,"sources":["/home/runner/work/turf/turf/packages/turf-rectangle-grid/dist/cjs/index.cjs","../../index.ts"],"names":[],"mappings":"AAAA;ACAA,6DAA+C;AAS/C;AACE;AACA;AACA;AAAA,wCAEK;AA4BP,SAAS,aAAA,CACP,IAAA,EACA,SAAA,EACA,UAAA,EACA,QAAA,EAII,CAAC,CAAA,EAC0B;AAE/B,EAAA,MAAM,QAAA,EAAU,CAAC,CAAA;AACjB,EAAA,MAAM,KAAA,EAAO,IAAA,CAAK,CAAC,CAAA;AACnB,EAAA,MAAM,MAAA,EAAQ,IAAA,CAAK,CAAC,CAAA;AACpB,EAAA,MAAM,KAAA,EAAO,IAAA,CAAK,CAAC,CAAA;AACnB,EAAA,MAAM,MAAA,EAAQ,IAAA,CAAK,CAAC,CAAA;AAEpB,EAAA,MAAM,UAAA,EAAY,KAAA,EAAO,IAAA;AACzB,EAAA,MAAM,aAAA,EAAe,oCAAA,SAAc,EAAW,OAAA,CAAQ,KAAA,EAAO,SAAS,CAAA;AAEtE,EAAA,MAAM,WAAA,EAAa,MAAA,EAAQ,KAAA;AAC3B,EAAA,MAAM,cAAA,EAAgB,oCAAA,UAAc,EAAY,OAAA,CAAQ,KAAA,EAAO,SAAS,CAAA;AAExE,EAAA,MAAM,QAAA,EAAU,IAAA,CAAK,KAAA,CAAM,IAAA,CAAK,GAAA,CAAI,SAAS,EAAA,EAAI,YAAY,CAAA;AAC7D,EAAA,MAAM,KAAA,EAAO,IAAA,CAAK,KAAA,CAAM,IAAA,CAAK,GAAA,CAAI,UAAU,EAAA,EAAI,aAAa,CAAA;AAG5D,EAAA,MAAM,OAAA,EAAA,CAAU,UAAA,EAAY,QAAA,EAAU,YAAA,EAAA,EAAgB,CAAA;AACtD,EAAA,MAAM,OAAA,EAAA,CAAU,WAAA,EAAa,KAAA,EAAO,aAAA,EAAA,EAAiB,CAAA;AAGrD,EAAA,IAAI,SAAA,EAAW,KAAA,EAAO,MAAA;AACtB,EAAA,IAAA,CAAA,IAAS,OAAA,EAAS,CAAA,EAAG,OAAA,EAAS,OAAA,EAAS,MAAA,EAAA,EAAU;AAC/C,IAAA,IAAI,SAAA,EAAW,MAAA,EAAQ,MAAA;AACvB,IAAA,IAAA,CAAA,IAAS,IAAA,EAAM,CAAA,EAAG,IAAA,EAAM,IAAA,EAAM,GAAA,EAAA,EAAO;AACnC,MAAA,MAAM,SAAA,EAAW,8BAAA;AAAA,QACf;AAAA,UACE;AAAA,YACE,CAAC,QAAA,EAAU,QAAQ,CAAA;AAAA,YACnB,CAAC,QAAA,EAAU,SAAA,EAAW,aAAa,CAAA;AAAA,YACnC,CAAC,SAAA,EAAW,YAAA,EAAc,SAAA,EAAW,aAAa,CAAA;AAAA,YAClD,CAAC,SAAA,EAAW,YAAA,EAAc,QAAQ,CAAA;AAAA,YAClC,CAAC,QAAA,EAAU,QAAQ;AAAA,UACrB;AAAA,QACF,CAAA;AAAA,QACA,OAAA,CAAQ;AAAA,MACV,CAAA;AACA,MAAA,GAAA,CAAI,OAAA,CAAQ,IAAA,EAAM;AAChB,QAAA,GAAA,CAAI,kDAAA,OAAU,CAAQ,IAAA,EAAM,QAAQ,CAAA,EAAG;AACrC,UAAA,OAAA,CAAQ,IAAA,CAAK,QAAQ,CAAA;AAAA,QACvB;AAAA,MACF,EAAA,KAAO;AACL,QAAA,OAAA,CAAQ,IAAA,CAAK,QAAQ,CAAA;AAAA,MACvB;AAEA,MAAA,SAAA,GAAY,aAAA;AAAA,IACd;AACA,IAAA,SAAA,GAAY,YAAA;AAAA,EACd;AACA,EAAA,OAAO,wCAAA,OAAyB,CAAA;AAClC;AAGA,IAAO,4BAAA,EAAQ,aAAA;ADtDf;AACE;AACA;AACF,qFAAC","file":"/home/runner/work/turf/turf/packages/turf-rectangle-grid/dist/cjs/index.cjs","sourcesContent":[null,"import { booleanIntersects as intersect } from \"@turf/boolean-intersects\";\nimport {\n BBox,\n Feature,\n FeatureCollection,\n MultiPolygon,\n Polygon,\n GeoJsonProperties,\n} from \"geojson\";\nimport {\n convertLength,\n featureCollection,\n polygon,\n Units,\n} from \"@turf/helpers\";\n/**\n * Creates a grid of rectangular polygons with width and height consistent in degrees\n *\n * @function\n * @param {BBox} bbox extent of grid in [minX, minY, maxX, maxY] order. If the grid does not fill the bbox perfectly, it is centered.\n * @param {number} cellWidth width of each cell, in units\n * @param {number} cellHeight height of each cell, in units\n * @param {Object} [options={}] Optional parameters\n * @param {Units} [options.units='kilometers'] the units of the cell width and height value.\n * Supports all valid Turf {@link https://github.com/Turfjs/turf/blob/master/packages/turf-helpers/README_UNITS.md Units}.\n * If you are looking for rectangles with equal width and height in linear units (e.g. kilometers) this is not the module for you.\n * 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.\n * @param {Feature<Polygon|MultiPolygon>} [options.mask] if passed a Polygon or MultiPolygon,\n * the grid Points will be created only inside it\n * @param {Object} [options.properties={}] passed to each point of the grid\n * @returns {FeatureCollection<Polygon>} a grid of polygons\n * @example\n * var bbox = [-95, 30 ,-85, 40];\n * var cellWidth = 50;\n * var cellHeight = 20;\n * var options = {units: 'miles'};\n *\n * var rectangleGrid = turf.rectangleGrid(bbox, cellWidth, cellHeight, options);\n *\n * //addToMap\n * var addToMap = [rectangleGrid]\n */\nfunction rectangleGrid<P extends GeoJsonProperties = GeoJsonProperties>(\n bbox: BBox,\n cellWidth: number,\n cellHeight: number,\n options: {\n units?: Units;\n properties?: P;\n mask?: Feature<Polygon | MultiPolygon> | Polygon | MultiPolygon;\n } = {}\n): FeatureCollection<Polygon, P> {\n // Containers\n const results = [];\n const west = bbox[0];\n const south = bbox[1];\n const east = bbox[2];\n const north = bbox[3];\n\n const bboxWidth = east - west;\n const cellWidthDeg = convertLength(cellWidth, options.units, \"degrees\");\n\n const bboxHeight = north - south;\n const cellHeightDeg = convertLength(cellHeight, options.units, \"degrees\");\n\n const columns = Math.floor(Math.abs(bboxWidth) / cellWidthDeg);\n const rows = Math.floor(Math.abs(bboxHeight) / cellHeightDeg);\n\n // if the grid does not fill the bbox perfectly, center it.\n const deltaX = (bboxWidth - columns * cellWidthDeg) / 2;\n const deltaY = (bboxHeight - rows * cellHeightDeg) / 2;\n\n // iterate over columns & rows\n let currentX = west + deltaX;\n for (let column = 0; column < columns; column++) {\n let currentY = south + deltaY;\n for (let row = 0; row < rows; row++) {\n const cellPoly = polygon(\n [\n [\n [currentX, currentY],\n [currentX, currentY + cellHeightDeg],\n [currentX + cellWidthDeg, currentY + cellHeightDeg],\n [currentX + cellWidthDeg, currentY],\n [currentX, currentY],\n ],\n ],\n options.properties\n );\n if (options.mask) {\n if (intersect(options.mask, cellPoly)) {\n results.push(cellPoly);\n }\n } else {\n results.push(cellPoly);\n }\n\n currentY += cellHeightDeg;\n }\n currentX += cellWidthDeg;\n }\n return featureCollection(results);\n}\n\nexport { rectangleGrid };\nexport default rectangleGrid;\n"]}