@tmlmobilidade/ui 20250628.1802.3 → 20250628.2017.41
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/dist/node_modules/@turf/bbox/dist/esm/index.js +27 -0
- package/dist/node_modules/@turf/bbox/dist/esm/index.js.map +1 -0
- package/dist/node_modules/@turf/bbox-polygon/dist/esm/index.js +26 -0
- package/dist/node_modules/@turf/bbox-polygon/dist/esm/index.js.map +1 -0
- package/dist/node_modules/@turf/boolean-disjoint/dist/esm/index.js +141 -0
- package/dist/node_modules/@turf/boolean-disjoint/dist/esm/index.js.map +1 -0
- package/dist/node_modules/@turf/boolean-intersects/dist/esm/index.js +23 -0
- package/dist/node_modules/@turf/boolean-intersects/dist/esm/index.js.map +1 -0
- package/dist/node_modules/@turf/boolean-point-in-polygon/dist/esm/index.js +36 -0
- package/dist/node_modules/@turf/boolean-point-in-polygon/dist/esm/index.js.map +1 -0
- package/dist/node_modules/@turf/combine/dist/esm/index.js +63 -0
- package/dist/node_modules/@turf/combine/dist/esm/index.js.map +1 -0
- package/dist/node_modules/@turf/envelope/dist/esm/index.js +10 -0
- package/dist/node_modules/@turf/envelope/dist/esm/index.js.map +1 -0
- package/dist/node_modules/@turf/helpers/dist/esm/index.js +41 -2
- package/dist/node_modules/@turf/helpers/dist/esm/index.js.map +1 -1
- package/dist/node_modules/@turf/invariant/dist/esm/index.js +27 -0
- package/dist/node_modules/@turf/invariant/dist/esm/index.js.map +1 -0
- package/dist/node_modules/@turf/line-intersect/dist/esm/index.js +44 -0
- package/dist/node_modules/@turf/line-intersect/dist/esm/index.js.map +1 -0
- package/dist/node_modules/@turf/meta/dist/esm/index.js +209 -0
- package/dist/node_modules/@turf/meta/dist/esm/index.js.map +1 -0
- package/dist/node_modules/@turf/polygon-to-line/dist/esm/index.js +43 -0
- package/dist/node_modules/@turf/polygon-to-line/dist/esm/index.js.map +1 -0
- package/dist/node_modules/point-in-polygon-hao/dist/esm/index.js +57 -0
- package/dist/node_modules/point-in-polygon-hao/dist/esm/index.js.map +1 -0
- package/dist/node_modules/point-in-polygon-hao/node_modules/robust-predicates/esm/orient2d.js +183 -0
- package/dist/node_modules/point-in-polygon-hao/node_modules/robust-predicates/esm/orient2d.js.map +1 -0
- package/dist/node_modules/point-in-polygon-hao/node_modules/robust-predicates/esm/util.js +89 -0
- package/dist/node_modules/point-in-polygon-hao/node_modules/robust-predicates/esm/util.js.map +1 -0
- package/dist/node_modules/sweepline-intersections/dist/sweeplineIntersections.esm.js +254 -0
- package/dist/node_modules/sweepline-intersections/dist/sweeplineIntersections.esm.js.map +1 -0
- package/dist/src/contexts/MapOptions.context.js +3 -3
- package/dist/src/contexts/MapOptions.context.js.map +1 -1
- package/dist/src/lib/map.utils.js +5 -3
- package/dist/src/lib/map.utils.js.map +1 -1
- package/package.json +2 -4
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { coordEach } from '../../../meta/dist/esm/index.js';
|
|
2
|
+
|
|
3
|
+
// index.ts
|
|
4
|
+
function bbox(geojson, options = {}) {
|
|
5
|
+
if (geojson.bbox != null && true !== options.recompute) {
|
|
6
|
+
return geojson.bbox;
|
|
7
|
+
}
|
|
8
|
+
const result = [Infinity, Infinity, -Infinity, -Infinity];
|
|
9
|
+
coordEach(geojson, (coord) => {
|
|
10
|
+
if (result[0] > coord[0]) {
|
|
11
|
+
result[0] = coord[0];
|
|
12
|
+
}
|
|
13
|
+
if (result[1] > coord[1]) {
|
|
14
|
+
result[1] = coord[1];
|
|
15
|
+
}
|
|
16
|
+
if (result[2] < coord[0]) {
|
|
17
|
+
result[2] = coord[0];
|
|
18
|
+
}
|
|
19
|
+
if (result[3] < coord[1]) {
|
|
20
|
+
result[3] = coord[1];
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
return result;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { bbox };
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../../../../node_modules/@turf/bbox/dist/esm/index.js"],"sourcesContent":["// index.ts\nimport { coordEach } from \"@turf/meta\";\nfunction bbox(geojson, options = {}) {\n if (geojson.bbox != null && true !== options.recompute) {\n return geojson.bbox;\n }\n const result = [Infinity, Infinity, -Infinity, -Infinity];\n coordEach(geojson, (coord) => {\n if (result[0] > coord[0]) {\n result[0] = coord[0];\n }\n if (result[1] > coord[1]) {\n result[1] = coord[1];\n }\n if (result[2] < coord[0]) {\n result[2] = coord[0];\n }\n if (result[3] < coord[1]) {\n result[3] = coord[1];\n }\n });\n return result;\n}\nvar turf_bbox_default = bbox;\nexport {\n bbox,\n turf_bbox_default as default\n};\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;AAAA;AAEA,SAAS,IAAI,CAAC,OAAO,EAAE,OAAO,GAAG,EAAE,EAAE;AACrC,EAAE,IAAI,OAAO,CAAC,IAAI,IAAI,IAAI,IAAI,IAAI,KAAK,OAAO,CAAC,SAAS,EAAE;AAC1D,IAAI,OAAO,OAAO,CAAC,IAAI;AACvB;AACA,EAAE,MAAM,MAAM,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC;AAC3D,EAAE,SAAS,CAAC,OAAO,EAAE,CAAC,KAAK,KAAK;AAChC,IAAI,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE;AAC9B,MAAM,MAAM,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;AAC1B;AACA,IAAI,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE;AAC9B,MAAM,MAAM,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;AAC1B;AACA,IAAI,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE;AAC9B,MAAM,MAAM,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;AAC1B;AACA,IAAI,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE;AAC9B,MAAM,MAAM,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;AAC1B;AACA,GAAG,CAAC;AACJ,EAAE,OAAO,MAAM;AACf;;;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { polygon } from '../../../helpers/dist/esm/index.js';
|
|
2
|
+
|
|
3
|
+
// index.ts
|
|
4
|
+
function bboxPolygon(bbox, options = {}) {
|
|
5
|
+
const west = Number(bbox[0]);
|
|
6
|
+
const south = Number(bbox[1]);
|
|
7
|
+
const east = Number(bbox[2]);
|
|
8
|
+
const north = Number(bbox[3]);
|
|
9
|
+
if (bbox.length === 6) {
|
|
10
|
+
throw new Error(
|
|
11
|
+
"@turf/bbox-polygon does not support BBox with 6 positions"
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
const lowLeft = [west, south];
|
|
15
|
+
const topLeft = [west, north];
|
|
16
|
+
const topRight = [east, north];
|
|
17
|
+
const lowRight = [east, south];
|
|
18
|
+
return polygon(
|
|
19
|
+
[[lowLeft, lowRight, topRight, topLeft, lowLeft]],
|
|
20
|
+
options.properties,
|
|
21
|
+
{ bbox, id: options.id }
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { bboxPolygon };
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../../../../node_modules/@turf/bbox-polygon/dist/esm/index.js"],"sourcesContent":["// index.ts\nimport { polygon } from \"@turf/helpers\";\nfunction bboxPolygon(bbox, options = {}) {\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 if (bbox.length === 6) {\n throw new Error(\n \"@turf/bbox-polygon does not support BBox with 6 positions\"\n );\n }\n const lowLeft = [west, south];\n const topLeft = [west, north];\n const topRight = [east, north];\n const lowRight = [east, south];\n return polygon(\n [[lowLeft, lowRight, topRight, topLeft, lowLeft]],\n options.properties,\n { bbox, id: options.id }\n );\n}\nvar turf_bbox_polygon_default = bboxPolygon;\nexport {\n bboxPolygon,\n turf_bbox_polygon_default as default\n};\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;AAAA;AAEA,SAAS,WAAW,CAAC,IAAI,EAAE,OAAO,GAAG,EAAE,EAAE;AACzC,EAAE,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAC9B,EAAE,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAC/B,EAAE,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAC9B,EAAE,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAC/B,EAAE,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;AACzB,IAAI,MAAM,IAAI,KAAK;AACnB,MAAM;AACN,KAAK;AACL;AACA,EAAE,MAAM,OAAO,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC;AAC/B,EAAE,MAAM,OAAO,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC;AAC/B,EAAE,MAAM,QAAQ,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC;AAChC,EAAE,MAAM,QAAQ,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC;AAChC,EAAE,OAAO,OAAO;AAChB,IAAI,CAAC,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;AACrD,IAAI,OAAO,CAAC,UAAU;AACtB,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,CAAC,EAAE;AAC1B,GAAG;AACH;;;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { booleanPointInPolygon } from '../../../boolean-point-in-polygon/dist/esm/index.js';
|
|
2
|
+
import { lineIntersect } from '../../../line-intersect/dist/esm/index.js';
|
|
3
|
+
import { flattenEach } from '../../../meta/dist/esm/index.js';
|
|
4
|
+
import { polygonToLine } from '../../../polygon-to-line/dist/esm/index.js';
|
|
5
|
+
|
|
6
|
+
// index.ts
|
|
7
|
+
function booleanDisjoint(feature1, feature2, {
|
|
8
|
+
ignoreSelfIntersections = true
|
|
9
|
+
} = { ignoreSelfIntersections: true }) {
|
|
10
|
+
let bool = true;
|
|
11
|
+
flattenEach(feature1, (flatten1) => {
|
|
12
|
+
flattenEach(feature2, (flatten2) => {
|
|
13
|
+
if (bool === false) {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
bool = disjoint(
|
|
17
|
+
flatten1.geometry,
|
|
18
|
+
flatten2.geometry,
|
|
19
|
+
ignoreSelfIntersections
|
|
20
|
+
);
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
return bool;
|
|
24
|
+
}
|
|
25
|
+
function disjoint(geom1, geom2, ignoreSelfIntersections) {
|
|
26
|
+
switch (geom1.type) {
|
|
27
|
+
case "Point":
|
|
28
|
+
switch (geom2.type) {
|
|
29
|
+
case "Point":
|
|
30
|
+
return !compareCoords(geom1.coordinates, geom2.coordinates);
|
|
31
|
+
case "LineString":
|
|
32
|
+
return !isPointOnLine(geom2, geom1);
|
|
33
|
+
case "Polygon":
|
|
34
|
+
return !booleanPointInPolygon(geom1, geom2);
|
|
35
|
+
}
|
|
36
|
+
break;
|
|
37
|
+
case "LineString":
|
|
38
|
+
switch (geom2.type) {
|
|
39
|
+
case "Point":
|
|
40
|
+
return !isPointOnLine(geom1, geom2);
|
|
41
|
+
case "LineString":
|
|
42
|
+
return !isLineOnLine(geom1, geom2, ignoreSelfIntersections);
|
|
43
|
+
case "Polygon":
|
|
44
|
+
return !isLineInPoly(geom2, geom1, ignoreSelfIntersections);
|
|
45
|
+
}
|
|
46
|
+
break;
|
|
47
|
+
case "Polygon":
|
|
48
|
+
switch (geom2.type) {
|
|
49
|
+
case "Point":
|
|
50
|
+
return !booleanPointInPolygon(geom2, geom1);
|
|
51
|
+
case "LineString":
|
|
52
|
+
return !isLineInPoly(geom1, geom2, ignoreSelfIntersections);
|
|
53
|
+
case "Polygon":
|
|
54
|
+
return !isPolyInPoly(geom2, geom1, ignoreSelfIntersections);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
function isPointOnLine(lineString, pt) {
|
|
60
|
+
for (let i = 0; i < lineString.coordinates.length - 1; i++) {
|
|
61
|
+
if (isPointOnLineSegment(
|
|
62
|
+
lineString.coordinates[i],
|
|
63
|
+
lineString.coordinates[i + 1],
|
|
64
|
+
pt.coordinates
|
|
65
|
+
)) {
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
function isLineOnLine(lineString1, lineString2, ignoreSelfIntersections) {
|
|
72
|
+
const doLinesIntersect = lineIntersect(lineString1, lineString2, {
|
|
73
|
+
ignoreSelfIntersections
|
|
74
|
+
});
|
|
75
|
+
if (doLinesIntersect.features.length > 0) {
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
function isLineInPoly(polygon, lineString, ignoreSelfIntersections) {
|
|
81
|
+
for (const coord of lineString.coordinates) {
|
|
82
|
+
if (booleanPointInPolygon(coord, polygon)) {
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
const doLinesIntersect = lineIntersect(lineString, polygonToLine(polygon), {
|
|
87
|
+
ignoreSelfIntersections
|
|
88
|
+
});
|
|
89
|
+
if (doLinesIntersect.features.length > 0) {
|
|
90
|
+
return true;
|
|
91
|
+
}
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
function isPolyInPoly(feature1, feature2, ignoreSelfIntersections) {
|
|
95
|
+
for (const coord1 of feature1.coordinates[0]) {
|
|
96
|
+
if (booleanPointInPolygon(coord1, feature2)) {
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
for (const coord2 of feature2.coordinates[0]) {
|
|
101
|
+
if (booleanPointInPolygon(coord2, feature1)) {
|
|
102
|
+
return true;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
const doLinesIntersect = lineIntersect(
|
|
106
|
+
polygonToLine(feature1),
|
|
107
|
+
polygonToLine(feature2),
|
|
108
|
+
{ ignoreSelfIntersections }
|
|
109
|
+
);
|
|
110
|
+
if (doLinesIntersect.features.length > 0) {
|
|
111
|
+
return true;
|
|
112
|
+
}
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
function isPointOnLineSegment(lineSegmentStart, lineSegmentEnd, pt) {
|
|
116
|
+
const dxc = pt[0] - lineSegmentStart[0];
|
|
117
|
+
const dyc = pt[1] - lineSegmentStart[1];
|
|
118
|
+
const dxl = lineSegmentEnd[0] - lineSegmentStart[0];
|
|
119
|
+
const dyl = lineSegmentEnd[1] - lineSegmentStart[1];
|
|
120
|
+
const cross = dxc * dyl - dyc * dxl;
|
|
121
|
+
if (cross !== 0) {
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
if (Math.abs(dxl) >= Math.abs(dyl)) {
|
|
125
|
+
if (dxl > 0) {
|
|
126
|
+
return lineSegmentStart[0] <= pt[0] && pt[0] <= lineSegmentEnd[0];
|
|
127
|
+
} else {
|
|
128
|
+
return lineSegmentEnd[0] <= pt[0] && pt[0] <= lineSegmentStart[0];
|
|
129
|
+
}
|
|
130
|
+
} else if (dyl > 0) {
|
|
131
|
+
return lineSegmentStart[1] <= pt[1] && pt[1] <= lineSegmentEnd[1];
|
|
132
|
+
} else {
|
|
133
|
+
return lineSegmentEnd[1] <= pt[1] && pt[1] <= lineSegmentStart[1];
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
function compareCoords(pair1, pair2) {
|
|
137
|
+
return pair1[0] === pair2[0] && pair1[1] === pair2[1];
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export { booleanDisjoint };
|
|
141
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../../../../node_modules/@turf/boolean-disjoint/dist/esm/index.js"],"sourcesContent":["// index.ts\nimport { booleanPointInPolygon } from \"@turf/boolean-point-in-polygon\";\nimport { lineIntersect } from \"@turf/line-intersect\";\nimport { flattenEach } from \"@turf/meta\";\nimport { polygonToLine } from \"@turf/polygon-to-line\";\nfunction booleanDisjoint(feature1, feature2, {\n ignoreSelfIntersections = true\n} = { ignoreSelfIntersections: true }) {\n let bool = true;\n flattenEach(feature1, (flatten1) => {\n flattenEach(feature2, (flatten2) => {\n if (bool === false) {\n return false;\n }\n bool = disjoint(\n flatten1.geometry,\n flatten2.geometry,\n ignoreSelfIntersections\n );\n });\n });\n return bool;\n}\nfunction disjoint(geom1, geom2, ignoreSelfIntersections) {\n switch (geom1.type) {\n case \"Point\":\n switch (geom2.type) {\n case \"Point\":\n return !compareCoords(geom1.coordinates, geom2.coordinates);\n case \"LineString\":\n return !isPointOnLine(geom2, geom1);\n case \"Polygon\":\n return !booleanPointInPolygon(geom1, geom2);\n }\n break;\n case \"LineString\":\n switch (geom2.type) {\n case \"Point\":\n return !isPointOnLine(geom1, geom2);\n case \"LineString\":\n return !isLineOnLine(geom1, geom2, ignoreSelfIntersections);\n case \"Polygon\":\n return !isLineInPoly(geom2, geom1, ignoreSelfIntersections);\n }\n break;\n case \"Polygon\":\n switch (geom2.type) {\n case \"Point\":\n return !booleanPointInPolygon(geom2, geom1);\n case \"LineString\":\n return !isLineInPoly(geom1, geom2, ignoreSelfIntersections);\n case \"Polygon\":\n return !isPolyInPoly(geom2, geom1, ignoreSelfIntersections);\n }\n }\n return false;\n}\nfunction isPointOnLine(lineString, pt) {\n for (let i = 0; i < lineString.coordinates.length - 1; i++) {\n if (isPointOnLineSegment(\n lineString.coordinates[i],\n lineString.coordinates[i + 1],\n pt.coordinates\n )) {\n return true;\n }\n }\n return false;\n}\nfunction isLineOnLine(lineString1, lineString2, ignoreSelfIntersections) {\n const doLinesIntersect = lineIntersect(lineString1, lineString2, {\n ignoreSelfIntersections\n });\n if (doLinesIntersect.features.length > 0) {\n return true;\n }\n return false;\n}\nfunction isLineInPoly(polygon, lineString, ignoreSelfIntersections) {\n for (const coord of lineString.coordinates) {\n if (booleanPointInPolygon(coord, polygon)) {\n return true;\n }\n }\n const doLinesIntersect = lineIntersect(lineString, polygonToLine(polygon), {\n ignoreSelfIntersections\n });\n if (doLinesIntersect.features.length > 0) {\n return true;\n }\n return false;\n}\nfunction isPolyInPoly(feature1, feature2, ignoreSelfIntersections) {\n for (const coord1 of feature1.coordinates[0]) {\n if (booleanPointInPolygon(coord1, feature2)) {\n return true;\n }\n }\n for (const coord2 of feature2.coordinates[0]) {\n if (booleanPointInPolygon(coord2, feature1)) {\n return true;\n }\n }\n const doLinesIntersect = lineIntersect(\n polygonToLine(feature1),\n polygonToLine(feature2),\n { ignoreSelfIntersections }\n );\n if (doLinesIntersect.features.length > 0) {\n return true;\n }\n return false;\n}\nfunction isPointOnLineSegment(lineSegmentStart, lineSegmentEnd, pt) {\n const dxc = pt[0] - lineSegmentStart[0];\n const dyc = pt[1] - lineSegmentStart[1];\n const dxl = lineSegmentEnd[0] - lineSegmentStart[0];\n const dyl = lineSegmentEnd[1] - lineSegmentStart[1];\n const cross = dxc * dyl - dyc * dxl;\n if (cross !== 0) {\n return false;\n }\n if (Math.abs(dxl) >= Math.abs(dyl)) {\n if (dxl > 0) {\n return lineSegmentStart[0] <= pt[0] && pt[0] <= lineSegmentEnd[0];\n } else {\n return lineSegmentEnd[0] <= pt[0] && pt[0] <= lineSegmentStart[0];\n }\n } else if (dyl > 0) {\n return lineSegmentStart[1] <= pt[1] && pt[1] <= lineSegmentEnd[1];\n } else {\n return lineSegmentEnd[1] <= pt[1] && pt[1] <= lineSegmentStart[1];\n }\n}\nfunction compareCoords(pair1, pair2) {\n return pair1[0] === pair2[0] && pair1[1] === pair2[1];\n}\nvar turf_boolean_disjoint_default = booleanDisjoint;\nexport {\n booleanDisjoint,\n turf_boolean_disjoint_default as default\n};\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;;;;AAAA;AAKA,SAAS,eAAe,CAAC,QAAQ,EAAE,QAAQ,EAAE;AAC7C,EAAE,uBAAuB,GAAG;AAC5B,CAAC,GAAG,EAAE,uBAAuB,EAAE,IAAI,EAAE,EAAE;AACvC,EAAE,IAAI,IAAI,GAAG,IAAI;AACjB,EAAE,WAAW,CAAC,QAAQ,EAAE,CAAC,QAAQ,KAAK;AACtC,IAAI,WAAW,CAAC,QAAQ,EAAE,CAAC,QAAQ,KAAK;AACxC,MAAM,IAAI,IAAI,KAAK,KAAK,EAAE;AAC1B,QAAQ,OAAO,KAAK;AACpB;AACA,MAAM,IAAI,GAAG,QAAQ;AACrB,QAAQ,QAAQ,CAAC,QAAQ;AACzB,QAAQ,QAAQ,CAAC,QAAQ;AACzB,QAAQ;AACR,OAAO;AACP,KAAK,CAAC;AACN,GAAG,CAAC;AACJ,EAAE,OAAO,IAAI;AACb;AACA,SAAS,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,uBAAuB,EAAE;AACzD,EAAE,QAAQ,KAAK,CAAC,IAAI;AACpB,IAAI,KAAK,OAAO;AAChB,MAAM,QAAQ,KAAK,CAAC,IAAI;AACxB,QAAQ,KAAK,OAAO;AACpB,UAAU,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,WAAW,CAAC;AACrE,QAAQ,KAAK,YAAY;AACzB,UAAU,OAAO,CAAC,aAAa,CAAC,KAAK,EAAE,KAAK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AAC,CAAC,CAAC;AACvE;AACA,GAAG,MAAM,IAAI,GAAG,GAAG,CAAC,EAAE;AACtB,IAAI,OAAO,gBAAgB,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,cAAc,CAAC,CAAC,CAAC;AACrE,GAAG,MAAM;AACT,IAAI,OAAO,cAAc,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,gBAAgB,CAAC,CAAC,CAAC;AACrE;AACA;AACA,SAAS,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE;AACrC,EAAE,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC;AACvD;;;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { booleanDisjoint } from '../../../boolean-disjoint/dist/esm/index.js';
|
|
2
|
+
import { flattenEach } from '../../../meta/dist/esm/index.js';
|
|
3
|
+
|
|
4
|
+
// index.ts
|
|
5
|
+
function booleanIntersects(feature1, feature2, {
|
|
6
|
+
ignoreSelfIntersections = true
|
|
7
|
+
} = {}) {
|
|
8
|
+
let bool = false;
|
|
9
|
+
flattenEach(feature1, (flatten1) => {
|
|
10
|
+
flattenEach(feature2, (flatten2) => {
|
|
11
|
+
if (bool === true) {
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
bool = !booleanDisjoint(flatten1.geometry, flatten2.geometry, {
|
|
15
|
+
ignoreSelfIntersections
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
return bool;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { booleanIntersects };
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../../../../node_modules/@turf/boolean-intersects/dist/esm/index.js"],"sourcesContent":["// index.ts\nimport { booleanDisjoint } from \"@turf/boolean-disjoint\";\nimport { flattenEach } from \"@turf/meta\";\nfunction booleanIntersects(feature1, feature2, {\n ignoreSelfIntersections = true\n} = {}) {\n let bool = false;\n flattenEach(feature1, (flatten1) => {\n flattenEach(feature2, (flatten2) => {\n if (bool === true) {\n return true;\n }\n bool = !booleanDisjoint(flatten1.geometry, flatten2.geometry, {\n ignoreSelfIntersections\n });\n });\n });\n return bool;\n}\nvar turf_boolean_intersects_default = booleanIntersects;\nexport {\n booleanIntersects,\n turf_boolean_intersects_default as default\n};\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;;AAAA;AAGA,SAAS,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,EAAE;AAC/C,EAAE,uBAAuB,GAAG;AAC5B,CAAC,GAAG,EAAE,EAAE;AACR,EAAE,IAAI,IAAI,GAAG,KAAK;AAClB,EAAE,WAAW,CAAC,QAAQ,EAAE,CAAC,QAAQ,KAAK;AACtC,IAAI,WAAW,CAAC,QAAQ,EAAE,CAAC,QAAQ,KAAK;AACxC,MAAM,IAAI,IAAI,KAAK,IAAI,EAAE;AACzB,QAAQ,OAAO,IAAI;AACnB;AACA,MAAM,IAAI,GAAG,CAAC,eAAe,CAAC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAAE;AACpE,QAAQ;AACR,OAAO,CAAC;AACR,KAAK,CAAC;AACN,GAAG,CAAC;AACJ,EAAE,OAAO,IAAI;AACb;;;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import pointInPolygon from '../../../../point-in-polygon-hao/dist/esm/index.js';
|
|
2
|
+
import { getCoord, getGeom } from '../../../invariant/dist/esm/index.js';
|
|
3
|
+
|
|
4
|
+
// index.ts
|
|
5
|
+
function booleanPointInPolygon(point, polygon, options = {}) {
|
|
6
|
+
if (!point) {
|
|
7
|
+
throw new Error("point is required");
|
|
8
|
+
}
|
|
9
|
+
if (!polygon) {
|
|
10
|
+
throw new Error("polygon is required");
|
|
11
|
+
}
|
|
12
|
+
const pt = getCoord(point);
|
|
13
|
+
const geom = getGeom(polygon);
|
|
14
|
+
const type = geom.type;
|
|
15
|
+
const bbox = polygon.bbox;
|
|
16
|
+
let polys = geom.coordinates;
|
|
17
|
+
if (bbox && inBBox(pt, bbox) === false) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
if (type === "Polygon") {
|
|
21
|
+
polys = [polys];
|
|
22
|
+
}
|
|
23
|
+
let result = false;
|
|
24
|
+
for (var i = 0; i < polys.length; ++i) {
|
|
25
|
+
const polyResult = pointInPolygon(pt, polys[i]);
|
|
26
|
+
if (polyResult === 0) return options.ignoreBoundary ? false : true;
|
|
27
|
+
else if (polyResult) result = true;
|
|
28
|
+
}
|
|
29
|
+
return result;
|
|
30
|
+
}
|
|
31
|
+
function inBBox(pt, bbox) {
|
|
32
|
+
return bbox[0] <= pt[0] && bbox[1] <= pt[1] && bbox[2] >= pt[0] && bbox[3] >= pt[1];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export { booleanPointInPolygon };
|
|
36
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../../../../node_modules/@turf/boolean-point-in-polygon/dist/esm/index.js"],"sourcesContent":["// index.ts\nimport pip from \"point-in-polygon-hao\";\nimport { getCoord, getGeom } from \"@turf/invariant\";\nfunction booleanPointInPolygon(point, polygon, options = {}) {\n if (!point) {\n throw new Error(\"point is required\");\n }\n if (!polygon) {\n throw new Error(\"polygon is required\");\n }\n const pt = getCoord(point);\n const geom = getGeom(polygon);\n const type = geom.type;\n const bbox = polygon.bbox;\n let polys = geom.coordinates;\n if (bbox && inBBox(pt, bbox) === false) {\n return false;\n }\n if (type === \"Polygon\") {\n polys = [polys];\n }\n let result = false;\n for (var i = 0; i < polys.length; ++i) {\n const polyResult = pip(pt, polys[i]);\n if (polyResult === 0) return options.ignoreBoundary ? false : true;\n else if (polyResult) result = true;\n }\n return result;\n}\nfunction inBBox(pt, bbox) {\n return bbox[0] <= pt[0] && bbox[1] <= pt[1] && bbox[2] >= pt[0] && bbox[3] >= pt[1];\n}\nvar turf_boolean_point_in_polygon_default = booleanPointInPolygon;\nexport {\n booleanPointInPolygon,\n turf_boolean_point_in_polygon_default as default\n};\n//# sourceMappingURL=index.js.map"],"names":["pip"],"mappings":";;;AAAA;AAGA,SAAS,qBAAqB,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,EAAE;AAC7D,EAAE,IAAI,CAAC,KAAK,EAAE;AACd,IAAI,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC;AACxC;AACA,EAAE,IAAI,CAAC,OAAO,EAAE;AAChB,IAAI,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC;AAC1C;AACA,EAAE,MAAM,EAAE,GAAG,QAAQ,CAAC,KAAK,CAAC;AAC5B,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC;AAC/B,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI;AACxB,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI;AAC3B,EAAE,IAAI,KAAK,GAAG,IAAI,CAAC,WAAW;AAC9B,EAAE,IAAI,IAAI,IAAI,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC,KAAK,KAAK,EAAE;AAC1C,IAAI,OAAO,KAAK;AAChB;AACA,EAAE,IAAI,IAAI,KAAK,SAAS,EAAE;AAC1B,IAAI,KAAK,GAAG,CAAC,KAAK,CAAC;AACnB;AACA,EAAE,IAAI,MAAM,GAAG,KAAK;AACpB,EAAE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE;AACzC,IAAI,MAAM,UAAU,GAAGA,cAAG,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;AACxC,IAAI,IAAI,UAAU,KAAK,CAAC,EAAE,OAAO,OAAO,CAAC,cAAc,GAAG,KAAK,GAAG,IAAI;AACtE,SAAS,IAAI,UAAU,EAAE,MAAM,GAAG,IAAI;AACtC;AACA,EAAE,OAAO,MAAM;AACf;AACA,SAAS,MAAM,CAAC,EAAE,EAAE,IAAI,EAAE;AAC1B,EAAE,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;AACrF;;;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { featureCollection, feature } from '../../../helpers/dist/esm/index.js';
|
|
2
|
+
import { featureEach } from '../../../meta/dist/esm/index.js';
|
|
3
|
+
|
|
4
|
+
// index.ts
|
|
5
|
+
function combine(fc) {
|
|
6
|
+
var groups = {
|
|
7
|
+
MultiPoint: {
|
|
8
|
+
coordinates: [],
|
|
9
|
+
properties: []
|
|
10
|
+
},
|
|
11
|
+
MultiLineString: {
|
|
12
|
+
coordinates: [],
|
|
13
|
+
properties: []
|
|
14
|
+
},
|
|
15
|
+
MultiPolygon: {
|
|
16
|
+
coordinates: [],
|
|
17
|
+
properties: []
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
featureEach(fc, (feature2) => {
|
|
21
|
+
var _a;
|
|
22
|
+
switch ((_a = feature2.geometry) == null ? void 0 : _a.type) {
|
|
23
|
+
case "Point":
|
|
24
|
+
groups.MultiPoint.coordinates.push(feature2.geometry.coordinates);
|
|
25
|
+
groups.MultiPoint.properties.push(feature2.properties);
|
|
26
|
+
break;
|
|
27
|
+
case "MultiPoint":
|
|
28
|
+
groups.MultiPoint.coordinates.push(...feature2.geometry.coordinates);
|
|
29
|
+
groups.MultiPoint.properties.push(feature2.properties);
|
|
30
|
+
break;
|
|
31
|
+
case "LineString":
|
|
32
|
+
groups.MultiLineString.coordinates.push(feature2.geometry.coordinates);
|
|
33
|
+
groups.MultiLineString.properties.push(feature2.properties);
|
|
34
|
+
break;
|
|
35
|
+
case "MultiLineString":
|
|
36
|
+
groups.MultiLineString.coordinates.push(
|
|
37
|
+
...feature2.geometry.coordinates
|
|
38
|
+
);
|
|
39
|
+
groups.MultiLineString.properties.push(feature2.properties);
|
|
40
|
+
break;
|
|
41
|
+
case "Polygon":
|
|
42
|
+
groups.MultiPolygon.coordinates.push(feature2.geometry.coordinates);
|
|
43
|
+
groups.MultiPolygon.properties.push(feature2.properties);
|
|
44
|
+
break;
|
|
45
|
+
case "MultiPolygon":
|
|
46
|
+
groups.MultiPolygon.coordinates.push(...feature2.geometry.coordinates);
|
|
47
|
+
groups.MultiPolygon.properties.push(feature2.properties);
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
return featureCollection(
|
|
52
|
+
Object.keys(groups).filter(function(key) {
|
|
53
|
+
return groups[key].coordinates.length;
|
|
54
|
+
}).sort().map(function(key) {
|
|
55
|
+
var geometry = { type: key, coordinates: groups[key].coordinates };
|
|
56
|
+
var properties = { collectedProperties: groups[key].properties };
|
|
57
|
+
return feature(geometry, properties);
|
|
58
|
+
})
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export { combine };
|
|
63
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../../../../node_modules/@turf/combine/dist/esm/index.js"],"sourcesContent":["// index.ts\nimport { feature, featureCollection } from \"@turf/helpers\";\nimport { featureEach } from \"@turf/meta\";\nfunction combine(fc) {\n var groups = {\n MultiPoint: {\n coordinates: [],\n properties: []\n },\n MultiLineString: {\n coordinates: [],\n properties: []\n },\n MultiPolygon: {\n coordinates: [],\n properties: []\n }\n };\n featureEach(fc, (feature2) => {\n var _a;\n switch ((_a = feature2.geometry) == null ? void 0 : _a.type) {\n case \"Point\":\n groups.MultiPoint.coordinates.push(feature2.geometry.coordinates);\n groups.MultiPoint.properties.push(feature2.properties);\n break;\n case \"MultiPoint\":\n groups.MultiPoint.coordinates.push(...feature2.geometry.coordinates);\n groups.MultiPoint.properties.push(feature2.properties);\n break;\n case \"LineString\":\n groups.MultiLineString.coordinates.push(feature2.geometry.coordinates);\n groups.MultiLineString.properties.push(feature2.properties);\n break;\n case \"MultiLineString\":\n groups.MultiLineString.coordinates.push(\n ...feature2.geometry.coordinates\n );\n groups.MultiLineString.properties.push(feature2.properties);\n break;\n case \"Polygon\":\n groups.MultiPolygon.coordinates.push(feature2.geometry.coordinates);\n groups.MultiPolygon.properties.push(feature2.properties);\n break;\n case \"MultiPolygon\":\n groups.MultiPolygon.coordinates.push(...feature2.geometry.coordinates);\n groups.MultiPolygon.properties.push(feature2.properties);\n break;\n default:\n break;\n }\n });\n return featureCollection(\n Object.keys(groups).filter(function(key) {\n return groups[key].coordinates.length;\n }).sort().map(function(key) {\n var geometry = { type: key, coordinates: groups[key].coordinates };\n var properties = { collectedProperties: groups[key].properties };\n return feature(geometry, properties);\n })\n );\n}\nvar turf_combine_default = combine;\nexport {\n combine,\n turf_combine_default as default\n};\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;;AAAA;AAGA,SAAS,OAAO,CAAC,EAAE,EAAE;AACrB,EAAE,IAAI,MAAM,GAAG;AACf,IAAI,UAAU,EAAE;AAChB,MAAM,WAAW,EAAE,EAAE;AACrB,MAAM,UAAU,EAAE;AAClB,KAAK;AACL,IAAI,eAAe,EAAE;AACrB,MAAM,WAAW,EAAE,EAAE;AACrB,MAAM,UAAU,EAAE;AAClB,KAAK;AACL,IAAI,YAAY,EAAE;AAClB,MAAM,WAAW,E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,CAAC,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC;AAC3E,QAAQ,MAAM,CAAC,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC;AAChE,QAAQ;AACR,MAAM,KAAK,cAAc;AACzB,QAAQ,MAAM,CAAC,YAAY,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC;AAC9E,QAAQ,MAAM,CAAC,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC;AAChE,QAAQ;AAGR;AACA,GAAG,CAAC;AACJ,EAAE,OAAO,iBAAiB;AAC1B,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,SAAS,GAAG,EAAE;AAC7C,MAAM,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,WAAW,CAAC,MAAM;AAC3C,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,SAAS,GAAG,EAAE;AAChC,MAAM,IAAI,QAAQ,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE;AACxE,MAAM,IAAI,UAAU,GAAG,EAAE,mBAAmB,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE;AACtE,MAAM,OAAO,OAAO,CAAC,QAAQ,EAAE,UAAU,CAAC;AAC1C,KAAK;AACL,GAAG;AACH;;;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { bbox } from '../../../bbox/dist/esm/index.js';
|
|
2
|
+
import { bboxPolygon } from '../../../bbox-polygon/dist/esm/index.js';
|
|
3
|
+
|
|
4
|
+
// index.ts
|
|
5
|
+
function envelope(geojson) {
|
|
6
|
+
return bboxPolygon(bbox(geojson));
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export { envelope };
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../../../../node_modules/@turf/envelope/dist/esm/index.js"],"sourcesContent":["// index.ts\nimport { bbox } from \"@turf/bbox\";\nimport { bboxPolygon } from \"@turf/bbox-polygon\";\nfunction envelope(geojson) {\n return bboxPolygon(bbox(geojson));\n}\nvar turf_envelope_default = envelope;\nexport {\n turf_envelope_default as default,\n envelope\n};\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;;AAAA;AAGA,SAAS,QAAQ,CAAC,OAAO,EAAE;AAC3B,EAAE,OAAO,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AACnC;;;;","x_google_ignoreList":[0]}
|
|
@@ -7,7 +7,7 @@ function feature(geom, properties, options = {}) {
|
|
|
7
7
|
if (options.bbox) {
|
|
8
8
|
feat.bbox = options.bbox;
|
|
9
9
|
}
|
|
10
|
-
feat.properties = {};
|
|
10
|
+
feat.properties = properties || {};
|
|
11
11
|
feat.geometry = geom;
|
|
12
12
|
return feat;
|
|
13
13
|
}
|
|
@@ -30,6 +30,38 @@ function point(coordinates, properties, options = {}) {
|
|
|
30
30
|
};
|
|
31
31
|
return feature(geom, properties, options);
|
|
32
32
|
}
|
|
33
|
+
function polygon(coordinates, properties, options = {}) {
|
|
34
|
+
for (const ring of coordinates) {
|
|
35
|
+
if (ring.length < 4) {
|
|
36
|
+
throw new Error(
|
|
37
|
+
"Each LinearRing of a Polygon must have 4 or more Positions."
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
if (ring[ring.length - 1].length !== ring[0].length) {
|
|
41
|
+
throw new Error("First and last Position are not equivalent.");
|
|
42
|
+
}
|
|
43
|
+
for (let j = 0; j < ring[ring.length - 1].length; j++) {
|
|
44
|
+
if (ring[ring.length - 1][j] !== ring[0][j]) {
|
|
45
|
+
throw new Error("First and last Position are not equivalent.");
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
const geom = {
|
|
50
|
+
type: "Polygon",
|
|
51
|
+
coordinates
|
|
52
|
+
};
|
|
53
|
+
return feature(geom, properties, options);
|
|
54
|
+
}
|
|
55
|
+
function lineString(coordinates, properties, options = {}) {
|
|
56
|
+
if (coordinates.length < 2) {
|
|
57
|
+
throw new Error("coordinates must be an array of two or more positions");
|
|
58
|
+
}
|
|
59
|
+
const geom = {
|
|
60
|
+
type: "LineString",
|
|
61
|
+
coordinates
|
|
62
|
+
};
|
|
63
|
+
return feature(geom, properties, options);
|
|
64
|
+
}
|
|
33
65
|
function featureCollection(features, options = {}) {
|
|
34
66
|
const fc = { type: "FeatureCollection" };
|
|
35
67
|
if (options.id) {
|
|
@@ -41,9 +73,16 @@ function featureCollection(features, options = {}) {
|
|
|
41
73
|
fc.features = features;
|
|
42
74
|
return fc;
|
|
43
75
|
}
|
|
76
|
+
function multiLineString(coordinates, properties, options = {}) {
|
|
77
|
+
const geom = {
|
|
78
|
+
type: "MultiLineString",
|
|
79
|
+
coordinates
|
|
80
|
+
};
|
|
81
|
+
return feature(geom, properties, options);
|
|
82
|
+
}
|
|
44
83
|
function isNumber(num) {
|
|
45
84
|
return !isNaN(num) && num !== null && !Array.isArray(num);
|
|
46
85
|
}
|
|
47
86
|
|
|
48
|
-
export { feature, featureCollection, isNumber, point };
|
|
87
|
+
export { feature, featureCollection, isNumber, lineString, multiLineString, point, polygon };
|
|
49
88
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../../../../node_modules/@turf/helpers/dist/esm/index.js"],"sourcesContent":["// index.ts\nvar earthRadius = 63710088e-1;\nvar factors = {\n centimeters: earthRadius * 100,\n centimetres: earthRadius * 100,\n degrees: 360 / (2 * Math.PI),\n feet: earthRadius * 3.28084,\n inches: earthRadius * 39.37,\n kilometers: earthRadius / 1e3,\n kilometres: earthRadius / 1e3,\n meters: earthRadius,\n metres: earthRadius,\n miles: earthRadius / 1609.344,\n millimeters: earthRadius * 1e3,\n millimetres: earthRadius * 1e3,\n nauticalmiles: earthRadius / 1852,\n radians: 1,\n yards: earthRadius * 1.0936\n};\nvar areaFactors = {\n acres: 247105e-9,\n centimeters: 1e4,\n centimetres: 1e4,\n feet: 10.763910417,\n hectares: 1e-4,\n inches: 1550.003100006,\n kilometers: 1e-6,\n kilometres: 1e-6,\n meters: 1,\n metres: 1,\n miles: 386e-9,\n nauticalmiles: 29155334959812285e-23,\n millimeters: 1e6,\n millimetres: 1e6,\n yards: 1.195990046\n};\nfunction feature(geom, properties, options = {}) {\n const feat = { type: \"Feature\" };\n if (options.id === 0 || options.id) {\n feat.id = options.id;\n }\n if (options.bbox) {\n feat.bbox = options.bbox;\n }\n feat.properties = properties || {};\n feat.geometry = geom;\n return feat;\n}\nfunction geometry(type, coordinates, _options = {}) {\n switch (type) {\n case \"Point\":\n return point(coordinates).geometry;\n case \"LineString\":\n return lineString(coordinates).geometry;\n case \"Polygon\":\n return polygon(coordinates).geometry;\n case \"MultiPoint\":\n return multiPoint(coordinates).geometry;\n case \"MultiLineString\":\n return multiLineString(coordinates).geometry;\n case \"MultiPolygon\":\n return multiPolygon(coordinates).geometry;\n default:\n throw new Error(type + \" is invalid\");\n }\n}\nfunction point(coordinates, properties, options = {}) {\n if (!coordinates) {\n throw new Error(\"coordinates is required\");\n }\n if (!Array.isArray(coordinates)) {\n throw new Error(\"coordinates must be an Array\");\n }\n if (coordinates.length < 2) {\n throw new Error(\"coordinates must be at least 2 numbers long\");\n }\n if (!isNumber(coordinates[0]) || !isNumber(coordinates[1])) {\n throw new Error(\"coordinates must contain numbers\");\n }\n const geom = {\n type: \"Point\",\n coordinates\n };\n return feature(geom, properties, options);\n}\nfunction points(coordinates, properties, options = {}) {\n return featureCollection(\n coordinates.map((coords) => {\n return point(coords, properties);\n }),\n options\n );\n}\nfunction polygon(coordinates, properties, options = {}) {\n for (const ring of coordinates) {\n if (ring.length < 4) {\n throw new Error(\n \"Each LinearRing of a Polygon must have 4 or more Positions.\"\n );\n }\n if (ring[ring.length - 1].length !== ring[0].length) {\n throw new Error(\"First and last Position are not equivalent.\");\n }\n for (let j = 0; j < ring[ring.length - 1].length; j++) {\n if (ring[ring.length - 1][j] !== ring[0][j]) {\n throw new Error(\"First and last Position are not equivalent.\");\n }\n }\n }\n const geom = {\n type: \"Polygon\",\n coordinates\n };\n return feature(geom, properties, options);\n}\nfunction polygons(coordinates, properties, options = {}) {\n return featureCollection(\n coordinates.map((coords) => {\n return polygon(coords, properties);\n }),\n options\n );\n}\nfunction lineString(coordinates, properties, options = {}) {\n if (coordinates.length < 2) {\n throw new Error(\"coordinates must be an array of two or more positions\");\n }\n const geom = {\n type: \"LineString\",\n coordinates\n };\n return feature(geom, properties, options);\n}\nfunction lineStrings(coordinates, properties, options = {}) {\n return featureCollection(\n coordinates.map((coords) => {\n return lineString(coords, properties);\n }),\n options\n );\n}\nfunction featureCollection(features, options = {}) {\n const fc = { type: \"FeatureCollection\" };\n if (options.id) {\n fc.id = options.id;\n }\n if (options.bbox) {\n fc.bbox = options.bbox;\n }\n fc.features = features;\n return fc;\n}\nfunction multiLineString(coordinates, properties, options = {}) {\n const geom = {\n type: \"MultiLineString\",\n coordinates\n };\n return feature(geom, properties, options);\n}\nfunction multiPoint(coordinates, properties, options = {}) {\n const geom = {\n type: \"MultiPoint\",\n coordinates\n };\n return feature(geom, properties, options);\n}\nfunction multiPolygon(coordinates, properties, options = {}) {\n const geom = {\n type: \"MultiPolygon\",\n coordinates\n };\n return feature(geom, properties, options);\n}\nfunction geometryCollection(geometries, properties, options = {}) {\n const geom = {\n type: \"GeometryCollection\",\n geometries\n };\n return feature(geom, properties, options);\n}\nfunction round(num, precision = 0) {\n if (precision && !(precision >= 0)) {\n throw new Error(\"precision must be a positive number\");\n }\n const multiplier = Math.pow(10, precision || 0);\n return Math.round(num * multiplier) / multiplier;\n}\nfunction radiansToLength(radians, units = \"kilometers\") {\n const factor = factors[units];\n if (!factor) {\n throw new Error(units + \" units is invalid\");\n }\n return radians * factor;\n}\nfunction lengthToRadians(distance, units = \"kilometers\") {\n const factor = factors[units];\n if (!factor) {\n throw new Error(units + \" units is invalid\");\n }\n return distance / factor;\n}\nfunction lengthToDegrees(distance, units) {\n return radiansToDegrees(lengthToRadians(distance, units));\n}\nfunction bearingToAzimuth(bearing) {\n let angle = bearing % 360;\n if (angle < 0) {\n angle += 360;\n }\n return angle;\n}\nfunction azimuthToBearing(angle) {\n angle = angle % 360;\n if (angle > 180) {\n return angle - 360;\n } else if (angle < -180) {\n return angle + 360;\n }\n return angle;\n}\nfunction radiansToDegrees(radians) {\n const normalisedRadians = radians % (2 * Math.PI);\n return normalisedRadians * 180 / Math.PI;\n}\nfunction degreesToRadians(degrees) {\n const normalisedDegrees = degrees % 360;\n return normalisedDegrees * Math.PI / 180;\n}\nfunction convertLength(length, originalUnit = \"kilometers\", finalUnit = \"kilometers\") {\n if (!(length >= 0)) {\n throw new Error(\"length must be a positive number\");\n }\n return radiansToLength(lengthToRadians(length, originalUnit), finalUnit);\n}\nfunction convertArea(area, originalUnit = \"meters\", finalUnit = \"kilometers\") {\n if (!(area >= 0)) {\n throw new Error(\"area must be a positive number\");\n }\n const startFactor = areaFactors[originalUnit];\n if (!startFactor) {\n throw new Error(\"invalid original units\");\n }\n const finalFactor = areaFactors[finalUnit];\n if (!finalFactor) {\n throw new Error(\"invalid final units\");\n }\n return area / startFactor * finalFactor;\n}\nfunction isNumber(num) {\n return !isNaN(num) && num !== null && !Array.isArray(num);\n}\nfunction isObject(input) {\n return input !== null && typeof input === \"object\" && !Array.isArray(input);\n}\nfunction validateBBox(bbox) {\n if (!bbox) {\n throw new Error(\"bbox is required\");\n }\n if (!Array.isArray(bbox)) {\n throw new Error(\"bbox must be an Array\");\n }\n if (bbox.length !== 4 && bbox.length !== 6) {\n throw new Error(\"bbox must be an Array of 4 or 6 numbers\");\n }\n bbox.forEach((num) => {\n if (!isNumber(num)) {\n throw new Error(\"bbox must only contain numbers\");\n }\n });\n}\nfunction validateId(id) {\n if (!id) {\n throw new Error(\"id is required\");\n }\n if ([\"string\", \"number\"].indexOf(typeof id) === -1) {\n throw new Error(\"id must be a number or a string\");\n }\n}\nexport {\n areaFactors,\n azimuthToBearing,\n bearingToAzimuth,\n convertArea,\n convertLength,\n degreesToRadians,\n earthRadius,\n factors,\n feature,\n featureCollection,\n geometry,\n geometryCollection,\n isNumber,\n isObject,\n lengthToDegrees,\n lengthToRadians,\n lineString,\n lineStrings,\n multiLineString,\n multiPoint,\n multiPolygon,\n point,\n points,\n polygon,\n polygons,\n radiansToDegrees,\n radiansToLength,\n round,\n validateBBox,\n validateId\n};\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":"AAAA;AAoCA,SAAS,OAAO,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,GAAG,EAAE,EAAE;AACjD,EAAE,MAAM,IAAI,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE;AAClC,EAAE,IAAI,OAAO,CAAC,EAAE,KAAK,CAAC,IAAI,OAAO,CAAC,EAAE,EAAE;AACtC,IAAI,IAAI,CAAC,EAAE,GAAG,OAAO,CAAC,EAAE;AACxB;AACA,EAAE,IAAI,OAAO,CAAC,IAAI,EAAE;AACpB,IAAI,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI;AAC5B;AACA,EAAE,IAAI,CAAC,UAAU,GAAiB,EAAE;AACpC,EAAE,IAAI,CAAC,QAAQ,GAAG,IAAI;AACtB,EAAE,OAAO,IAAI;AACb;AAmBA,SAAS,KAAK,CAAC,WAAW,EAAE,UAAU,EAAE,OAAO,GAAG,EAAE,EAAE;AACtD,EAAE,IAAI,CAAC,WAAW,EAAE;AACpB,IAAI,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC;AAC9C;AACA,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;AACnC,IAAI,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC;AACnD;AACA,EAAE,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE;AAC9B,IAAI,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC;AAClE;AACA,EAAE,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE;AAC9D,IAAI,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC;AACvD;AACA,EAAE,MAAM,IAAI,GAAG;AACf,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI;AACJ,GAAG;AACH,EAAE,OAAO,OAAO,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC;AAC3C;AAyDA,SAAS,iBAAiB,CAAC,QAAQ,EAAE,OAAO,GAAG,EAAE,EAAE;AACnD,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,mBAAmB,EAAE;AAC1C,EAAE,IAAI,OAAO,CAAC,EAAE,EAAE;AAClB,IAAI,EAAE,CAAC,EAAE,GAAG,OAAO,CAAC,EAAE;AACtB;AACA,EAAE,IAAI,OAAO,CAAC,IAAI,EAAE;AACpB,IAAI,EAAE,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI;AAC1B;AACA,EAAE,EAAE,CAAC,QAAQ,GAAG,QAAQ;AACxB,EAAE,OAAO,EAAE;AACX;AAiGA,SAAS,QAAQ,CAAC,GAAG,EAAE;AACvB,EAAE,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,GAAG,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;AAC3D;;;;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../../../../node_modules/@turf/helpers/dist/esm/index.js"],"sourcesContent":["// index.ts\nvar earthRadius = 63710088e-1;\nvar factors = {\n centimeters: earthRadius * 100,\n centimetres: earthRadius * 100,\n degrees: 360 / (2 * Math.PI),\n feet: earthRadius * 3.28084,\n inches: earthRadius * 39.37,\n kilometers: earthRadius / 1e3,\n kilometres: earthRadius / 1e3,\n meters: earthRadius,\n metres: earthRadius,\n miles: earthRadius / 1609.344,\n millimeters: earthRadius * 1e3,\n millimetres: earthRadius * 1e3,\n nauticalmiles: earthRadius / 1852,\n radians: 1,\n yards: earthRadius * 1.0936\n};\nvar areaFactors = {\n acres: 247105e-9,\n centimeters: 1e4,\n centimetres: 1e4,\n feet: 10.763910417,\n hectares: 1e-4,\n inches: 1550.003100006,\n kilometers: 1e-6,\n kilometres: 1e-6,\n meters: 1,\n metres: 1,\n miles: 386e-9,\n nauticalmiles: 29155334959812285e-23,\n millimeters: 1e6,\n millimetres: 1e6,\n yards: 1.195990046\n};\nfunction feature(geom, properties, options = {}) {\n const feat = { type: \"Feature\" };\n if (options.id === 0 || options.id) {\n feat.id = options.id;\n }\n if (options.bbox) {\n feat.bbox = options.bbox;\n }\n feat.properties = properties || {};\n feat.geometry = geom;\n return feat;\n}\nfunction geometry(type, coordinates, _options = {}) {\n switch (type) {\n case \"Point\":\n return point(coordinates).geometry;\n case \"LineString\":\n return lineString(coordinates).geometry;\n case \"Polygon\":\n return polygon(coordinates).geometry;\n case \"MultiPoint\":\n return multiPoint(coordinates).geometry;\n case \"MultiLineString\":\n return multiLineString(coordinates).geometry;\n case \"MultiPolygon\":\n return multiPolygon(coordinates).geometry;\n default:\n throw new Error(type + \" is invalid\");\n }\n}\nfunction point(coordinates, properties, options = {}) {\n if (!coordinates) {\n throw new Error(\"coordinates is required\");\n }\n if (!Array.isArray(coordinates)) {\n throw new Error(\"coordinates must be an Array\");\n }\n if (coordinates.length < 2) {\n throw new Error(\"coordinates must be at least 2 numbers long\");\n }\n if (!isNumber(coordinates[0]) || !isNumber(coordinates[1])) {\n throw new Error(\"coordinates must contain numbers\");\n }\n const geom = {\n type: \"Point\",\n coordinates\n };\n return feature(geom, properties, options);\n}\nfunction points(coordinates, properties, options = {}) {\n return featureCollection(\n coordinates.map((coords) => {\n return point(coords, properties);\n }),\n options\n );\n}\nfunction polygon(coordinates, properties, options = {}) {\n for (const ring of coordinates) {\n if (ring.length < 4) {\n throw new Error(\n \"Each LinearRing of a Polygon must have 4 or more Positions.\"\n );\n }\n if (ring[ring.length - 1].length !== ring[0].length) {\n throw new Error(\"First and last Position are not equivalent.\");\n }\n for (let j = 0; j < ring[ring.length - 1].length; j++) {\n if (ring[ring.length - 1][j] !== ring[0][j]) {\n throw new Error(\"First and last Position are not equivalent.\");\n }\n }\n }\n const geom = {\n type: \"Polygon\",\n coordinates\n };\n return feature(geom, properties, options);\n}\nfunction polygons(coordinates, properties, options = {}) {\n return featureCollection(\n coordinates.map((coords) => {\n return polygon(coords, properties);\n }),\n options\n );\n}\nfunction lineString(coordinates, properties, options = {}) {\n if (coordinates.length < 2) {\n throw new Error(\"coordinates must be an array of two or more positions\");\n }\n const geom = {\n type: \"LineString\",\n coordinates\n };\n return feature(geom, properties, options);\n}\nfunction lineStrings(coordinates, properties, options = {}) {\n return featureCollection(\n coordinates.map((coords) => {\n return lineString(coords, properties);\n }),\n options\n );\n}\nfunction featureCollection(features, options = {}) {\n const fc = { type: \"FeatureCollection\" };\n if (options.id) {\n fc.id = options.id;\n }\n if (options.bbox) {\n fc.bbox = options.bbox;\n }\n fc.features = features;\n return fc;\n}\nfunction multiLineString(coordinates, properties, options = {}) {\n const geom = {\n type: \"MultiLineString\",\n coordinates\n };\n return feature(geom, properties, options);\n}\nfunction multiPoint(coordinates, properties, options = {}) {\n const geom = {\n type: \"MultiPoint\",\n coordinates\n };\n return feature(geom, properties, options);\n}\nfunction multiPolygon(coordinates, properties, options = {}) {\n const geom = {\n type: \"MultiPolygon\",\n coordinates\n };\n return feature(geom, properties, options);\n}\nfunction geometryCollection(geometries, properties, options = {}) {\n const geom = {\n type: \"GeometryCollection\",\n geometries\n };\n return feature(geom, properties, options);\n}\nfunction round(num, precision = 0) {\n if (precision && !(precision >= 0)) {\n throw new Error(\"precision must be a positive number\");\n }\n const multiplier = Math.pow(10, precision || 0);\n return Math.round(num * multiplier) / multiplier;\n}\nfunction radiansToLength(radians, units = \"kilometers\") {\n const factor = factors[units];\n if (!factor) {\n throw new Error(units + \" units is invalid\");\n }\n return radians * factor;\n}\nfunction lengthToRadians(distance, units = \"kilometers\") {\n const factor = factors[units];\n if (!factor) {\n throw new Error(units + \" units is invalid\");\n }\n return distance / factor;\n}\nfunction lengthToDegrees(distance, units) {\n return radiansToDegrees(lengthToRadians(distance, units));\n}\nfunction bearingToAzimuth(bearing) {\n let angle = bearing % 360;\n if (angle < 0) {\n angle += 360;\n }\n return angle;\n}\nfunction azimuthToBearing(angle) {\n angle = angle % 360;\n if (angle > 180) {\n return angle - 360;\n } else if (angle < -180) {\n return angle + 360;\n }\n return angle;\n}\nfunction radiansToDegrees(radians) {\n const normalisedRadians = radians % (2 * Math.PI);\n return normalisedRadians * 180 / Math.PI;\n}\nfunction degreesToRadians(degrees) {\n const normalisedDegrees = degrees % 360;\n return normalisedDegrees * Math.PI / 180;\n}\nfunction convertLength(length, originalUnit = \"kilometers\", finalUnit = \"kilometers\") {\n if (!(length >= 0)) {\n throw new Error(\"length must be a positive number\");\n }\n return radiansToLength(lengthToRadians(length, originalUnit), finalUnit);\n}\nfunction convertArea(area, originalUnit = \"meters\", finalUnit = \"kilometers\") {\n if (!(area >= 0)) {\n throw new Error(\"area must be a positive number\");\n }\n const startFactor = areaFactors[originalUnit];\n if (!startFactor) {\n throw new Error(\"invalid original units\");\n }\n const finalFactor = areaFactors[finalUnit];\n if (!finalFactor) {\n throw new Error(\"invalid final units\");\n }\n return area / startFactor * finalFactor;\n}\nfunction isNumber(num) {\n return !isNaN(num) && num !== null && !Array.isArray(num);\n}\nfunction isObject(input) {\n return input !== null && typeof input === \"object\" && !Array.isArray(input);\n}\nfunction validateBBox(bbox) {\n if (!bbox) {\n throw new Error(\"bbox is required\");\n }\n if (!Array.isArray(bbox)) {\n throw new Error(\"bbox must be an Array\");\n }\n if (bbox.length !== 4 && bbox.length !== 6) {\n throw new Error(\"bbox must be an Array of 4 or 6 numbers\");\n }\n bbox.forEach((num) => {\n if (!isNumber(num)) {\n throw new Error(\"bbox must only contain numbers\");\n }\n });\n}\nfunction validateId(id) {\n if (!id) {\n throw new Error(\"id is required\");\n }\n if ([\"string\", \"number\"].indexOf(typeof id) === -1) {\n throw new Error(\"id must be a number or a string\");\n }\n}\nexport {\n areaFactors,\n azimuthToBearing,\n bearingToAzimuth,\n convertArea,\n convertLength,\n degreesToRadians,\n earthRadius,\n factors,\n feature,\n featureCollection,\n geometry,\n geometryCollection,\n isNumber,\n isObject,\n lengthToDegrees,\n lengthToRadians,\n lineString,\n lineStrings,\n multiLineString,\n multiPoint,\n multiPolygon,\n point,\n points,\n polygon,\n polygons,\n radiansToDegrees,\n radiansToLength,\n round,\n validateBBox,\n validateId\n};\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":"AAAA;AAoCA,SAAS,OAAO,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,GAAG,EAAE,EAAE;AACjD,EAAE,MAAM,IAAI,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE;AAClC,EAAE,IAAI,OAAO,CAAC,EAAE,KAAK,CAAC,IAAI,OAAO,CAAC,EAAE,EAAE;AACtC,IAAI,IAAI,CAAC,EAAE,GAAG,OAAO,CAAC,EAAE;AACxB;AACA,EAAE,IAAI,OAAO,CAAC,IAAI,EAAE;AACpB,IAAI,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI;AAC5B;AACA,EAAE,IAAI,CAAC,UAAU,GAAG,UAAU,IAAI,EAAE;AACpC,EAAE,IAAI,CAAC,QAAQ,GAAG,IAAI;AACtB,EAAE,OAAO,IAAI;AACb;AAmBA,SAAS,KAAK,CAAC,WAAW,EAAE,UAAU,EAAE,OAAO,GAAG,EAAE,EAAE;AACtD,EAAE,IAAI,CAAC,WAAW,EAAE;AACpB,IAAI,MAAM,IAAI,KAAK,CAAC,yBA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O,CAAC;AAC3C;AA0FA,SAAS,QAAQ,CAAC,GAAG,EAAE;AACvB,EAAE,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,GAAG,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;AAC3D;;;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// index.ts
|
|
2
|
+
function getCoord(coord) {
|
|
3
|
+
if (!coord) {
|
|
4
|
+
throw new Error("coord is required");
|
|
5
|
+
}
|
|
6
|
+
if (!Array.isArray(coord)) {
|
|
7
|
+
if (coord.type === "Feature" && coord.geometry !== null && coord.geometry.type === "Point") {
|
|
8
|
+
return [...coord.geometry.coordinates];
|
|
9
|
+
}
|
|
10
|
+
if (coord.type === "Point") {
|
|
11
|
+
return [...coord.coordinates];
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
if (Array.isArray(coord) && coord.length >= 2 && !Array.isArray(coord[0]) && !Array.isArray(coord[1])) {
|
|
15
|
+
return [...coord];
|
|
16
|
+
}
|
|
17
|
+
throw new Error("coord must be GeoJSON Point or an Array of numbers");
|
|
18
|
+
}
|
|
19
|
+
function getGeom(geojson) {
|
|
20
|
+
if (geojson.type === "Feature") {
|
|
21
|
+
return geojson.geometry;
|
|
22
|
+
}
|
|
23
|
+
return geojson;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { getCoord, getGeom };
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../../../../node_modules/@turf/invariant/dist/esm/index.js"],"sourcesContent":["// index.ts\nimport { isNumber } from \"@turf/helpers\";\nfunction getCoord(coord) {\n if (!coord) {\n throw new Error(\"coord is required\");\n }\n if (!Array.isArray(coord)) {\n if (coord.type === \"Feature\" && coord.geometry !== null && coord.geometry.type === \"Point\") {\n return [...coord.geometry.coordinates];\n }\n if (coord.type === \"Point\") {\n return [...coord.coordinates];\n }\n }\n if (Array.isArray(coord) && coord.length >= 2 && !Array.isArray(coord[0]) && !Array.isArray(coord[1])) {\n return [...coord];\n }\n throw new Error(\"coord must be GeoJSON Point or an Array of numbers\");\n}\nfunction getCoords(coords) {\n if (Array.isArray(coords)) {\n return coords;\n }\n if (coords.type === \"Feature\") {\n if (coords.geometry !== null) {\n return coords.geometry.coordinates;\n }\n } else {\n if (coords.coordinates) {\n return coords.coordinates;\n }\n }\n throw new Error(\n \"coords must be GeoJSON Feature, Geometry Object or an Array\"\n );\n}\nfunction containsNumber(coordinates) {\n if (coordinates.length > 1 && isNumber(coordinates[0]) && isNumber(coordinates[1])) {\n return true;\n }\n if (Array.isArray(coordinates[0]) && coordinates[0].length) {\n return containsNumber(coordinates[0]);\n }\n throw new Error(\"coordinates must only contain numbers\");\n}\nfunction geojsonType(value, type, name) {\n if (!type || !name) {\n throw new Error(\"type and name required\");\n }\n if (!value || value.type !== type) {\n throw new Error(\n \"Invalid input to \" + name + \": must be a \" + type + \", given \" + value.type\n );\n }\n}\nfunction featureOf(feature, type, name) {\n if (!feature) {\n throw new Error(\"No feature passed\");\n }\n if (!name) {\n throw new Error(\".featureOf() requires a name\");\n }\n if (!feature || feature.type !== \"Feature\" || !feature.geometry) {\n throw new Error(\n \"Invalid input to \" + name + \", Feature with geometry required\"\n );\n }\n if (!feature.geometry || feature.geometry.type !== type) {\n throw new Error(\n \"Invalid input to \" + name + \": must be a \" + type + \", given \" + feature.geometry.type\n );\n }\n}\nfunction collectionOf(featureCollection, type, name) {\n if (!featureCollection) {\n throw new Error(\"No featureCollection passed\");\n }\n if (!name) {\n throw new Error(\".collectionOf() requires a name\");\n }\n if (!featureCollection || featureCollection.type !== \"FeatureCollection\") {\n throw new Error(\n \"Invalid input to \" + name + \", FeatureCollection required\"\n );\n }\n for (const feature of featureCollection.features) {\n if (!feature || feature.type !== \"Feature\" || !feature.geometry) {\n throw new Error(\n \"Invalid input to \" + name + \", Feature with geometry required\"\n );\n }\n if (!feature.geometry || feature.geometry.type !== type) {\n throw new Error(\n \"Invalid input to \" + name + \": must be a \" + type + \", given \" + feature.geometry.type\n );\n }\n }\n}\nfunction getGeom(geojson) {\n if (geojson.type === \"Feature\") {\n return geojson.geometry;\n }\n return geojson;\n}\nfunction getType(geojson, _name) {\n if (geojson.type === \"FeatureCollection\") {\n return \"FeatureCollection\";\n }\n if (geojson.type === \"GeometryCollection\") {\n return \"GeometryCollection\";\n }\n if (geojson.type === \"Feature\" && geojson.geometry !== null) {\n return geojson.geometry.type;\n }\n return geojson.type;\n}\nexport {\n collectionOf,\n containsNumber,\n featureOf,\n geojsonType,\n getCoord,\n getCoords,\n getGeom,\n getType\n};\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":"AAAA;AAEA,SAAS,QAAQ,CAAC,KAAK,EAAE;AACzB,EAAE,IAAI,CAAC,KAAK,EAAE;AACd,IAAI,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC;AACxC;AACA,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;AAC7B,IAAI,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,IAAI,KAAK,CAAC,QAAQ,KAAK,IAAI,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAI,KAAK,OAAO,EAAE;AAChG,MAAM,OAAO,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC;AAC5C;AACA,IAAI,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,EAAE;AAChC,MAAM,OAAO,CAAC,GAAG,KAAK,CAAC,WAAW,CAAC;AACnC;AACA;AACA,EAAE,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE;AACzG,IAAI,OAAO,CAAC,GAAG,KAAK,CAAC;AACrB;AACA,EAAE,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC;AACvE;AAgFA,SAAS,OAAO,CAAC,OAAO,EAAE;AAC1B,EAAE,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS,EAAE;AAClC,IAAI,OAAO,OAAO,CAAC,QAAQ;AAC3B;AACA,EAAE,OAAO,OAAO;AAChB;;;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { feature, featureCollection, point } from '../../../helpers/dist/esm/index.js';
|
|
2
|
+
import sweeplineIntersections$1 from '../../../../sweepline-intersections/dist/sweeplineIntersections.esm.js';
|
|
3
|
+
|
|
4
|
+
// index.ts
|
|
5
|
+
var sweeplineIntersections = sweeplineIntersections$1;
|
|
6
|
+
|
|
7
|
+
// index.ts
|
|
8
|
+
function lineIntersect(line1, line2, options = {}) {
|
|
9
|
+
const { removeDuplicates = true, ignoreSelfIntersections = true } = options;
|
|
10
|
+
let features = [];
|
|
11
|
+
if (line1.type === "FeatureCollection")
|
|
12
|
+
features = features.concat(line1.features);
|
|
13
|
+
else if (line1.type === "Feature") features.push(line1);
|
|
14
|
+
else if (line1.type === "LineString" || line1.type === "Polygon" || line1.type === "MultiLineString" || line1.type === "MultiPolygon") {
|
|
15
|
+
features.push(feature(line1));
|
|
16
|
+
}
|
|
17
|
+
if (line2.type === "FeatureCollection")
|
|
18
|
+
features = features.concat(line2.features);
|
|
19
|
+
else if (line2.type === "Feature") features.push(line2);
|
|
20
|
+
else if (line2.type === "LineString" || line2.type === "Polygon" || line2.type === "MultiLineString" || line2.type === "MultiPolygon") {
|
|
21
|
+
features.push(feature(line2));
|
|
22
|
+
}
|
|
23
|
+
const intersections = sweeplineIntersections(
|
|
24
|
+
featureCollection(features),
|
|
25
|
+
ignoreSelfIntersections
|
|
26
|
+
);
|
|
27
|
+
let results = [];
|
|
28
|
+
if (removeDuplicates) {
|
|
29
|
+
const unique = {};
|
|
30
|
+
intersections.forEach((intersection) => {
|
|
31
|
+
const key = intersection.join(",");
|
|
32
|
+
if (!unique[key]) {
|
|
33
|
+
unique[key] = true;
|
|
34
|
+
results.push(intersection);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
} else {
|
|
38
|
+
results = intersections;
|
|
39
|
+
}
|
|
40
|
+
return featureCollection(results.map((r) => point(r)));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export { lineIntersect };
|
|
44
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../../../../node_modules/@turf/line-intersect/dist/esm/index.js"],"sourcesContent":["// index.ts\nimport { feature, featureCollection, point } from \"@turf/helpers\";\n\n// lib/sweepline-intersections-export.ts\nimport lib from \"sweepline-intersections\";\nvar sweeplineIntersections = lib;\n\n// index.ts\nfunction lineIntersect(line1, line2, options = {}) {\n const { removeDuplicates = true, ignoreSelfIntersections = true } = options;\n let features = [];\n if (line1.type === \"FeatureCollection\")\n features = features.concat(line1.features);\n else if (line1.type === \"Feature\") features.push(line1);\n else if (line1.type === \"LineString\" || line1.type === \"Polygon\" || line1.type === \"MultiLineString\" || line1.type === \"MultiPolygon\") {\n features.push(feature(line1));\n }\n if (line2.type === \"FeatureCollection\")\n features = features.concat(line2.features);\n else if (line2.type === \"Feature\") features.push(line2);\n else if (line2.type === \"LineString\" || line2.type === \"Polygon\" || line2.type === \"MultiLineString\" || line2.type === \"MultiPolygon\") {\n features.push(feature(line2));\n }\n const intersections = sweeplineIntersections(\n featureCollection(features),\n ignoreSelfIntersections\n );\n let results = [];\n if (removeDuplicates) {\n const unique = {};\n intersections.forEach((intersection) => {\n const key = intersection.join(\",\");\n if (!unique[key]) {\n unique[key] = true;\n results.push(intersection);\n }\n });\n } else {\n results = intersections;\n }\n return featureCollection(results.map((r) => point(r)));\n}\nvar turf_line_intersect_default = lineIntersect;\nexport {\n turf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