@turf/square-grid 6.4.0 → 7.0.0-alpha.0
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 +26 -9
- package/dist/es/index.js +1 -2
- package/dist/js/index.d.ts +3 -2
- package/dist/js/index.js +3 -6
- package/package.json +8 -6
package/README.md
CHANGED
|
@@ -6,18 +6,19 @@
|
|
|
6
6
|
|
|
7
7
|
Creates a square grid from a bounding box.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
### Parameters
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
* `bbox` **[Array][1]<[number][2]>** extent in \[minX, minY, maxX, maxY] order
|
|
12
|
+
* `cellSide` **[number][2]** of each cell, in units
|
|
13
|
+
* `options` **[Object][3]** Optional parameters (optional, default `{}`)
|
|
14
|
+
|
|
15
|
+
* `options.units` **[string][4]** used in calculating cellSide, can be degrees,
|
|
15
16
|
radians, miles, or kilometers (optional, default `'kilometers'`)
|
|
16
|
-
|
|
17
|
+
* `options.mask` **[Feature][5]<([Polygon][6] | [MultiPolygon][7])>?** if passed a Polygon or MultiPolygon,
|
|
17
18
|
the grid Points will be created only inside it
|
|
18
|
-
|
|
19
|
+
* `options.properties` **[Object][3]** passed to each point of the grid (optional, default `{}`)
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
### Examples
|
|
21
22
|
|
|
22
23
|
```javascript
|
|
23
24
|
var bbox = [-95, 30 ,-85, 40];
|
|
@@ -30,7 +31,23 @@ var squareGrid = turf.squareGrid(bbox, cellSide, options);
|
|
|
30
31
|
var addToMap = [squareGrid]
|
|
31
32
|
```
|
|
32
33
|
|
|
33
|
-
Returns **[FeatureCollection]
|
|
34
|
+
Returns **[FeatureCollection][8]<[Polygon][6]>** grid a grid of polygons
|
|
35
|
+
|
|
36
|
+
[1]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
|
|
37
|
+
|
|
38
|
+
[2]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
|
|
39
|
+
|
|
40
|
+
[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
|
|
41
|
+
|
|
42
|
+
[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
|
|
43
|
+
|
|
44
|
+
[5]: https://tools.ietf.org/html/rfc7946#section-3.2
|
|
45
|
+
|
|
46
|
+
[6]: https://tools.ietf.org/html/rfc7946#section-3.1.6
|
|
47
|
+
|
|
48
|
+
[7]: https://tools.ietf.org/html/rfc7946#section-3.1.7
|
|
49
|
+
|
|
50
|
+
[8]: https://tools.ietf.org/html/rfc7946#section-3.3
|
|
34
51
|
|
|
35
52
|
<!-- This file is automatically generated. Please don't edit it directly:
|
|
36
53
|
if you find an error, edit the source file (likely index.js), and re-run
|
package/dist/es/index.js
CHANGED
|
@@ -22,7 +22,6 @@ import rectangleGrid from "@turf/rectangle-grid";
|
|
|
22
22
|
* //addToMap
|
|
23
23
|
* var addToMap = [squareGrid]
|
|
24
24
|
*/
|
|
25
|
-
export default function squareGrid(bbox, cellSide, options) {
|
|
26
|
-
if (options === void 0) { options = {}; }
|
|
25
|
+
export default function squareGrid(bbox, cellSide, options = {}) {
|
|
27
26
|
return rectangleGrid(bbox, cellSide, cellSide, options);
|
|
28
27
|
}
|
package/dist/js/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { FeatureCollection, Polygon, BBox,
|
|
1
|
+
import { FeatureCollection, Polygon, BBox, Feature, MultiPolygon, GeoJsonProperties } from "geojson";
|
|
2
|
+
import { Units } from "@turf/helpers";
|
|
2
3
|
/**
|
|
3
4
|
* Creates a square grid from a bounding box.
|
|
4
5
|
*
|
|
@@ -22,7 +23,7 @@ import { FeatureCollection, Polygon, BBox, Units, Feature, MultiPolygon, Propert
|
|
|
22
23
|
* //addToMap
|
|
23
24
|
* var addToMap = [squareGrid]
|
|
24
25
|
*/
|
|
25
|
-
export default function squareGrid<P =
|
|
26
|
+
export default function squareGrid<P = GeoJsonProperties>(bbox: BBox, cellSide: number, options?: {
|
|
26
27
|
units?: Units;
|
|
27
28
|
properties?: P;
|
|
28
29
|
mask?: Feature<Polygon | MultiPolygon> | Polygon | MultiPolygon;
|
package/dist/js/index.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const rectangle_grid_1 = tslib_1.__importDefault(require("@turf/rectangle-grid"));
|
|
7
5
|
/**
|
|
8
6
|
* Creates a square grid from a bounding box.
|
|
9
7
|
*
|
|
@@ -27,8 +25,7 @@ var rectangle_grid_1 = __importDefault(require("@turf/rectangle-grid"));
|
|
|
27
25
|
* //addToMap
|
|
28
26
|
* var addToMap = [squareGrid]
|
|
29
27
|
*/
|
|
30
|
-
function squareGrid(bbox, cellSide, options) {
|
|
31
|
-
if (options === void 0) { options = {}; }
|
|
28
|
+
function squareGrid(bbox, cellSide, options = {}) {
|
|
32
29
|
return rectangle_grid_1.default(bbox, cellSide, cellSide, options);
|
|
33
30
|
}
|
|
34
31
|
exports.default = squareGrid;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@turf/square-grid",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0-alpha.0",
|
|
4
4
|
"description": "turf square-grid module",
|
|
5
5
|
"author": "Turf Authors",
|
|
6
6
|
"license": "MIT",
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"type": "git",
|
|
13
13
|
"url": "git://github.com/Turfjs/turf.git"
|
|
14
14
|
},
|
|
15
|
+
"funding": "https://opencollective.com/turf",
|
|
15
16
|
"publishConfig": {
|
|
16
17
|
"access": "public"
|
|
17
18
|
},
|
|
@@ -46,8 +47,8 @@
|
|
|
46
47
|
"test:tape": "ts-node -r esm test.js"
|
|
47
48
|
},
|
|
48
49
|
"devDependencies": {
|
|
49
|
-
"@turf/bbox-polygon": "^
|
|
50
|
-
"@turf/truncate": "^
|
|
50
|
+
"@turf/bbox-polygon": "^7.0.0-alpha.0",
|
|
51
|
+
"@turf/truncate": "^7.0.0-alpha.0",
|
|
51
52
|
"@types/tape": "*",
|
|
52
53
|
"benchmark": "*",
|
|
53
54
|
"npm-run-all": "*",
|
|
@@ -58,8 +59,9 @@
|
|
|
58
59
|
"write-json-file": "*"
|
|
59
60
|
},
|
|
60
61
|
"dependencies": {
|
|
61
|
-
"@turf/helpers": "^
|
|
62
|
-
"@turf/rectangle-grid": "^
|
|
62
|
+
"@turf/helpers": "^7.0.0-alpha.0",
|
|
63
|
+
"@turf/rectangle-grid": "^7.0.0-alpha.0",
|
|
64
|
+
"tslib": "^2.3.0"
|
|
63
65
|
},
|
|
64
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "0edc4c491b999e5ace770a61e1cf549f7c004189"
|
|
65
67
|
}
|