@turf/bbox-polygon 7.1.0 → 7.2.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 +6 -6
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +2 -2
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js.map +1 -1
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -11,8 +11,8 @@ Takes a bbox and returns an equivalent [polygon][1].
|
|
|
11
11
|
* `bbox` **[BBox][2]** extent in \[minX, minY, maxX, maxY] order
|
|
12
12
|
* `options` **[Object][3]** Optional parameters (optional, default `{}`)
|
|
13
13
|
|
|
14
|
-
* `options.properties` **
|
|
15
|
-
* `options.id` **([string][
|
|
14
|
+
* `options.properties` **[GeoJsonProperties][4]** Translate properties to Polygon (optional, default `{}`)
|
|
15
|
+
* `options.id` **([string][5] | [number][6])** Translate Id to Polygon (optional, default `{}`)
|
|
16
16
|
|
|
17
17
|
### Examples
|
|
18
18
|
|
|
@@ -25,7 +25,7 @@ var poly = turf.bboxPolygon(bbox);
|
|
|
25
25
|
var addToMap = [poly]
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
-
Returns **[Feature][
|
|
28
|
+
Returns **[Feature][4]<[Polygon][1]>** a Polygon representation of the bounding box
|
|
29
29
|
|
|
30
30
|
[1]: https://tools.ietf.org/html/rfc7946#section-3.1.6
|
|
31
31
|
|
|
@@ -33,11 +33,11 @@ Returns **[Feature][6]<[Polygon][1]>** a Polygon representation of the bounding
|
|
|
33
33
|
|
|
34
34
|
[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
|
|
35
35
|
|
|
36
|
-
[4]: https://
|
|
36
|
+
[4]: https://tools.ietf.org/html/rfc7946#section-3.2
|
|
37
37
|
|
|
38
|
-
[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/
|
|
38
|
+
[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
|
|
39
39
|
|
|
40
|
-
[6]: https://
|
|
40
|
+
[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
|
|
41
41
|
|
|
42
42
|
<!-- 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. -->
|
|
43
43
|
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../index.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/turf/turf/packages/turf-bbox-polygon/dist/cjs/index.cjs","../../index.ts"],"names":[],"mappings":"AAAA;ACCA,wCAA4B;AAmB5B,SAAS,WAAA,CACP,IAAA,EACA,QAAA,EAGI,CAAC,CAAA,EACgB;AAIrB,EAAA,MAAM,KAAA,EAAO,MAAA,CAAO,IAAA,CAAK,CAAC,CAAC,CAAA;AAC3B,EAAA,MAAM,MAAA,EAAQ,MAAA,CAAO,IAAA,CAAK,CAAC,CAAC,CAAA;AAC5B,EAAA,MAAM,KAAA,EAAO,MAAA,CAAO,IAAA,CAAK,CAAC,CAAC,CAAA;AAC3B,EAAA,MAAM,MAAA,EAAQ,MAAA,CAAO,IAAA,CAAK,CAAC,CAAC,CAAA;AAE5B,EAAA,GAAA,CAAI,IAAA,CAAK,OAAA,IAAW,CAAA,EAAG;AACrB,IAAA,MAAM,IAAI,KAAA;AAAA,MACR;AAAA,IACF,CAAA;AAAA,EACF;AAEA,EAAA,MAAM,QAAA,EAAU,CAAC,IAAA,EAAM,KAAK,CAAA;AAC5B,EAAA,MAAM,QAAA,EAAU,CAAC,IAAA,EAAM,KAAK,CAAA;AAC5B,EAAA,MAAM,SAAA,EAAW,CAAC,IAAA,EAAM,KAAK,CAAA;AAC7B,EAAA,MAAM,SAAA,EAAW,CAAC,IAAA,EAAM,KAAK,CAAA;AAE7B,EAAA,OAAO,8BAAA;AAAA,IACL,CAAC,CAAC,OAAA,EAAS,QAAA,EAAU,QAAA,EAAU,OAAA,EAAS,OAAO,CAAC,CAAA;AAAA,IAChD,OAAA,CAAQ,UAAA;AAAA,IACR,EAAE,IAAA,EAAM,EAAA,EAAI,OAAA,CAAQ,GAAG;AAAA,EACzB,CAAA;AACF;AAGA,IAAO,0BAAA,EAAQ,WAAA;AD/Bf;AACE;AACA;AACF,+EAAC","file":"/home/runner/work/turf/turf/packages/turf-bbox-polygon/dist/cjs/index.cjs","sourcesContent":[null,"import { BBox, Feature, Polygon, GeoJsonProperties } from \"geojson\";\nimport { polygon, Id } from \"@turf/helpers\";\n\n/**\n * Takes a bbox and returns an equivalent {@link Polygon|polygon}.\n *\n * @function\n * @param {BBox} bbox extent in [minX, minY, maxX, maxY] order\n * @param {Object} [options={}] Optional parameters\n * @param {GeoJsonProperties} [options.properties={}] Translate properties to Polygon\n * @param {string|number} [options.id={}] Translate Id to Polygon\n * @returns {Feature<Polygon>} a Polygon representation of the bounding box\n * @example\n * var bbox = [0, 0, 10, 10];\n *\n * var poly = turf.bboxPolygon(bbox);\n *\n * //addToMap\n * var addToMap = [poly]\n */\nfunction bboxPolygon<P extends GeoJsonProperties = GeoJsonProperties>(\n bbox: BBox,\n options: {\n properties?: P;\n id?: Id;\n } = {}\n): Feature<Polygon, P> {\n // Convert BBox positions to Numbers\n // No performance loss for including Number()\n // https://github.com/Turfjs/turf/issues/1119\n const west = Number(bbox[0]);\n const south = Number(bbox[1]);\n const east = Number(bbox[2]);\n const north = Number(bbox[3]);\n\n if (bbox.length === 6) {\n throw new Error(\n \"@turf/bbox-polygon does not support BBox with 6 positions\"\n );\n }\n\n const lowLeft = [west, south];\n const topLeft = [west, north];\n const topRight = [east, north];\n const lowRight = [east, south];\n\n return polygon(\n [[lowLeft, lowRight, topRight, topLeft, lowLeft]],\n options.properties,\n { bbox, id: options.id }\n );\n}\n\nexport { bboxPolygon };\nexport default bboxPolygon;\n"]}
|
package/dist/cjs/index.d.cts
CHANGED
|
@@ -4,10 +4,10 @@ import { Id } from '@turf/helpers';
|
|
|
4
4
|
/**
|
|
5
5
|
* Takes a bbox and returns an equivalent {@link Polygon|polygon}.
|
|
6
6
|
*
|
|
7
|
-
* @
|
|
7
|
+
* @function
|
|
8
8
|
* @param {BBox} bbox extent in [minX, minY, maxX, maxY] order
|
|
9
9
|
* @param {Object} [options={}] Optional parameters
|
|
10
|
-
* @param {
|
|
10
|
+
* @param {GeoJsonProperties} [options.properties={}] Translate properties to Polygon
|
|
11
11
|
* @param {string|number} [options.id={}] Translate Id to Polygon
|
|
12
12
|
* @returns {Feature<Polygon>} a Polygon representation of the bounding box
|
|
13
13
|
* @example
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -4,10 +4,10 @@ import { Id } from '@turf/helpers';
|
|
|
4
4
|
/**
|
|
5
5
|
* Takes a bbox and returns an equivalent {@link Polygon|polygon}.
|
|
6
6
|
*
|
|
7
|
-
* @
|
|
7
|
+
* @function
|
|
8
8
|
* @param {BBox} bbox extent in [minX, minY, maxX, maxY] order
|
|
9
9
|
* @param {Object} [options={}] Optional parameters
|
|
10
|
-
* @param {
|
|
10
|
+
* @param {GeoJsonProperties} [options.properties={}] Translate properties to Polygon
|
|
11
11
|
* @param {string|number} [options.id={}] Translate Id to Polygon
|
|
12
12
|
* @returns {Feature<Polygon>} a Polygon representation of the bounding box
|
|
13
13
|
* @example
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../index.ts"],"sourcesContent":["import { BBox, Feature, Polygon, GeoJsonProperties } from \"geojson\";\nimport { polygon, Id } from \"@turf/helpers\";\n\n/**\n * Takes a bbox and returns an equivalent {@link Polygon|polygon}.\n *\n * @
|
|
1
|
+
{"version":3,"sources":["../../index.ts"],"sourcesContent":["import { BBox, Feature, Polygon, GeoJsonProperties } from \"geojson\";\nimport { polygon, Id } from \"@turf/helpers\";\n\n/**\n * Takes a bbox and returns an equivalent {@link Polygon|polygon}.\n *\n * @function\n * @param {BBox} bbox extent in [minX, minY, maxX, maxY] order\n * @param {Object} [options={}] Optional parameters\n * @param {GeoJsonProperties} [options.properties={}] Translate properties to Polygon\n * @param {string|number} [options.id={}] Translate Id to Polygon\n * @returns {Feature<Polygon>} a Polygon representation of the bounding box\n * @example\n * var bbox = [0, 0, 10, 10];\n *\n * var poly = turf.bboxPolygon(bbox);\n *\n * //addToMap\n * var addToMap = [poly]\n */\nfunction bboxPolygon<P extends GeoJsonProperties = GeoJsonProperties>(\n bbox: BBox,\n options: {\n properties?: P;\n id?: Id;\n } = {}\n): Feature<Polygon, P> {\n // Convert BBox positions to Numbers\n // No performance loss for including Number()\n // https://github.com/Turfjs/turf/issues/1119\n const west = Number(bbox[0]);\n const south = Number(bbox[1]);\n const east = Number(bbox[2]);\n const north = Number(bbox[3]);\n\n if (bbox.length === 6) {\n throw new Error(\n \"@turf/bbox-polygon does not support BBox with 6 positions\"\n );\n }\n\n const lowLeft = [west, south];\n const topLeft = [west, north];\n const topRight = [east, north];\n const lowRight = [east, south];\n\n return polygon(\n [[lowLeft, lowRight, topRight, topLeft, lowLeft]],\n options.properties,\n { bbox, id: options.id }\n );\n}\n\nexport { bboxPolygon };\nexport default bboxPolygon;\n"],"mappings":";AACA,SAAS,eAAmB;AAmB5B,SAAS,YACP,MACA,UAGI,CAAC,GACgB;AAIrB,QAAM,OAAO,OAAO,KAAK,CAAC,CAAC;AAC3B,QAAM,QAAQ,OAAO,KAAK,CAAC,CAAC;AAC5B,QAAM,OAAO,OAAO,KAAK,CAAC,CAAC;AAC3B,QAAM,QAAQ,OAAO,KAAK,CAAC,CAAC;AAE5B,MAAI,KAAK,WAAW,GAAG;AACrB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,QAAM,UAAU,CAAC,MAAM,KAAK;AAC5B,QAAM,UAAU,CAAC,MAAM,KAAK;AAC5B,QAAM,WAAW,CAAC,MAAM,KAAK;AAC7B,QAAM,WAAW,CAAC,MAAM,KAAK;AAE7B,SAAO;AAAA,IACL,CAAC,CAAC,SAAS,UAAU,UAAU,SAAS,OAAO,CAAC;AAAA,IAChD,QAAQ;AAAA,IACR,EAAE,MAAM,IAAI,QAAQ,GAAG;AAAA,EACzB;AACF;AAGA,IAAO,4BAAQ;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@turf/bbox-polygon",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.2.0",
|
|
4
4
|
"description": "turf bbox-polygon module",
|
|
5
5
|
"author": "Turf Authors",
|
|
6
6
|
"license": "MIT",
|
|
@@ -53,18 +53,18 @@
|
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@types/benchmark": "^2.1.5",
|
|
56
|
-
"@types/tape": "^4.
|
|
56
|
+
"@types/tape": "^4.13.4",
|
|
57
57
|
"benchmark": "^2.1.4",
|
|
58
58
|
"npm-run-all": "^4.1.5",
|
|
59
|
-
"tape": "^5.
|
|
60
|
-
"tsup": "^8.
|
|
61
|
-
"tsx": "^4.
|
|
62
|
-
"typescript": "^5.
|
|
59
|
+
"tape": "^5.9.0",
|
|
60
|
+
"tsup": "^8.3.5",
|
|
61
|
+
"tsx": "^4.19.2",
|
|
62
|
+
"typescript": "^5.5.4"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@turf/helpers": "^7.
|
|
65
|
+
"@turf/helpers": "^7.2.0",
|
|
66
66
|
"@types/geojson": "^7946.0.10",
|
|
67
|
-
"tslib": "^2.
|
|
67
|
+
"tslib": "^2.8.1"
|
|
68
68
|
},
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "7b0f0374c4668cd569f8904c71e2ae7d941be867"
|
|
70
70
|
}
|