@turf/square-grid 7.0.0-alpha.1 → 7.0.0-alpha.110
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -9
- package/dist/cjs/index.cjs +15 -0
- package/dist/cjs/index.cjs.map +1 -0
- package/dist/{js → cjs}/index.d.ts +6 -3
- package/dist/{es/index.js → esm/index.d.mts} +10 -4
- package/dist/esm/index.mjs +15 -0
- package/dist/esm/index.mjs.map +1 -0
- package/package.json +33 -28
- package/dist/es/package.json +0 -1
- package/dist/js/index.js +0 -31
package/README.md
CHANGED
|
@@ -49,26 +49,21 @@ Returns **[FeatureCollection][8]<[Polygon][6]>** grid a grid of polygons
|
|
|
49
49
|
|
|
50
50
|
[8]: https://tools.ietf.org/html/rfc7946#section-3.3
|
|
51
51
|
|
|
52
|
-
<!-- This file is automatically generated. Please don't edit it directly
|
|
53
|
-
if you find an error, edit the source file (likely index.js), and re-run
|
|
54
|
-
./scripts/generate-readmes in the turf project. -->
|
|
52
|
+
<!-- This file is automatically generated. Please don't edit it directly. If you find an error, edit the source file of the module in question (likely index.js or index.ts), and re-run "yarn docs" from the root of the turf project. -->
|
|
55
53
|
|
|
56
54
|
---
|
|
57
55
|
|
|
58
|
-
This module is part of the [Turfjs project](
|
|
59
|
-
module collection dedicated to geographic algorithms. It is maintained in the
|
|
60
|
-
[Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create
|
|
61
|
-
PRs and issues.
|
|
56
|
+
This module is part of the [Turfjs project](https://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.
|
|
62
57
|
|
|
63
58
|
### Installation
|
|
64
59
|
|
|
65
|
-
Install this module individually:
|
|
60
|
+
Install this single module individually:
|
|
66
61
|
|
|
67
62
|
```sh
|
|
68
63
|
$ npm install @turf/square-grid
|
|
69
64
|
```
|
|
70
65
|
|
|
71
|
-
Or install the
|
|
66
|
+
Or install the all-encompassing @turf/turf module that includes all modules as functions:
|
|
72
67
|
|
|
73
68
|
```sh
|
|
74
69
|
$ npm install @turf/turf
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
|
|
4
|
+
// index.ts
|
|
5
|
+
var _rectanglegrid = require('@turf/rectangle-grid');
|
|
6
|
+
function squareGrid(bbox, cellSide, options = {}) {
|
|
7
|
+
return _rectanglegrid.rectangleGrid.call(void 0, bbox, cellSide, cellSide, options);
|
|
8
|
+
}
|
|
9
|
+
__name(squareGrid, "squareGrid");
|
|
10
|
+
var turf_square_grid_default = squareGrid;
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
exports.default = turf_square_grid_default; exports.squareGrid = squareGrid;
|
|
15
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../index.ts"],"names":[],"mappings":";;;;AASA,SAAS,qBAAqB;AA0B9B,SAAS,WACP,MACA,UACA,UAII,CAAC,GAC0B;AAC/B,SAAO,cAAc,MAAM,UAAU,UAAU,OAAO;AACxD;AAVS;AAaT,IAAO,2BAAQ","sourcesContent":["import {\n FeatureCollection,\n Polygon,\n BBox,\n Feature,\n MultiPolygon,\n GeoJsonProperties,\n} from \"geojson\";\nimport { Units } from \"@turf/helpers\";\nimport { rectangleGrid } from \"@turf/rectangle-grid\";\n\n/**\n * Creates a square grid from a bounding box.\n *\n * @name squareGrid\n * @param {Array<number>} bbox extent in [minX, minY, maxX, maxY] order\n * @param {number} cellSide of each cell, in units\n * @param {Object} [options={}] Optional parameters\n * @param {string} [options.units='kilometers'] used in calculating cellSide, can be degrees,\n * radians, miles, or kilometers\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>} grid a grid of polygons\n * @example\n * var bbox = [-95, 30 ,-85, 40];\n * var cellSide = 50;\n * var options = {units: 'miles'};\n *\n * var squareGrid = turf.squareGrid(bbox, cellSide, options);\n *\n * //addToMap\n * var addToMap = [squareGrid]\n */\n\nfunction squareGrid<P extends GeoJsonProperties = GeoJsonProperties>(\n bbox: BBox,\n cellSide: number,\n options: {\n units?: Units;\n properties?: P;\n mask?: Feature<Polygon | MultiPolygon> | Polygon | MultiPolygon;\n } = {}\n): FeatureCollection<Polygon, P> {\n return rectangleGrid(bbox, cellSide, cellSide, options);\n}\n\nexport { squareGrid };\nexport default squareGrid;\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Units } from
|
|
1
|
+
import { GeoJsonProperties, BBox, Feature, Polygon, MultiPolygon, FeatureCollection } from 'geojson';
|
|
2
|
+
import { Units } from '@turf/helpers';
|
|
3
|
+
|
|
3
4
|
/**
|
|
4
5
|
* Creates a square grid from a bounding box.
|
|
5
6
|
*
|
|
@@ -23,8 +24,10 @@ import { Units } from "@turf/helpers";
|
|
|
23
24
|
* //addToMap
|
|
24
25
|
* var addToMap = [squareGrid]
|
|
25
26
|
*/
|
|
26
|
-
|
|
27
|
+
declare function squareGrid<P extends GeoJsonProperties = GeoJsonProperties>(bbox: BBox, cellSide: number, options?: {
|
|
27
28
|
units?: Units;
|
|
28
29
|
properties?: P;
|
|
29
30
|
mask?: Feature<Polygon | MultiPolygon> | Polygon | MultiPolygon;
|
|
30
31
|
}): FeatureCollection<Polygon, P>;
|
|
32
|
+
|
|
33
|
+
export { squareGrid as default, squareGrid };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { GeoJsonProperties, BBox, Feature, Polygon, MultiPolygon, FeatureCollection } from 'geojson';
|
|
2
|
+
import { Units } from '@turf/helpers';
|
|
3
|
+
|
|
2
4
|
/**
|
|
3
5
|
* Creates a square grid from a bounding box.
|
|
4
6
|
*
|
|
@@ -22,6 +24,10 @@ import rectangleGrid from "@turf/rectangle-grid";
|
|
|
22
24
|
* //addToMap
|
|
23
25
|
* var addToMap = [squareGrid]
|
|
24
26
|
*/
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
declare function squareGrid<P extends GeoJsonProperties = GeoJsonProperties>(bbox: BBox, cellSide: number, options?: {
|
|
28
|
+
units?: Units;
|
|
29
|
+
properties?: P;
|
|
30
|
+
mask?: Feature<Polygon | MultiPolygon> | Polygon | MultiPolygon;
|
|
31
|
+
}): FeatureCollection<Polygon, P>;
|
|
32
|
+
|
|
33
|
+
export { squareGrid as default, squareGrid };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
|
|
4
|
+
// index.ts
|
|
5
|
+
import { rectangleGrid } from "@turf/rectangle-grid";
|
|
6
|
+
function squareGrid(bbox, cellSide, options = {}) {
|
|
7
|
+
return rectangleGrid(bbox, cellSide, cellSide, options);
|
|
8
|
+
}
|
|
9
|
+
__name(squareGrid, "squareGrid");
|
|
10
|
+
var turf_square_grid_default = squareGrid;
|
|
11
|
+
export {
|
|
12
|
+
turf_square_grid_default as default,
|
|
13
|
+
squareGrid
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../index.ts"],"sourcesContent":["import {\n FeatureCollection,\n Polygon,\n BBox,\n Feature,\n MultiPolygon,\n GeoJsonProperties,\n} from \"geojson\";\nimport { Units } from \"@turf/helpers\";\nimport { rectangleGrid } from \"@turf/rectangle-grid\";\n\n/**\n * Creates a square grid from a bounding box.\n *\n * @name squareGrid\n * @param {Array<number>} bbox extent in [minX, minY, maxX, maxY] order\n * @param {number} cellSide of each cell, in units\n * @param {Object} [options={}] Optional parameters\n * @param {string} [options.units='kilometers'] used in calculating cellSide, can be degrees,\n * radians, miles, or kilometers\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>} grid a grid of polygons\n * @example\n * var bbox = [-95, 30 ,-85, 40];\n * var cellSide = 50;\n * var options = {units: 'miles'};\n *\n * var squareGrid = turf.squareGrid(bbox, cellSide, options);\n *\n * //addToMap\n * var addToMap = [squareGrid]\n */\n\nfunction squareGrid<P extends GeoJsonProperties = GeoJsonProperties>(\n bbox: BBox,\n cellSide: number,\n options: {\n units?: Units;\n properties?: P;\n mask?: Feature<Polygon | MultiPolygon> | Polygon | MultiPolygon;\n } = {}\n): FeatureCollection<Polygon, P> {\n return rectangleGrid(bbox, cellSide, cellSide, options);\n}\n\nexport { squareGrid };\nexport default squareGrid;\n"],"mappings":";;;;AASA,SAAS,qBAAqB;AA0B9B,SAAS,WACP,MACA,UACA,UAII,CAAC,GAC0B;AAC/B,SAAO,cAAc,MAAM,UAAU,UAAU,OAAO;AACxD;AAVS;AAaT,IAAO,2BAAQ;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@turf/square-grid",
|
|
3
|
-
"version": "7.0.0-alpha.
|
|
3
|
+
"version": "7.0.0-alpha.110+1411d63a7",
|
|
4
4
|
"description": "turf square-grid module",
|
|
5
5
|
"author": "Turf Authors",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,46 +23,51 @@
|
|
|
23
23
|
"cartesian",
|
|
24
24
|
"grid"
|
|
25
25
|
],
|
|
26
|
-
"
|
|
27
|
-
"
|
|
26
|
+
"type": "commonjs",
|
|
27
|
+
"main": "dist/cjs/index.cjs",
|
|
28
|
+
"module": "dist/esm/index.mjs",
|
|
29
|
+
"types": "dist/cjs/index.d.ts",
|
|
28
30
|
"exports": {
|
|
29
31
|
"./package.json": "./package.json",
|
|
30
32
|
".": {
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
"import": {
|
|
34
|
+
"types": "./dist/esm/index.d.mts",
|
|
35
|
+
"default": "./dist/esm/index.mjs"
|
|
36
|
+
},
|
|
37
|
+
"require": {
|
|
38
|
+
"types": "./dist/cjs/index.d.ts",
|
|
39
|
+
"default": "./dist/cjs/index.cjs"
|
|
40
|
+
}
|
|
34
41
|
}
|
|
35
42
|
},
|
|
36
|
-
"types": "dist/js/index.d.ts",
|
|
37
43
|
"sideEffects": false,
|
|
38
44
|
"files": [
|
|
39
45
|
"dist"
|
|
40
46
|
],
|
|
41
47
|
"scripts": {
|
|
42
|
-
"bench": "tsx bench.
|
|
43
|
-
"build": "
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"test": "npm-run-all test:*",
|
|
48
|
-
"test:tape": "tsx test.js"
|
|
48
|
+
"bench": "tsx bench.ts",
|
|
49
|
+
"build": "tsup --config ../../tsup.config.ts",
|
|
50
|
+
"docs": "tsx ../../scripts/generate-readmes.ts",
|
|
51
|
+
"test": "npm-run-all --npm-path npm test:*",
|
|
52
|
+
"test:tape": "tsx test.ts"
|
|
49
53
|
},
|
|
50
54
|
"devDependencies": {
|
|
51
|
-
"@turf/bbox-polygon": "^7.0.0-alpha.
|
|
52
|
-
"@turf/truncate": "^7.0.0-alpha.
|
|
53
|
-
"@types/
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
55
|
+
"@turf/bbox-polygon": "^7.0.0-alpha.110+1411d63a7",
|
|
56
|
+
"@turf/truncate": "^7.0.0-alpha.110+1411d63a7",
|
|
57
|
+
"@types/benchmark": "^2.1.5",
|
|
58
|
+
"@types/tape": "^4.2.32",
|
|
59
|
+
"benchmark": "^2.1.4",
|
|
60
|
+
"npm-run-all": "^4.1.5",
|
|
61
|
+
"tape": "^5.7.2",
|
|
62
|
+
"tsup": "^8.0.1",
|
|
63
|
+
"tsx": "^4.6.2",
|
|
64
|
+
"typescript": "^5.2.2",
|
|
65
|
+
"write-json-file": "^5.0.0"
|
|
61
66
|
},
|
|
62
67
|
"dependencies": {
|
|
63
|
-
"@turf/helpers": "^7.0.0-alpha.
|
|
64
|
-
"@turf/rectangle-grid": "^7.0.0-alpha.
|
|
65
|
-
"tslib": "^2.
|
|
68
|
+
"@turf/helpers": "^7.0.0-alpha.110+1411d63a7",
|
|
69
|
+
"@turf/rectangle-grid": "^7.0.0-alpha.110+1411d63a7",
|
|
70
|
+
"tslib": "^2.6.2"
|
|
66
71
|
},
|
|
67
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "1411d63a74c275c9216fe48e9d3cb2d48a359068"
|
|
68
73
|
}
|
package/dist/es/package.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"type":"module"}
|
package/dist/js/index.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
const rectangle_grid_1 = tslib_1.__importDefault(require("@turf/rectangle-grid"));
|
|
5
|
-
/**
|
|
6
|
-
* Creates a square grid from a bounding box.
|
|
7
|
-
*
|
|
8
|
-
* @name squareGrid
|
|
9
|
-
* @param {Array<number>} bbox extent in [minX, minY, maxX, maxY] order
|
|
10
|
-
* @param {number} cellSide of each cell, in units
|
|
11
|
-
* @param {Object} [options={}] Optional parameters
|
|
12
|
-
* @param {string} [options.units='kilometers'] used in calculating cellSide, can be degrees,
|
|
13
|
-
* radians, miles, or kilometers
|
|
14
|
-
* @param {Feature<Polygon|MultiPolygon>} [options.mask] if passed a Polygon or MultiPolygon,
|
|
15
|
-
* the grid Points will be created only inside it
|
|
16
|
-
* @param {Object} [options.properties={}] passed to each point of the grid
|
|
17
|
-
* @returns {FeatureCollection<Polygon>} grid a grid of polygons
|
|
18
|
-
* @example
|
|
19
|
-
* var bbox = [-95, 30 ,-85, 40];
|
|
20
|
-
* var cellSide = 50;
|
|
21
|
-
* var options = {units: 'miles'};
|
|
22
|
-
*
|
|
23
|
-
* var squareGrid = turf.squareGrid(bbox, cellSide, options);
|
|
24
|
-
*
|
|
25
|
-
* //addToMap
|
|
26
|
-
* var addToMap = [squareGrid]
|
|
27
|
-
*/
|
|
28
|
-
function squareGrid(bbox, cellSide, options = {}) {
|
|
29
|
-
return rectangle_grid_1.default(bbox, cellSide, cellSide, options);
|
|
30
|
-
}
|
|
31
|
-
exports.default = squareGrid;
|