@turf/boolean-touches 7.0.0-alpha.2 → 7.1.0-alpha.7

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.
@@ -0,0 +1,649 @@
1
+ // index.ts
2
+ import { booleanPointOnLine } from "@turf/boolean-point-on-line";
3
+ import { booleanPointInPolygon } from "@turf/boolean-point-in-polygon";
4
+ import { getGeom } from "@turf/invariant";
5
+ function booleanTouches(feature1, feature2) {
6
+ var geom1 = getGeom(feature1);
7
+ var geom2 = getGeom(feature2);
8
+ var type1 = geom1.type;
9
+ var type2 = geom2.type;
10
+ switch (type1) {
11
+ case "Point":
12
+ switch (type2) {
13
+ case "LineString":
14
+ return isPointOnLineEnd(geom1, geom2);
15
+ case "MultiLineString":
16
+ var foundTouchingPoint = false;
17
+ for (var ii = 0; ii < geom2.coordinates.length; ii++) {
18
+ if (isPointOnLineEnd(geom1, {
19
+ type: "LineString",
20
+ coordinates: geom2.coordinates[ii]
21
+ }))
22
+ foundTouchingPoint = true;
23
+ }
24
+ return foundTouchingPoint;
25
+ case "Polygon":
26
+ for (var i = 0; i < geom2.coordinates.length; i++) {
27
+ if (booleanPointOnLine(geom1, {
28
+ type: "LineString",
29
+ coordinates: geom2.coordinates[i]
30
+ }))
31
+ return true;
32
+ }
33
+ return false;
34
+ case "MultiPolygon":
35
+ for (var i = 0; i < geom2.coordinates.length; i++) {
36
+ for (var ii = 0; ii < geom2.coordinates[i].length; ii++) {
37
+ if (booleanPointOnLine(geom1, {
38
+ type: "LineString",
39
+ coordinates: geom2.coordinates[i][ii]
40
+ }))
41
+ return true;
42
+ }
43
+ }
44
+ return false;
45
+ default:
46
+ throw new Error("feature2 " + type2 + " geometry not supported");
47
+ }
48
+ case "MultiPoint":
49
+ switch (type2) {
50
+ case "LineString":
51
+ var foundTouchingPoint = false;
52
+ for (var i = 0; i < geom1.coordinates.length; i++) {
53
+ if (!foundTouchingPoint) {
54
+ if (isPointOnLineEnd(
55
+ { type: "Point", coordinates: geom1.coordinates[i] },
56
+ geom2
57
+ ))
58
+ foundTouchingPoint = true;
59
+ }
60
+ if (booleanPointOnLine(
61
+ { type: "Point", coordinates: geom1.coordinates[i] },
62
+ geom2,
63
+ { ignoreEndVertices: true }
64
+ ))
65
+ return false;
66
+ }
67
+ return foundTouchingPoint;
68
+ case "MultiLineString":
69
+ var foundTouchingPoint = false;
70
+ for (var i = 0; i < geom1.coordinates.length; i++) {
71
+ for (var ii = 0; ii < geom2.coordinates.length; ii++) {
72
+ if (!foundTouchingPoint) {
73
+ if (isPointOnLineEnd(
74
+ { type: "Point", coordinates: geom1.coordinates[i] },
75
+ { type: "LineString", coordinates: geom2.coordinates[ii] }
76
+ ))
77
+ foundTouchingPoint = true;
78
+ }
79
+ if (booleanPointOnLine(
80
+ { type: "Point", coordinates: geom1.coordinates[i] },
81
+ { type: "LineString", coordinates: geom2.coordinates[ii] },
82
+ { ignoreEndVertices: true }
83
+ ))
84
+ return false;
85
+ }
86
+ }
87
+ return foundTouchingPoint;
88
+ case "Polygon":
89
+ var foundTouchingPoint = false;
90
+ for (var i = 0; i < geom1.coordinates.length; i++) {
91
+ if (!foundTouchingPoint) {
92
+ if (booleanPointOnLine(
93
+ { type: "Point", coordinates: geom1.coordinates[i] },
94
+ { type: "LineString", coordinates: geom2.coordinates[0] }
95
+ ))
96
+ foundTouchingPoint = true;
97
+ }
98
+ if (booleanPointInPolygon(
99
+ { type: "Point", coordinates: geom1.coordinates[i] },
100
+ geom2,
101
+ { ignoreBoundary: true }
102
+ ))
103
+ return false;
104
+ }
105
+ return foundTouchingPoint;
106
+ case "MultiPolygon":
107
+ var foundTouchingPoint = false;
108
+ for (var i = 0; i < geom1.coordinates.length; i++) {
109
+ for (var ii = 0; ii < geom2.coordinates.length; ii++) {
110
+ if (!foundTouchingPoint) {
111
+ if (booleanPointOnLine(
112
+ { type: "Point", coordinates: geom1.coordinates[i] },
113
+ {
114
+ type: "LineString",
115
+ coordinates: geom2.coordinates[ii][0]
116
+ }
117
+ ))
118
+ foundTouchingPoint = true;
119
+ }
120
+ if (booleanPointInPolygon(
121
+ { type: "Point", coordinates: geom1.coordinates[i] },
122
+ { type: "Polygon", coordinates: geom2.coordinates[ii] },
123
+ { ignoreBoundary: true }
124
+ ))
125
+ return false;
126
+ }
127
+ }
128
+ return foundTouchingPoint;
129
+ default:
130
+ throw new Error("feature2 " + type2 + " geometry not supported");
131
+ }
132
+ case "LineString":
133
+ switch (type2) {
134
+ case "Point":
135
+ return isPointOnLineEnd(geom2, geom1);
136
+ case "MultiPoint":
137
+ var foundTouchingPoint = false;
138
+ for (var i = 0; i < geom2.coordinates.length; i++) {
139
+ if (!foundTouchingPoint) {
140
+ if (isPointOnLineEnd(
141
+ { type: "Point", coordinates: geom2.coordinates[i] },
142
+ geom1
143
+ ))
144
+ foundTouchingPoint = true;
145
+ }
146
+ if (booleanPointOnLine(
147
+ { type: "Point", coordinates: geom2.coordinates[i] },
148
+ geom1,
149
+ { ignoreEndVertices: true }
150
+ ))
151
+ return false;
152
+ }
153
+ return foundTouchingPoint;
154
+ case "LineString":
155
+ var endMatch = false;
156
+ if (isPointOnLineEnd(
157
+ { type: "Point", coordinates: geom1.coordinates[0] },
158
+ geom2
159
+ ))
160
+ endMatch = true;
161
+ if (isPointOnLineEnd(
162
+ {
163
+ type: "Point",
164
+ coordinates: geom1.coordinates[geom1.coordinates.length - 1]
165
+ },
166
+ geom2
167
+ ))
168
+ endMatch = true;
169
+ if (endMatch === false)
170
+ return false;
171
+ for (var i = 0; i < geom1.coordinates.length; i++) {
172
+ if (booleanPointOnLine(
173
+ { type: "Point", coordinates: geom1.coordinates[i] },
174
+ geom2,
175
+ { ignoreEndVertices: true }
176
+ ))
177
+ return false;
178
+ }
179
+ return endMatch;
180
+ case "MultiLineString":
181
+ var endMatch = false;
182
+ for (var i = 0; i < geom2.coordinates.length; i++) {
183
+ if (isPointOnLineEnd(
184
+ { type: "Point", coordinates: geom1.coordinates[0] },
185
+ { type: "LineString", coordinates: geom2.coordinates[i] }
186
+ ))
187
+ endMatch = true;
188
+ if (isPointOnLineEnd(
189
+ {
190
+ type: "Point",
191
+ coordinates: geom1.coordinates[geom1.coordinates.length - 1]
192
+ },
193
+ { type: "LineString", coordinates: geom2.coordinates[i] }
194
+ ))
195
+ endMatch = true;
196
+ for (var ii = 0; ii < geom1.coordinates[i].length; ii++) {
197
+ if (booleanPointOnLine(
198
+ { type: "Point", coordinates: geom1.coordinates[ii] },
199
+ { type: "LineString", coordinates: geom2.coordinates[i] },
200
+ { ignoreEndVertices: true }
201
+ ))
202
+ return false;
203
+ }
204
+ }
205
+ return endMatch;
206
+ case "Polygon":
207
+ var foundTouchingPoint = false;
208
+ for (var i = 0; i < geom1.coordinates.length; i++) {
209
+ if (!foundTouchingPoint) {
210
+ if (booleanPointOnLine(
211
+ { type: "Point", coordinates: geom1.coordinates[i] },
212
+ { type: "LineString", coordinates: geom2.coordinates[0] }
213
+ ))
214
+ foundTouchingPoint = true;
215
+ }
216
+ if (booleanPointInPolygon(
217
+ { type: "Point", coordinates: geom1.coordinates[i] },
218
+ geom2,
219
+ { ignoreBoundary: true }
220
+ ))
221
+ return false;
222
+ }
223
+ return foundTouchingPoint;
224
+ case "MultiPolygon":
225
+ var foundTouchingPoint = false;
226
+ for (var i = 0; i < geom1.coordinates.length; i++) {
227
+ for (var ii = 0; ii < geom2.coordinates.length; ii++) {
228
+ if (!foundTouchingPoint) {
229
+ if (booleanPointOnLine(
230
+ { type: "Point", coordinates: geom1.coordinates[i] },
231
+ {
232
+ type: "LineString",
233
+ coordinates: geom2.coordinates[ii][0]
234
+ }
235
+ ))
236
+ foundTouchingPoint = true;
237
+ }
238
+ }
239
+ if (booleanPointInPolygon(
240
+ { type: "Point", coordinates: geom1.coordinates[i] },
241
+ geom2,
242
+ { ignoreBoundary: true }
243
+ ))
244
+ return false;
245
+ }
246
+ return foundTouchingPoint;
247
+ default:
248
+ throw new Error("feature2 " + type2 + " geometry not supported");
249
+ }
250
+ case "MultiLineString":
251
+ switch (type2) {
252
+ case "Point":
253
+ for (var i = 0; i < geom1.coordinates.length; i++) {
254
+ if (isPointOnLineEnd(geom2, {
255
+ type: "LineString",
256
+ coordinates: geom1.coordinates[i]
257
+ }))
258
+ return true;
259
+ }
260
+ return false;
261
+ case "MultiPoint":
262
+ var foundTouchingPoint = false;
263
+ for (var i = 0; i < geom1.coordinates.length; i++) {
264
+ for (var ii = 0; ii < geom2.coordinates.length; ii++) {
265
+ if (!foundTouchingPoint) {
266
+ if (isPointOnLineEnd(
267
+ { type: "Point", coordinates: geom2.coordinates[ii] },
268
+ { type: "LineString", coordinates: geom1.coordinates[ii] }
269
+ ))
270
+ foundTouchingPoint = true;
271
+ }
272
+ if (booleanPointOnLine(
273
+ { type: "Point", coordinates: geom2.coordinates[ii] },
274
+ { type: "LineString", coordinates: geom1.coordinates[ii] },
275
+ { ignoreEndVertices: true }
276
+ ))
277
+ return false;
278
+ }
279
+ }
280
+ return foundTouchingPoint;
281
+ case "LineString":
282
+ var endMatch = false;
283
+ for (var i = 0; i < geom1.coordinates.length; i++) {
284
+ if (isPointOnLineEnd(
285
+ { type: "Point", coordinates: geom1.coordinates[i][0] },
286
+ geom2
287
+ ))
288
+ endMatch = true;
289
+ if (isPointOnLineEnd(
290
+ {
291
+ type: "Point",
292
+ coordinates: geom1.coordinates[i][geom1.coordinates[i].length - 1]
293
+ },
294
+ geom2
295
+ ))
296
+ endMatch = true;
297
+ for (var ii = 0; ii < geom2.coordinates.length; ii++) {
298
+ if (booleanPointOnLine(
299
+ { type: "Point", coordinates: geom2.coordinates[ii] },
300
+ { type: "LineString", coordinates: geom1.coordinates[i] },
301
+ { ignoreEndVertices: true }
302
+ ))
303
+ return false;
304
+ }
305
+ }
306
+ return endMatch;
307
+ case "MultiLineString":
308
+ var endMatch = false;
309
+ for (var i = 0; i < geom1.coordinates.length; i++) {
310
+ for (var ii = 0; ii < geom2.coordinates.length; ii++) {
311
+ if (isPointOnLineEnd(
312
+ { type: "Point", coordinates: geom1.coordinates[i][0] },
313
+ { type: "LineString", coordinates: geom2.coordinates[ii] }
314
+ ))
315
+ endMatch = true;
316
+ if (isPointOnLineEnd(
317
+ {
318
+ type: "Point",
319
+ coordinates: geom1.coordinates[i][geom1.coordinates[i].length - 1]
320
+ },
321
+ { type: "LineString", coordinates: geom2.coordinates[ii] }
322
+ ))
323
+ endMatch = true;
324
+ for (var iii = 0; iii < geom1.coordinates[i].length; iii++) {
325
+ if (booleanPointOnLine(
326
+ { type: "Point", coordinates: geom1.coordinates[i][iii] },
327
+ { type: "LineString", coordinates: geom2.coordinates[ii] },
328
+ { ignoreEndVertices: true }
329
+ ))
330
+ return false;
331
+ }
332
+ }
333
+ }
334
+ return endMatch;
335
+ case "Polygon":
336
+ var foundTouchingPoint = false;
337
+ for (var i = 0; i < geom1.coordinates.length; i++) {
338
+ for (var ii = 0; ii < geom1.coordinates.length; ii++) {
339
+ if (!foundTouchingPoint) {
340
+ if (booleanPointOnLine(
341
+ { type: "Point", coordinates: geom1.coordinates[i][ii] },
342
+ { type: "LineString", coordinates: geom2.coordinates[0] }
343
+ ))
344
+ foundTouchingPoint = true;
345
+ }
346
+ if (booleanPointInPolygon(
347
+ { type: "Point", coordinates: geom1.coordinates[i][ii] },
348
+ geom2,
349
+ { ignoreBoundary: true }
350
+ ))
351
+ return false;
352
+ }
353
+ }
354
+ return foundTouchingPoint;
355
+ case "MultiPolygon":
356
+ var foundTouchingPoint = false;
357
+ for (var i = 0; i < geom2.coordinates[0].length; i++) {
358
+ for (var ii = 0; ii < geom1.coordinates.length; ii++) {
359
+ for (var iii = 0; iii < geom1.coordinates[ii].length; iii++) {
360
+ if (!foundTouchingPoint) {
361
+ if (booleanPointOnLine(
362
+ {
363
+ type: "Point",
364
+ coordinates: geom1.coordinates[ii][iii]
365
+ },
366
+ {
367
+ type: "LineString",
368
+ coordinates: geom2.coordinates[0][i]
369
+ }
370
+ ))
371
+ foundTouchingPoint = true;
372
+ }
373
+ if (booleanPointInPolygon(
374
+ { type: "Point", coordinates: geom1.coordinates[ii][iii] },
375
+ { type: "Polygon", coordinates: [geom2.coordinates[0][i]] },
376
+ { ignoreBoundary: true }
377
+ ))
378
+ return false;
379
+ }
380
+ }
381
+ }
382
+ return foundTouchingPoint;
383
+ default:
384
+ throw new Error("feature2 " + type2 + " geometry not supported");
385
+ }
386
+ case "Polygon":
387
+ switch (type2) {
388
+ case "Point":
389
+ for (var i = 0; i < geom1.coordinates.length; i++) {
390
+ if (booleanPointOnLine(geom2, {
391
+ type: "LineString",
392
+ coordinates: geom1.coordinates[i]
393
+ }))
394
+ return true;
395
+ }
396
+ return false;
397
+ case "MultiPoint":
398
+ var foundTouchingPoint = false;
399
+ for (var i = 0; i < geom2.coordinates.length; i++) {
400
+ if (!foundTouchingPoint) {
401
+ if (booleanPointOnLine(
402
+ { type: "Point", coordinates: geom2.coordinates[i] },
403
+ { type: "LineString", coordinates: geom1.coordinates[0] }
404
+ ))
405
+ foundTouchingPoint = true;
406
+ }
407
+ if (booleanPointInPolygon(
408
+ { type: "Point", coordinates: geom2.coordinates[i] },
409
+ geom1,
410
+ { ignoreBoundary: true }
411
+ ))
412
+ return false;
413
+ }
414
+ return foundTouchingPoint;
415
+ case "LineString":
416
+ var foundTouchingPoint = false;
417
+ for (var i = 0; i < geom2.coordinates.length; i++) {
418
+ if (!foundTouchingPoint) {
419
+ if (booleanPointOnLine(
420
+ { type: "Point", coordinates: geom2.coordinates[i] },
421
+ { type: "LineString", coordinates: geom1.coordinates[0] }
422
+ ))
423
+ foundTouchingPoint = true;
424
+ }
425
+ if (booleanPointInPolygon(
426
+ { type: "Point", coordinates: geom2.coordinates[i] },
427
+ geom1,
428
+ { ignoreBoundary: true }
429
+ ))
430
+ return false;
431
+ }
432
+ return foundTouchingPoint;
433
+ case "MultiLineString":
434
+ var foundTouchingPoint = false;
435
+ for (var i = 0; i < geom2.coordinates.length; i++) {
436
+ for (var ii = 0; ii < geom2.coordinates[i].length; ii++) {
437
+ if (!foundTouchingPoint) {
438
+ if (booleanPointOnLine(
439
+ { type: "Point", coordinates: geom2.coordinates[i][ii] },
440
+ { type: "LineString", coordinates: geom1.coordinates[0] }
441
+ ))
442
+ foundTouchingPoint = true;
443
+ }
444
+ if (booleanPointInPolygon(
445
+ { type: "Point", coordinates: geom2.coordinates[i][ii] },
446
+ geom1,
447
+ { ignoreBoundary: true }
448
+ ))
449
+ return false;
450
+ }
451
+ }
452
+ return foundTouchingPoint;
453
+ case "Polygon":
454
+ var foundTouchingPoint = false;
455
+ for (var i = 0; i < geom1.coordinates[0].length; i++) {
456
+ if (!foundTouchingPoint) {
457
+ if (booleanPointOnLine(
458
+ { type: "Point", coordinates: geom1.coordinates[0][i] },
459
+ { type: "LineString", coordinates: geom2.coordinates[0] }
460
+ ))
461
+ foundTouchingPoint = true;
462
+ }
463
+ if (booleanPointInPolygon(
464
+ { type: "Point", coordinates: geom1.coordinates[0][i] },
465
+ geom2,
466
+ { ignoreBoundary: true }
467
+ ))
468
+ return false;
469
+ }
470
+ return foundTouchingPoint;
471
+ case "MultiPolygon":
472
+ var foundTouchingPoint = false;
473
+ for (var i = 0; i < geom2.coordinates[0].length; i++) {
474
+ for (var ii = 0; ii < geom1.coordinates[0].length; ii++) {
475
+ if (!foundTouchingPoint) {
476
+ if (booleanPointOnLine(
477
+ { type: "Point", coordinates: geom1.coordinates[0][ii] },
478
+ { type: "LineString", coordinates: geom2.coordinates[0][i] }
479
+ ))
480
+ foundTouchingPoint = true;
481
+ }
482
+ if (booleanPointInPolygon(
483
+ { type: "Point", coordinates: geom1.coordinates[0][ii] },
484
+ { type: "Polygon", coordinates: geom2.coordinates[0][i] },
485
+ { ignoreBoundary: true }
486
+ ))
487
+ return false;
488
+ }
489
+ }
490
+ return foundTouchingPoint;
491
+ default:
492
+ throw new Error("feature2 " + type2 + " geometry not supported");
493
+ }
494
+ case "MultiPolygon":
495
+ switch (type2) {
496
+ case "Point":
497
+ for (var i = 0; i < geom1.coordinates[0].length; i++) {
498
+ if (booleanPointOnLine(geom2, {
499
+ type: "LineString",
500
+ coordinates: geom1.coordinates[0][i]
501
+ }))
502
+ return true;
503
+ }
504
+ return false;
505
+ case "MultiPoint":
506
+ var foundTouchingPoint = false;
507
+ for (var i = 0; i < geom1.coordinates[0].length; i++) {
508
+ for (var ii = 0; ii < geom2.coordinates.length; ii++) {
509
+ if (!foundTouchingPoint) {
510
+ if (booleanPointOnLine(
511
+ { type: "Point", coordinates: geom2.coordinates[ii] },
512
+ { type: "LineString", coordinates: geom1.coordinates[0][i] }
513
+ ))
514
+ foundTouchingPoint = true;
515
+ }
516
+ if (booleanPointInPolygon(
517
+ { type: "Point", coordinates: geom2.coordinates[ii] },
518
+ { type: "Polygon", coordinates: geom1.coordinates[0][i] },
519
+ { ignoreBoundary: true }
520
+ ))
521
+ return false;
522
+ }
523
+ }
524
+ return foundTouchingPoint;
525
+ case "LineString":
526
+ var foundTouchingPoint = false;
527
+ for (var i = 0; i < geom1.coordinates[0].length; i++) {
528
+ for (var ii = 0; ii < geom2.coordinates.length; ii++) {
529
+ if (!foundTouchingPoint) {
530
+ if (booleanPointOnLine(
531
+ { type: "Point", coordinates: geom2.coordinates[ii] },
532
+ { type: "LineString", coordinates: geom1.coordinates[0][i] }
533
+ ))
534
+ foundTouchingPoint = true;
535
+ }
536
+ if (booleanPointInPolygon(
537
+ { type: "Point", coordinates: geom2.coordinates[ii] },
538
+ { type: "Polygon", coordinates: geom1.coordinates[0][i] },
539
+ { ignoreBoundary: true }
540
+ ))
541
+ return false;
542
+ }
543
+ }
544
+ return foundTouchingPoint;
545
+ case "MultiLineString":
546
+ var foundTouchingPoint = false;
547
+ for (var i = 0; i < geom1.coordinates.length; i++) {
548
+ for (var ii = 0; ii < geom2.coordinates.length; ii++) {
549
+ for (var iii = 0; iii < geom2.coordinates[ii].length; iii++) {
550
+ if (!foundTouchingPoint) {
551
+ if (booleanPointOnLine(
552
+ {
553
+ type: "Point",
554
+ coordinates: geom2.coordinates[ii][iii]
555
+ },
556
+ {
557
+ type: "LineString",
558
+ coordinates: geom1.coordinates[i][0]
559
+ }
560
+ ))
561
+ foundTouchingPoint = true;
562
+ }
563
+ if (booleanPointInPolygon(
564
+ { type: "Point", coordinates: geom2.coordinates[ii][iii] },
565
+ { type: "Polygon", coordinates: [geom1.coordinates[i][0]] },
566
+ { ignoreBoundary: true }
567
+ ))
568
+ return false;
569
+ }
570
+ }
571
+ }
572
+ return foundTouchingPoint;
573
+ case "Polygon":
574
+ var foundTouchingPoint = false;
575
+ for (var i = 0; i < geom1.coordinates[0].length; i++) {
576
+ for (var ii = 0; ii < geom1.coordinates[0][i].length; ii++) {
577
+ if (!foundTouchingPoint) {
578
+ if (booleanPointOnLine(
579
+ { type: "Point", coordinates: geom1.coordinates[0][i][ii] },
580
+ { type: "LineString", coordinates: geom2.coordinates[0] }
581
+ ))
582
+ foundTouchingPoint = true;
583
+ }
584
+ if (booleanPointInPolygon(
585
+ { type: "Point", coordinates: geom1.coordinates[0][i][ii] },
586
+ geom2,
587
+ { ignoreBoundary: true }
588
+ ))
589
+ return false;
590
+ }
591
+ }
592
+ return foundTouchingPoint;
593
+ case "MultiPolygon":
594
+ var foundTouchingPoint = false;
595
+ for (var i = 0; i < geom1.coordinates[0].length; i++) {
596
+ for (var ii = 0; ii < geom2.coordinates[0].length; ii++) {
597
+ for (var iii = 0; iii < geom1.coordinates[0].length; iii++) {
598
+ if (!foundTouchingPoint) {
599
+ if (booleanPointOnLine(
600
+ {
601
+ type: "Point",
602
+ coordinates: geom1.coordinates[0][i][iii]
603
+ },
604
+ {
605
+ type: "LineString",
606
+ coordinates: geom2.coordinates[0][ii]
607
+ }
608
+ ))
609
+ foundTouchingPoint = true;
610
+ }
611
+ if (booleanPointInPolygon(
612
+ {
613
+ type: "Point",
614
+ coordinates: geom1.coordinates[0][i][iii]
615
+ },
616
+ { type: "Polygon", coordinates: geom2.coordinates[0][ii] },
617
+ { ignoreBoundary: true }
618
+ ))
619
+ return false;
620
+ }
621
+ }
622
+ }
623
+ return foundTouchingPoint;
624
+ default:
625
+ throw new Error("feature2 " + type2 + " geometry not supported");
626
+ }
627
+ default:
628
+ throw new Error("feature1 " + type1 + " geometry not supported");
629
+ }
630
+ }
631
+ function isPointOnLineEnd(point, line) {
632
+ if (compareCoords(line.coordinates[0], point.coordinates))
633
+ return true;
634
+ if (compareCoords(
635
+ line.coordinates[line.coordinates.length - 1],
636
+ point.coordinates
637
+ ))
638
+ return true;
639
+ return false;
640
+ }
641
+ function compareCoords(pair1, pair2) {
642
+ return pair1[0] === pair2[0] && pair1[1] === pair2[1];
643
+ }
644
+ var turf_boolean_touches_default = booleanTouches;
645
+ export {
646
+ booleanTouches,
647
+ turf_boolean_touches_default as default
648
+ };
649
+ //# sourceMappingURL=index.js.map