Socket
Socket
Sign inDemoInstall

@turf/triangle-grid

Package Overview
Dependencies
59
Maintainers
7
Versions
54
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 6.5.0 to 7.0.0-alpha.0

9

dist/es/index.js
import distance from "@turf/distance";
import intersect from "@turf/intersect";
import { polygon, featureCollection, } from "@turf/helpers";
import { polygon, featureCollection } from "@turf/helpers";
/**

@@ -25,4 +25,3 @@ * Takes a bounding box and a cell depth and returns a set of triangular {@link Polygon|polygons} in a grid.

*/
function triangleGrid(bbox, cellSide, options) {
if (options === void 0) { options = {}; }
function triangleGrid(bbox, cellSide, options = {}) {
// Containers

@@ -123,5 +122,5 @@ var results = [];

if (options.mask) {
if (intersect(options.mask, cellTriangle1))
if (intersect(featureCollection([options.mask, cellTriangle1])))
results.push(cellTriangle1);
if (intersect(options.mask, cellTriangle2))
if (intersect(featureCollection([options.mask, cellTriangle2])))
results.push(cellTriangle2);

@@ -128,0 +127,0 @@ }

@@ -1,2 +0,3 @@

import { Units, BBox, Feature, Polygon, FeatureCollection, Properties } from "@turf/helpers";
import { BBox, Feature, Polygon, FeatureCollection, GeoJsonProperties } from "geojson";
import { Units } from "@turf/helpers";
/**

@@ -23,7 +24,7 @@ * Takes a bounding box and a cell depth and returns a set of triangular {@link Polygon|polygons} in a grid.

*/
declare function triangleGrid<P = Properties>(bbox: BBox, cellSide: number, options?: {
declare function triangleGrid<P = GeoJsonProperties>(bbox: BBox, cellSide: number, options?: {
units?: Units;
properties?: P;
mask?: Feature<Polygon> | Polygon;
mask?: Feature<Polygon>;
}): FeatureCollection<Polygon, P>;
export default triangleGrid;
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var distance_1 = __importDefault(require("@turf/distance"));
var intersect_1 = __importDefault(require("@turf/intersect"));
var helpers_1 = require("@turf/helpers");
const tslib_1 = require("tslib");
const distance_1 = tslib_1.__importDefault(require("@turf/distance"));
const intersect_1 = tslib_1.__importDefault(require("@turf/intersect"));
const helpers_1 = require("@turf/helpers");
/**

@@ -30,4 +28,3 @@ * Takes a bounding box and a cell depth and returns a set of triangular {@link Polygon|polygons} in a grid.

*/
function triangleGrid(bbox, cellSide, options) {
if (options === void 0) { options = {}; }
function triangleGrid(bbox, cellSide, options = {}) {
// Containers

@@ -128,5 +125,5 @@ var results = [];

if (options.mask) {
if (intersect_1.default(options.mask, cellTriangle1))
if (intersect_1.default(helpers_1.featureCollection([options.mask, cellTriangle1])))
results.push(cellTriangle1);
if (intersect_1.default(options.mask, cellTriangle2))
if (intersect_1.default(helpers_1.featureCollection([options.mask, cellTriangle2])))
results.push(cellTriangle2);

@@ -133,0 +130,0 @@ }

{
"name": "@turf/triangle-grid",
"version": "6.5.0",
"version": "7.0.0-alpha.0",
"description": "turf triangle-grid module",

@@ -49,7 +49,7 @@ "author": "Turf Authors",

"test:tape": "ts-node -r esm test.js",
"test:types": "tsc --esModuleInterop --noEmit types.ts"
"test:types": "tsc --esModuleInterop --noEmit --strict types.ts"
},
"devDependencies": {
"@turf/bbox-polygon": "^6.5.0",
"@turf/truncate": "^6.5.0",
"@turf/bbox-polygon": "^7.0.0-alpha.0",
"@turf/truncate": "^7.0.0-alpha.0",
"@types/tape": "*",

@@ -66,7 +66,8 @@ "benchmark": "*",

"dependencies": {
"@turf/distance": "^6.5.0",
"@turf/helpers": "^6.5.0",
"@turf/intersect": "^6.5.0"
"@turf/distance": "^7.0.0-alpha.0",
"@turf/helpers": "^7.0.0-alpha.0",
"@turf/intersect": "^7.0.0-alpha.0",
"tslib": "^2.3.0"
},
"gitHead": "5375941072b90d489389db22b43bfe809d5e451e"
"gitHead": "0edc4c491b999e5ace770a61e1cf549f7c004189"
}

@@ -9,13 +9,14 @@ # @turf/triangle-grid

**Parameters**
### Parameters
- `bbox` **[Array][2]&lt;[number][3]>** extent in [minX, minY, maxX, maxY] order
- `cellSide` **[number][3]** dimension of each cell
- `options` **[Object][4]** Optional parameters (optional, default `{}`)
- `options.units` **[string][5]** used in calculating cellSide, can be degrees, radians, miles, or kilometers (optional, default `'kilometers'`)
- `options.mask` **[Feature][6]&lt;[Polygon][7]>?** if passed a Polygon or MultiPolygon, the grid Points will be created only inside it
- `options.properties` **[Object][4]** passed to each point of the grid (optional, default `{}`)
* `bbox` **[Array][2]<[number][3]>** extent in \[minX, minY, maxX, maxY] order
* `cellSide` **[number][3]** dimension of each cell
* `options` **[Object][4]** Optional parameters (optional, default `{}`)
**Examples**
* `options.units` **[string][5]** used in calculating cellSide, can be degrees, radians, miles, or kilometers (optional, default `'kilometers'`)
* `options.mask` **[Feature][6]<[Polygon][7]>?** if passed a Polygon or MultiPolygon, the grid Points will be created only inside it
* `options.properties` **[Object][4]** passed to each point of the grid (optional, default `{}`)
### Examples
```javascript

@@ -32,3 +33,3 @@ var bbox = [-95, 30 ,-85, 40];

Returns **[FeatureCollection][8]&lt;[Polygon][7]>** grid of polygons
Returns **[FeatureCollection][8]<[Polygon][7]>** grid of polygons

@@ -35,0 +36,0 @@ [1]: https://tools.ietf.org/html/rfc7946#section-3.1.6

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc