@turf/mask 6.5.0 → 7.0.0-alpha.1
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 +12 -25
- package/dist/es/index.js +0 -0
- package/dist/js/index.js +0 -0
- package/index.d.ts +1 -6
- package/package.json +9 -7
package/README.md
CHANGED
|
@@ -6,46 +6,33 @@
|
|
|
6
6
|
|
|
7
7
|
Takes any type of [polygon][1] and an optional mask and returns a [polygon][1] exterior ring with holes.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
### Parameters
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
* `polygon` **([FeatureCollection][2] | [Feature][3]<([Polygon][4] | [MultiPolygon][5])>)** GeoJSON Polygon used as interior rings or holes.
|
|
12
|
+
* `mask` **[Feature][3]<[Polygon][4]>?** GeoJSON Polygon used as the exterior ring (if undefined, the world extent is used)
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
### Examples
|
|
15
15
|
|
|
16
16
|
```javascript
|
|
17
|
-
var polygon = turf.polygon([
|
|
18
|
-
|
|
19
|
-
[112, -21],
|
|
20
|
-
[116, -36],
|
|
21
|
-
[146, -39],
|
|
22
|
-
[153, -24],
|
|
23
|
-
[133, -10],
|
|
24
|
-
[112, -21],
|
|
25
|
-
],
|
|
26
|
-
]);
|
|
27
|
-
var mask = turf.polygon([
|
|
28
|
-
[
|
|
29
|
-
[90, -55],
|
|
30
|
-
[170, -55],
|
|
31
|
-
[170, 10],
|
|
32
|
-
[90, 10],
|
|
33
|
-
[90, -55],
|
|
34
|
-
],
|
|
35
|
-
]);
|
|
17
|
+
var polygon = turf.polygon([[[112, -21], [116, -36], [146, -39], [153, -24], [133, -10], [112, -21]]]);
|
|
18
|
+
var mask = turf.polygon([[[90, -55], [170, -55], [170, 10], [90, 10], [90, -55]]]);
|
|
36
19
|
|
|
37
20
|
var masked = turf.mask(polygon, mask);
|
|
38
21
|
|
|
39
22
|
//addToMap
|
|
40
|
-
var addToMap = [masked]
|
|
23
|
+
var addToMap = [masked]
|
|
41
24
|
```
|
|
42
25
|
|
|
43
|
-
Returns **[Feature][3]
|
|
26
|
+
Returns **[Feature][3]<[Polygon][4]>** Masked Polygon (exterior ring with holes).
|
|
44
27
|
|
|
45
28
|
[1]: https://tools.ietf.org/html/rfc7946#section-3.1.6
|
|
29
|
+
|
|
46
30
|
[2]: https://tools.ietf.org/html/rfc7946#section-3.3
|
|
31
|
+
|
|
47
32
|
[3]: https://tools.ietf.org/html/rfc7946#section-3.2
|
|
33
|
+
|
|
48
34
|
[4]: https://tools.ietf.org/html/rfc7946#section-3.1.6
|
|
35
|
+
|
|
49
36
|
[5]: https://tools.ietf.org/html/rfc7946#section-3.1.7
|
|
50
37
|
|
|
51
38
|
<!-- This file is automatically generated. Please don't edit it directly:
|
package/dist/es/index.js
CHANGED
|
File without changes
|
package/dist/js/index.js
CHANGED
|
File without changes
|
package/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@turf/mask",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0-alpha.1",
|
|
4
4
|
"description": "turf mask module",
|
|
5
5
|
"author": "Turf Authors",
|
|
6
6
|
"license": "MIT",
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"exports": {
|
|
27
27
|
"./package.json": "./package.json",
|
|
28
28
|
".": {
|
|
29
|
+
"types": "./index.d.ts",
|
|
29
30
|
"import": "./dist/es/index.js",
|
|
30
31
|
"require": "./dist/js/index.js"
|
|
31
32
|
}
|
|
@@ -37,12 +38,12 @@
|
|
|
37
38
|
"index.d.ts"
|
|
38
39
|
],
|
|
39
40
|
"scripts": {
|
|
40
|
-
"bench": "
|
|
41
|
+
"bench": "tsx bench.js",
|
|
41
42
|
"build": "rollup -c ../../rollup.config.js && echo '{\"type\":\"module\"}' > dist/es/package.json",
|
|
42
|
-
"docs": "
|
|
43
|
+
"docs": "tsx ../../scripts/generate-readmes",
|
|
43
44
|
"test": "npm-run-all test:*",
|
|
44
|
-
"test:tape": "
|
|
45
|
-
"test:types": "tsc --esModuleInterop --noEmit types.ts"
|
|
45
|
+
"test:tape": "tsx test.js",
|
|
46
|
+
"test:types": "tsc --esModuleInterop --noEmit --strict types.ts"
|
|
46
47
|
},
|
|
47
48
|
"devDependencies": {
|
|
48
49
|
"benchmark": "*",
|
|
@@ -51,11 +52,12 @@
|
|
|
51
52
|
"npm-run-all": "*",
|
|
52
53
|
"rollup": "*",
|
|
53
54
|
"tape": "*",
|
|
55
|
+
"tsx": "*",
|
|
54
56
|
"write-json-file": "*"
|
|
55
57
|
},
|
|
56
58
|
"dependencies": {
|
|
57
|
-
"@turf/helpers": "^
|
|
59
|
+
"@turf/helpers": "^7.0.0-alpha.1",
|
|
58
60
|
"polygon-clipping": "^0.15.3"
|
|
59
61
|
},
|
|
60
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "cf7a0c507b017ca066acffd0ce23bda5b393fb5a"
|
|
61
63
|
}
|