@turf/square-grid 7.0.0 → 7.1.0-alpha.70
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 +10 -8
- package/dist/cjs/index.cjs +1 -5
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +8 -6
- package/dist/esm/index.d.ts +8 -6
- package/dist/esm/index.js +0 -4
- package/dist/esm/index.js.map +1 -1
- package/package.json +7 -6
package/README.md
CHANGED
|
@@ -4,16 +4,18 @@
|
|
|
4
4
|
|
|
5
5
|
## squareGrid
|
|
6
6
|
|
|
7
|
-
Creates a square
|
|
7
|
+
Creates a grid of square polygons with cell length consistent in degrees
|
|
8
8
|
|
|
9
9
|
### Parameters
|
|
10
10
|
|
|
11
|
-
* `bbox` **[
|
|
12
|
-
* `cellSide` **[number][2]** of each cell
|
|
11
|
+
* `bbox` **[BBox][1]** extent of grid in \[minX, minY, maxX, maxY] order. If the grid does not fill the bbox perfectly, it is centered.
|
|
12
|
+
* `cellSide` **[number][2]** length of each cell side.
|
|
13
13
|
* `options` **[Object][3]** Optional parameters (optional, default `{}`)
|
|
14
14
|
|
|
15
|
-
* `options.units` **
|
|
16
|
-
|
|
15
|
+
* `options.units` **Units** the units of the cellSide value.
|
|
16
|
+
Supports all valid Turf [Units][4].
|
|
17
|
+
If you are looking for squares with sides of equal lengths in linear units (e.g. kilometers) this is not the module for you.
|
|
18
|
+
The cellSide is converted from units provided to degrees internally, so the width and height of resulting polygons will be consistent only in degrees. (optional, default `'kilometers'`)
|
|
17
19
|
* `options.mask` **[Feature][5]<([Polygon][6] | [MultiPolygon][7])>?** if passed a Polygon or MultiPolygon,
|
|
18
20
|
the grid Points will be created only inside it
|
|
19
21
|
* `options.properties` **[Object][3]** passed to each point of the grid (optional, default `{}`)
|
|
@@ -31,15 +33,15 @@ var squareGrid = turf.squareGrid(bbox, cellSide, options);
|
|
|
31
33
|
var addToMap = [squareGrid]
|
|
32
34
|
```
|
|
33
35
|
|
|
34
|
-
Returns **[FeatureCollection][8]<[Polygon][6]>**
|
|
36
|
+
Returns **[FeatureCollection][8]<[Polygon][6]>** a grid of polygons with equal width and height in degrees.
|
|
35
37
|
|
|
36
|
-
[1]: https://
|
|
38
|
+
[1]: https://tools.ietf.org/html/rfc7946#section-5
|
|
37
39
|
|
|
38
40
|
[2]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
|
|
39
41
|
|
|
40
42
|
[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
|
|
41
43
|
|
|
42
|
-
[4]: https://
|
|
44
|
+
[4]: https://github.com/Turfjs/turf/blob/master/packages/turf-helpers/README_UNITS.md
|
|
43
45
|
|
|
44
46
|
[5]: https://tools.ietf.org/html/rfc7946#section-3.2
|
|
45
47
|
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true})
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
|
|
4
|
-
// index.ts
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// index.ts
|
|
5
2
|
var _rectanglegrid = require('@turf/rectangle-grid');
|
|
6
3
|
function squareGrid(bbox, cellSide, options = {}) {
|
|
7
4
|
return _rectanglegrid.rectangleGrid.call(void 0, bbox, cellSide, cellSide, options);
|
|
8
5
|
}
|
|
9
|
-
__name(squareGrid, "squareGrid");
|
|
10
6
|
var turf_square_grid_default = squareGrid;
|
|
11
7
|
|
|
12
8
|
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../index.ts"],"names":[],"mappings":";AASA,SAAS,qBAAqB;AA4B9B,SAAS,WACP,MACA,UACA,UAII,CAAC,GAC0B;AAC/B,SAAO,cAAc,MAAM,UAAU,UAAU,OAAO;AACxD;AAGA,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 grid of square polygons with cell length consistent in degrees\n *\n * @name squareGrid\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} cellSide length of each cell side.\n * @param {Object} [options={}] Optional parameters\n * @param {Units} [options.units='kilometers'] the units of the cellSide 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 squares with sides of equal lengths in linear units (e.g. kilometers) this is not the module for you.\n * The cellSide 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 with equal width and height in degrees.\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"]}
|
package/dist/cjs/index.d.cts
CHANGED
|
@@ -2,18 +2,20 @@ import { GeoJsonProperties, BBox, Feature, Polygon, MultiPolygon, FeatureCollect
|
|
|
2
2
|
import { Units } from '@turf/helpers';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Creates a square
|
|
5
|
+
* Creates a grid of square polygons with cell length consistent in degrees
|
|
6
6
|
*
|
|
7
7
|
* @name squareGrid
|
|
8
|
-
* @param {
|
|
9
|
-
* @param {number} cellSide of each cell
|
|
8
|
+
* @param {BBox} bbox extent of grid in [minX, minY, maxX, maxY] order. If the grid does not fill the bbox perfectly, it is centered.
|
|
9
|
+
* @param {number} cellSide length of each cell side.
|
|
10
10
|
* @param {Object} [options={}] Optional parameters
|
|
11
|
-
* @param {
|
|
12
|
-
*
|
|
11
|
+
* @param {Units} [options.units='kilometers'] the units of the cellSide value.
|
|
12
|
+
* Supports all valid Turf {@link https://github.com/Turfjs/turf/blob/master/packages/turf-helpers/README_UNITS.md Units}.
|
|
13
|
+
* If you are looking for squares with sides of equal lengths in linear units (e.g. kilometers) this is not the module for you.
|
|
14
|
+
* The cellSide is converted from units provided to degrees internally, so the width and height of resulting polygons will be consistent only in degrees.
|
|
13
15
|
* @param {Feature<Polygon|MultiPolygon>} [options.mask] if passed a Polygon or MultiPolygon,
|
|
14
16
|
* the grid Points will be created only inside it
|
|
15
17
|
* @param {Object} [options.properties={}] passed to each point of the grid
|
|
16
|
-
* @returns {FeatureCollection<Polygon>}
|
|
18
|
+
* @returns {FeatureCollection<Polygon>} a grid of polygons with equal width and height in degrees.
|
|
17
19
|
* @example
|
|
18
20
|
* var bbox = [-95, 30 ,-85, 40];
|
|
19
21
|
* var cellSide = 50;
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -2,18 +2,20 @@ import { GeoJsonProperties, BBox, Feature, Polygon, MultiPolygon, FeatureCollect
|
|
|
2
2
|
import { Units } from '@turf/helpers';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Creates a square
|
|
5
|
+
* Creates a grid of square polygons with cell length consistent in degrees
|
|
6
6
|
*
|
|
7
7
|
* @name squareGrid
|
|
8
|
-
* @param {
|
|
9
|
-
* @param {number} cellSide of each cell
|
|
8
|
+
* @param {BBox} bbox extent of grid in [minX, minY, maxX, maxY] order. If the grid does not fill the bbox perfectly, it is centered.
|
|
9
|
+
* @param {number} cellSide length of each cell side.
|
|
10
10
|
* @param {Object} [options={}] Optional parameters
|
|
11
|
-
* @param {
|
|
12
|
-
*
|
|
11
|
+
* @param {Units} [options.units='kilometers'] the units of the cellSide value.
|
|
12
|
+
* Supports all valid Turf {@link https://github.com/Turfjs/turf/blob/master/packages/turf-helpers/README_UNITS.md Units}.
|
|
13
|
+
* If you are looking for squares with sides of equal lengths in linear units (e.g. kilometers) this is not the module for you.
|
|
14
|
+
* The cellSide is converted from units provided to degrees internally, so the width and height of resulting polygons will be consistent only in degrees.
|
|
13
15
|
* @param {Feature<Polygon|MultiPolygon>} [options.mask] if passed a Polygon or MultiPolygon,
|
|
14
16
|
* the grid Points will be created only inside it
|
|
15
17
|
* @param {Object} [options.properties={}] passed to each point of the grid
|
|
16
|
-
* @returns {FeatureCollection<Polygon>}
|
|
18
|
+
* @returns {FeatureCollection<Polygon>} a grid of polygons with equal width and height in degrees.
|
|
17
19
|
* @example
|
|
18
20
|
* var bbox = [-95, 30 ,-85, 40];
|
|
19
21
|
* var cellSide = 50;
|
package/dist/esm/index.js
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
|
|
4
1
|
// index.ts
|
|
5
2
|
import { rectangleGrid } from "@turf/rectangle-grid";
|
|
6
3
|
function squareGrid(bbox, cellSide, options = {}) {
|
|
7
4
|
return rectangleGrid(bbox, cellSide, cellSide, options);
|
|
8
5
|
}
|
|
9
|
-
__name(squareGrid, "squareGrid");
|
|
10
6
|
var turf_square_grid_default = squareGrid;
|
|
11
7
|
export {
|
|
12
8
|
turf_square_grid_default as default,
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +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
|
|
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 grid of square polygons with cell length consistent in degrees\n *\n * @name squareGrid\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} cellSide length of each cell side.\n * @param {Object} [options={}] Optional parameters\n * @param {Units} [options.units='kilometers'] the units of the cellSide 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 squares with sides of equal lengths in linear units (e.g. kilometers) this is not the module for you.\n * The cellSide 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 with equal width and height in degrees.\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;AA4B9B,SAAS,WACP,MACA,UACA,UAII,CAAC,GAC0B;AAC/B,SAAO,cAAc,MAAM,UAAU,UAAU,OAAO;AACxD;AAGA,IAAO,2BAAQ;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@turf/square-grid",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.1.0-alpha.70+948cdafaf",
|
|
4
4
|
"description": "turf square-grid module",
|
|
5
5
|
"author": "Turf Authors",
|
|
6
6
|
"license": "MIT",
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
"test:tape": "tsx test.ts"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@turf/bbox-polygon": "^7.0.
|
|
56
|
-
"@turf/truncate": "^7.0.
|
|
55
|
+
"@turf/bbox-polygon": "^7.1.0-alpha.70+948cdafaf",
|
|
56
|
+
"@turf/truncate": "^7.1.0-alpha.70+948cdafaf",
|
|
57
57
|
"@types/benchmark": "^2.1.5",
|
|
58
58
|
"@types/tape": "^4.2.32",
|
|
59
59
|
"benchmark": "^2.1.4",
|
|
@@ -65,9 +65,10 @@
|
|
|
65
65
|
"write-json-file": "^5.0.0"
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@turf/helpers": "^7.0.
|
|
69
|
-
"@turf/rectangle-grid": "^7.0.
|
|
68
|
+
"@turf/helpers": "^7.1.0-alpha.70+948cdafaf",
|
|
69
|
+
"@turf/rectangle-grid": "^7.1.0-alpha.70+948cdafaf",
|
|
70
|
+
"@types/geojson": "^7946.0.10",
|
|
70
71
|
"tslib": "^2.6.2"
|
|
71
72
|
},
|
|
72
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "948cdafaf70606d2e27fcc79973fa48ee1182067"
|
|
73
74
|
}
|