@konfirm/geojson 1.0.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.
Files changed (122) hide show
  1. package/.editorconfig +16 -0
  2. package/.github/workflows/release.yml +21 -0
  3. package/.github/workflows/tests.yml +56 -0
  4. package/CHANGELOG.md +21 -0
  5. package/LICENSE +21 -0
  6. package/README.md +260 -0
  7. package/dist/Domain/Constants.d.ts +5 -0
  8. package/dist/Domain/GeoJSON/Concept/Altitude.d.ts +3 -0
  9. package/dist/Domain/GeoJSON/Concept/BoundingBox.d.ts +6 -0
  10. package/dist/Domain/GeoJSON/Concept/ExteriorRing.d.ts +4 -0
  11. package/dist/Domain/GeoJSON/Concept/GeoJSONObject.d.ts +11 -0
  12. package/dist/Domain/GeoJSON/Concept/InteriorRing.d.ts +4 -0
  13. package/dist/Domain/GeoJSON/Concept/Latitude.d.ts +3 -0
  14. package/dist/Domain/GeoJSON/Concept/LinearRing.d.ts +4 -0
  15. package/dist/Domain/GeoJSON/Concept/Longitude.d.ts +3 -0
  16. package/dist/Domain/GeoJSON/Concept/Position.d.ts +7 -0
  17. package/dist/Domain/GeoJSON/Feature.d.ts +12 -0
  18. package/dist/Domain/GeoJSON/FeatureCollection.d.ts +8 -0
  19. package/dist/Domain/GeoJSON/GeoJSON.d.ts +7 -0
  20. package/dist/Domain/GeoJSON/Geometry/LineString.d.ts +11 -0
  21. package/dist/Domain/GeoJSON/Geometry/MultiLineString.d.ts +7 -0
  22. package/dist/Domain/GeoJSON/Geometry/MultiPoint.d.ts +8 -0
  23. package/dist/Domain/GeoJSON/Geometry/MultiPolygon.d.ts +7 -0
  24. package/dist/Domain/GeoJSON/Geometry/Point.d.ts +11 -0
  25. package/dist/Domain/GeoJSON/Geometry/Polygon.d.ts +11 -0
  26. package/dist/Domain/GeoJSON/Geometry.d.ts +9 -0
  27. package/dist/Domain/GeoJSON/GeometryCollection.d.ts +8 -0
  28. package/dist/Domain/GeoJSON/GeometryObject.d.ts +12 -0
  29. package/dist/Domain/Guards/Number.d.ts +3 -0
  30. package/dist/Domain/Guards/Tuple.d.ts +3 -0
  31. package/dist/Domain/Iterator/IterablePair.d.ts +32 -0
  32. package/dist/Domain/Iterator/SimpleGeometry.d.ts +90 -0
  33. package/dist/Domain/Utility/Calculate.d.ts +9 -0
  34. package/dist/Domain/Utility/Distance.d.ts +3 -0
  35. package/dist/Domain/Utility/Intersect.d.ts +2 -0
  36. package/dist/Domain/Utility/Segments.d.ts +2 -0
  37. package/dist/Domain/Utility/Winding.d.ts +3 -0
  38. package/dist/geojson.cjs.js +655 -0
  39. package/dist/geojson.cjs.min.js +1 -0
  40. package/dist/geojson.d.ts +198 -0
  41. package/dist/geojson.es.js +627 -0
  42. package/dist/geojson.es.min.js +1 -0
  43. package/dist/geojson.js +660 -0
  44. package/dist/geojson.min.js +1 -0
  45. package/dist/main.d.ts +15 -0
  46. package/package.json +63 -0
  47. package/rollup.config.mjs +43 -0
  48. package/source/Domain/Constants.ts +5 -0
  49. package/source/Domain/GeoJSON/Concept/Altitude.ts +9 -0
  50. package/source/Domain/GeoJSON/Concept/BoundingBox.ts +31 -0
  51. package/source/Domain/GeoJSON/Concept/ExteriorRing.ts +12 -0
  52. package/source/Domain/GeoJSON/Concept/GeoJSONObject.ts +23 -0
  53. package/source/Domain/GeoJSON/Concept/InteriorRing.ts +12 -0
  54. package/source/Domain/GeoJSON/Concept/Latitude.ts +7 -0
  55. package/source/Domain/GeoJSON/Concept/LinearRing.ts +14 -0
  56. package/source/Domain/GeoJSON/Concept/Longitude.ts +7 -0
  57. package/source/Domain/GeoJSON/Concept/Position.ts +18 -0
  58. package/source/Domain/GeoJSON/Feature.ts +24 -0
  59. package/source/Domain/GeoJSON/FeatureCollection.ts +16 -0
  60. package/source/Domain/GeoJSON/GeoJSON.ts +9 -0
  61. package/source/Domain/GeoJSON/Geometry/LineString.ts +12 -0
  62. package/source/Domain/GeoJSON/Geometry/MultiLineString.ts +9 -0
  63. package/source/Domain/GeoJSON/Geometry/MultiPoint.ts +10 -0
  64. package/source/Domain/GeoJSON/Geometry/MultiPolygon.ts +9 -0
  65. package/source/Domain/GeoJSON/Geometry/Point.ts +12 -0
  66. package/source/Domain/GeoJSON/Geometry/Polygon.ts +20 -0
  67. package/source/Domain/GeoJSON/Geometry.ts +11 -0
  68. package/source/Domain/GeoJSON/GeometryCollection.ts +23 -0
  69. package/source/Domain/GeoJSON/GeometryObject.ts +20 -0
  70. package/source/Domain/Guards/Number.ts +13 -0
  71. package/source/Domain/Guards/Tuple.ts +6 -0
  72. package/source/Domain/Guards/Utility.ts +1 -0
  73. package/source/Domain/Iterator/IterablePair.ts +47 -0
  74. package/source/Domain/Iterator/SimpleGeometry.ts +137 -0
  75. package/source/Domain/Utility/Calculate.ts +143 -0
  76. package/source/Domain/Utility/Distance.ts +56 -0
  77. package/source/Domain/Utility/Intersect.ts +42 -0
  78. package/source/Domain/Utility/Numeric.ts +8 -0
  79. package/source/Domain/Utility/Segments.ts +5 -0
  80. package/source/Domain/Utility/Winding.ts +19 -0
  81. package/source/main.ts +20 -0
  82. package/test/Domain/GeoJSON/Concept/Altitude.ts +58 -0
  83. package/test/Domain/GeoJSON/Concept/BoundingBox.ts +77 -0
  84. package/test/Domain/GeoJSON/Concept/ExteriorRing.ts +65 -0
  85. package/test/Domain/GeoJSON/Concept/GeoJSONObject.ts +56 -0
  86. package/test/Domain/GeoJSON/Concept/InteriorRing.ts +65 -0
  87. package/test/Domain/GeoJSON/Concept/Latitude.ts +56 -0
  88. package/test/Domain/GeoJSON/Concept/LinearRing.ts +63 -0
  89. package/test/Domain/GeoJSON/Concept/Longitude.ts +56 -0
  90. package/test/Domain/GeoJSON/Concept/Position.ts +56 -0
  91. package/test/Domain/GeoJSON/Feature.ts +9 -0
  92. package/test/Domain/GeoJSON/FeatureCollection.ts +9 -0
  93. package/test/Domain/GeoJSON/GeoJSON.ts +21 -0
  94. package/test/Domain/GeoJSON/Geometry/LineString.ts +11 -0
  95. package/test/Domain/GeoJSON/Geometry/MultiLineString.ts +11 -0
  96. package/test/Domain/GeoJSON/Geometry/MultiPoint.ts +11 -0
  97. package/test/Domain/GeoJSON/Geometry/MultiPolygon.ts +11 -0
  98. package/test/Domain/GeoJSON/Geometry/Point.ts +11 -0
  99. package/test/Domain/GeoJSON/Geometry/Polygon.ts +11 -0
  100. package/test/Domain/GeoJSON/Geometry.ts +9 -0
  101. package/test/Domain/GeoJSON/GeometryCollection.ts +9 -0
  102. package/test/Domain/GeoJSON/GeometryObject.ts +4 -0
  103. package/test/Domain/Guards/Number.ts +49 -0
  104. package/test/Domain/Guards/Tuple.ts +27 -0
  105. package/test/Domain/Iterator/IterablePair.ts +203 -0
  106. package/test/Domain/Iterator/SimpleGeometry.ts +195 -0
  107. package/test/Domain/Utility/Calculate.ts +178 -0
  108. package/test/Domain/Utility/Distance.ts +19 -0
  109. package/test/Domain/Utility/Intersect.ts +54 -0
  110. package/test/Domain/Utility/Numeric.ts +30 -0
  111. package/test/Domain/Utility/Winding.ts +52 -0
  112. package/test/README.ts +123 -0
  113. package/test/data/Distance.ts +51 -0
  114. package/test/data/HolySee.ts +74 -0
  115. package/test/data/Intersect.ts +300 -0
  116. package/test/data/Italy.ts +2883 -0
  117. package/test/data/SanMarino.ts +83 -0
  118. package/test/data/Shapes.ts +107 -0
  119. package/test/helper/geometry.ts +76 -0
  120. package/test/helper/malform.ts +82 -0
  121. package/test/main.ts +4 -0
  122. package/tsconfig.json +12 -0
@@ -0,0 +1,30 @@
1
+ import test from 'tape';
2
+ import { each } from 'template-literal-each';
3
+ import * as Export from '../../../source/Domain/Utility/Numeric';
4
+ import { exported } from '../../helper/geometry';
5
+
6
+ exported('Domain/Utility/Numeric', Export, 'bounds');
7
+
8
+ const { bounds } = Export;
9
+
10
+ test('Domain/Utility/Numeric - bounds', (t) => {
11
+ each`
12
+ value | min | max | expect
13
+ -----------------------|---------|---------|--------
14
+ ${1} | ${-1} | ${1} | ${1}
15
+ ${100} | ${-1} | ${1} | ${0}
16
+ ${1} | ${-1.5} | ${1.5} | ${1}
17
+ ${1} | ${1.5} | ${-1.5} | ${1}
18
+ ${5.911738872528076} | ${-180} | ${180} | ${5.911738872528076}
19
+ ${-354.0882611274719} | ${-180} | ${180} | ${5.911738872528076}
20
+ ${365.911738872528076} | ${-180} | ${180} | ${5.911738872528076}
21
+ ${51.97496770044958} | ${-90} | ${90} | ${51.97496770044958}
22
+ ${-128.02503229955042} | ${-90} | ${90} | ${51.97496770044958}
23
+ ${231.97496770044958} | ${-90} | ${90} | ${51.97496770044958}
24
+ `(({ value, min, max, expect }: any) => {
25
+ const rotate = bounds(min, max);
26
+ t.equal(rotate(value), expect, `${value} within bounds ${min} and ${max} is ${expect}`);
27
+ });
28
+
29
+ t.end();
30
+ });
@@ -0,0 +1,52 @@
1
+ import test from 'tape';
2
+ import { each } from 'template-literal-each';
3
+ import * as Export from '../../../source/Domain/Utility/Winding';
4
+ import { exported } from '../../helper/geometry';
5
+
6
+ exported('Domain/Utility/Winding', Export, 'isClockwiseWinding', 'isCounterClockwiseWinding');
7
+
8
+ const { isClockwiseWinding, isCounterClockwiseWinding } = Export;
9
+
10
+ test('Domain/Utility/Winding - isClockwiseWinding', (t) => {
11
+ each`
12
+ position | valid
13
+ --------------------------------------------|-------
14
+ ${[[0, 0], [1, 0]]} | yes
15
+ ${[[0, 0], [1, 0], [1, 1]]} | yes
16
+ ${[[0, 0], [1, 0], [1, 1], [0, 1]]} | yes
17
+ ${[[0, 0], [1, 0], [1, 1], [0, 1], [0, 0]]} | yes
18
+ ${[[0, 0], [1, 0], [0, 1], [1, 1]]} | yes
19
+ ${[[0, 0]]} | yes
20
+ ${[[0, 0], [0, 1]]} | yes
21
+ ${[[0, 0], [0, 1], [1, 1]]} | no
22
+ ${[[0, 0], [0, 1], [1, 1], [1, 0]]} | no
23
+ ${[[0, 0], [0, 1], [1, 1], [1, 0], [0, 0]]} | no
24
+ ${[[1, 1], [0, 1], [1, 0], [0, 0]]} | yes
25
+ `(({ position, valid }) => {
26
+ t.equal(isClockwiseWinding(position), valid === 'yes', `isClockwiseWinding ${JSON.stringify(position)} ${valid}`);
27
+ });
28
+
29
+ t.end();
30
+ });
31
+
32
+ test('Domain/Utility/Winding - isCounterClockwiseWinding', (t) => {
33
+ each`
34
+ position | valid
35
+ --------------------------------------------|-------
36
+ ${[[0, 0], [1, 0]]} | yes
37
+ ${[[0, 0], [1, 0], [1, 1]]} | no
38
+ ${[[0, 0], [1, 0], [1, 1], [0, 1]]} | no
39
+ ${[[0, 0], [1, 0], [1, 1], [0, 1], [0, 0]]} | no
40
+ ${[[0, 0], [1, 0], [0, 1], [1, 1]]} | yes
41
+ ${[[0, 0]]} | yes
42
+ ${[[0, 0], [0, 1]]} | yes
43
+ ${[[0, 0], [0, 1], [1, 1]]} | yes
44
+ ${[[0, 0], [0, 1], [1, 1], [1, 0]]} | yes
45
+ ${[[0, 0], [0, 1], [1, 1], [1, 0], [0, 0]]} | yes
46
+ ${[[1, 1], [0, 1], [1, 0], [0, 0]]} | yes
47
+ `(({ position, valid }) => {
48
+ t.equal(isCounterClockwiseWinding(position), valid === 'yes', `isCounterClockwiseWinding ${JSON.stringify(position)} ${valid}`);
49
+ });
50
+
51
+ t.end();
52
+ });
package/test/README.ts ADDED
@@ -0,0 +1,123 @@
1
+ import test from 'tape';
2
+ import { distance, Feature, FeatureCollection, GeometryCollection, intersect, LineString, MultiLineString, MultiPoint, Point, SimpleGeometryIterator } from '../source/main';
3
+
4
+ test('README - intersect', (t) => {
5
+ const point: Point = {
6
+ type: 'Point',
7
+ coordinates: [1, 1],
8
+ };
9
+ const feature: Feature = {
10
+ type: 'Feature',
11
+ properties: {
12
+ name: 'triangle'
13
+ },
14
+ geometry: {
15
+ type: 'Polygon',
16
+ coordinates: [[[0, 0], [0, 2], [2, 1], [0, 0]]],
17
+ },
18
+ }
19
+
20
+ t.true(intersect(point, feature), 'point intersects feature');
21
+ t.true(intersect(feature, point), 'feature intersects point');
22
+
23
+ t.end();
24
+ });
25
+
26
+ test('README - distance', (t) => {
27
+ const a: Feature = {
28
+ type: 'Feature',
29
+ properties: {
30
+ name: 'Amsterdam Airport Schiphol',
31
+ },
32
+ geometry: {
33
+ type: 'Point',
34
+ coordinates: [4.763889, 52.308333],
35
+ },
36
+ };
37
+ const b: Feature = {
38
+ type: 'Feature',
39
+ properties: {
40
+ name: 'New York John F. Kennedy International Airport'
41
+ },
42
+ geometry: {
43
+ type: 'Point',
44
+ coordinates: [-73.778889, 40.639722],
45
+ },
46
+ };
47
+
48
+ t.equal(distance(a, b), 8829424.604594177, 'distance from a to b using default formula is 8829424.604594177');
49
+ t.equal(distance(a, b, 'cartesian'), 8829424.604594177, 'distance from a to b using cartesian formula is 8829424.604594177');
50
+ t.equal(distance(a, b, 'haversine'), 5847546.425707642, 'distance from a to b using haversine formula is 5847546.425707642');
51
+ t.equal(distance(a, b, 'vincenty'), 5863355.371234315, 'distance from a to b using vincenty formula is 5863355.371234315');
52
+
53
+ t.end();
54
+ });
55
+
56
+ test('README - SimpleGeometryIterator', (t) => {
57
+ const point: Point = {
58
+ type: 'Point',
59
+ coordinates: [5.903949737548828, 51.991936460056515],
60
+ };
61
+ const multipoint: MultiPoint = {
62
+ type: 'MultiPoint',
63
+ coordinates: [
64
+ [5.896482467651367, 52.00039200820837],
65
+ [5.888843536376953, 51.99912377779024],
66
+ ],
67
+ };
68
+ const linestring: LineString = {
69
+ type: 'LineString',
70
+ coordinates: [
71
+ [5.9077370166778564, 51.9944435645134],
72
+ [5.90764045715332, 51.994209045542206],
73
+ [5.907415151596069, 51.99408683094357],
74
+ ],
75
+ };
76
+ const multilinestring: MultiLineString = {
77
+ type: 'MultiLineString',
78
+ coordinates: [
79
+ [
80
+ [5.905205011367797, 51.99430813821511],
81
+ [5.905086994171143, 51.994261894995034],
82
+ [5.905033349990845, 51.99414958983319],
83
+ [5.9051138162612915, 51.994116558849626]
84
+ ],
85
+ [
86
+ [5.904818773269653, 51.993825885143515],
87
+ [5.905521512031555, 51.993551725259614],
88
+ [5.905789732933044, 51.99358805979856],
89
+ ],
90
+ ],
91
+ };
92
+ const geometrycollection: GeometryCollection = {
93
+ type: 'GeometryCollection',
94
+ geometries: [point],
95
+ };
96
+ const featurecollection: FeatureCollection = {
97
+ type: 'FeatureCollection',
98
+ features: [
99
+ {
100
+ type: 'Feature',
101
+ properties: {},
102
+ geometry: linestring,
103
+ },
104
+ {
105
+ type: 'Feature',
106
+ properties: {},
107
+ geometry: multilinestring,
108
+ },
109
+ ]
110
+ };
111
+
112
+ const expectation = []
113
+ .concat(multipoint.coordinates.map((coordinates) => ({ type: 'Point', coordinates })))
114
+ .concat(point)
115
+ .concat(linestring)
116
+ .concat(multilinestring.coordinates.map((coordinates) => ({ type: 'LineString', coordinates })));
117
+ const simplified = [...new SimpleGeometryIterator(multipoint, geometrycollection, featurecollection)];
118
+
119
+ console.dir(simplified);
120
+ t.deepEqual(simplified, expectation, 'provides all geometries in order');
121
+
122
+ t.end();
123
+ });
@@ -0,0 +1,51 @@
1
+ import { GeoJSON } from '../../source/Domain/GeoJSON/GeoJSON';
2
+ import { Polygon } from '../../source/Domain/GeoJSON/Geometry/Polygon';
3
+
4
+ const poly: Polygon = {
5
+ type: 'Polygon',
6
+ coordinates: [
7
+ [[0, 0], [0, 7], [2, 7], [2, 5], [4, 5], [4, 7], [7, 7], [7, 5], [9, 5], [9, 7], [11, 7], [11, 0], [0, 0]],
8
+ [[2, 2], [5, 2], [5, 4], [2, 4], [2, 2]],
9
+ [[7, 2], [9, 2], [9, 4], [7, 4], [7, 2]],
10
+ ]
11
+ };
12
+ export const shapes: Array<{ a: GeoJSON, b: GeoJSON, cartesian: number, haversine: number, vincenty: number }> = [
13
+ { a: { type: 'Point', coordinates: [0, 0] }, b: { type: 'Point', coordinates: [1, 0] }, cartesian: 111195.07973436874, haversine: 111195.07973436874, vincenty: 111319.49079322325 },
14
+ { a: { type: 'Point', coordinates: [0, 0] }, b: { type: 'Point', coordinates: [1, 1] }, cartesian: 157253.589829502, haversine: 157249.5977681334, vincenty: 156899.56829129544 },
15
+
16
+ { a: { type: 'Point', coordinates: [1, 1] }, b: { type: 'LineString', coordinates: [[0, 2], [2, 2]] }, cartesian: 111195.07973436874, haversine: 111195.07973436874, vincenty: 110575.06481449273 },
17
+ { a: { type: 'Point', coordinates: [1, 1] }, b: { type: 'LineString', coordinates: [[0, 0], [2, 2]] }, cartesian: 0, haversine: 0, vincenty: 0 },
18
+ { a: { type: 'Point', coordinates: [3, 3] }, b: { type: 'LineString', coordinates: [[0, 0], [2, 2]] }, cartesian: 157253.589829502, haversine: 157177.7682119375, vincenty: 156829.3291160335 },
19
+ { a: { type: 'Point', coordinates: [0, 1] }, b: { type: 'LineString', coordinates: [[0, 0], [2, 2]] }, cartesian: 78626.794914751, haversine: 78623.30209761004, vincenty: 78448.3205183003 },
20
+ { a: { type: 'Point', coordinates: [1, 0] }, b: { type: 'LineString', coordinates: [[0, 0], [2, 2]] }, cartesian: 78626.794914751, haversine: 78626.29592703035, vincenty: 78451.24803121673 },
21
+
22
+ { a: { type: 'MultiPoint', coordinates: [[9, 9], [1, 0]] }, b: { type: 'LineString', coordinates: [[0, 0], [2, 2]] }, cartesian: 78626.794914751, haversine: 78626.29592703035, vincenty: 78451.24803121673 },
23
+ { a: { type: 'Point', coordinates: [1, 0] }, b: { type: 'MultiLineString', coordinates: [[[100, 100], [200, 200]], [[0, 0], [2, 2]]] }, cartesian: 78626.794914751, haversine: 78626.29592703035, vincenty: 78451.24803121673 },
24
+ { a: { type: 'MultiPoint', coordinates: [[9, 9], [1, 0]] }, b: { type: 'MultiLineString', coordinates: [[[100, 100], [200, 200]], [[0, 0], [2, 2]]] }, cartesian: 78626.794914751, haversine: 78626.29592703035, vincenty: 78451.24803121673 },
25
+
26
+ { a: { type: 'Point', coordinates: [2, 2] }, b: { type: 'Polygon', coordinates: [[[0, 0], [0, 4], [4, 4], [4, 0], [0, 0]]] }, cartesian: 0, haversine: 0, vincenty: 0 },
27
+ { a: { type: 'Point', coordinates: [5, 2] }, b: { type: 'Polygon', coordinates: [[[0, 0], [0, 4], [4, 4], [4, 0], [0, 0]]] }, cartesian: 111195.07973436874, haversine: 111127.34097821356, vincenty: 111252.12980016059 },
28
+ { a: { type: 'Point', coordinates: [2, 2] }, b: { type: 'Polygon', coordinates: [[[0, 0], [0, 4], [4, 4], [4, 0], [0, 0]], [[1, 1], [3, 1], [3, 3], [1, 3], [1, 1]]] }, cartesian: 111195.07973436874, haversine: 111127.34097821356, vincenty: 110575.06481449273 },
29
+
30
+ { a: { type: 'LineString', coordinates: [[0, 0], [2, 0]] }, b: { type: 'LineString', coordinates: [[0, 2], [0, 0]] }, cartesian: 0, haversine: 0, vincenty: 0 },
31
+ { a: { type: 'LineString', coordinates: [[0, 0], [2, 0]] }, b: { type: 'LineString', coordinates: [[1, 2], [1, 0]] }, cartesian: 0, haversine: 0, vincenty: 0 },
32
+ { a: { type: 'LineString', coordinates: [[0, 0], [2, 0]] }, b: { type: 'LineString', coordinates: [[3, 2], [3, 0]] }, cartesian: 111195.07973436874, haversine: 111195.07973436874, vincenty: 111319.49079322327 },
33
+ { a: { type: 'LineString', coordinates: [[0, 0], [2, 0]] }, b: { type: 'LineString', coordinates: [[1, 1], [1, 3]] }, cartesian: 111195.07973436874, haversine: 111195.07973436874, vincenty: 110574.38855795695 },
34
+ { a: { type: 'LineString', coordinates: [[0, 0], [2, 0]] }, b: { type: 'LineString', coordinates: [[1, 1], [3, 3]] }, cartesian: 111195.07973436874, haversine: 111195.07973436874, vincenty: 110574.38855795695 },
35
+ { a: { type: 'LineString', coordinates: [[0, 0], [2, 2]] }, b: { type: 'LineString', coordinates: [[2, 0], [0, 2]] }, cartesian: 0, haversine: 0, vincenty: 0 },
36
+ { a: { type: 'LineString', coordinates: [[0, 0], [2, 0], [2, 2]] }, b: { type: 'LineString', coordinates: [[0, 2], [0, 0]] }, cartesian: 0, haversine: 0, vincenty: 0 },
37
+
38
+ { a: { type: 'LineString', coordinates: [[2, 2], [3, 2]] }, b: { type: 'Polygon', coordinates: [[[0, 0], [0, 4], [4, 4], [4, 0], [0, 0]]] }, cartesian: 0, haversine: 0, vincenty: 0 },
39
+ { a: { type: 'LineString', coordinates: [[1, 1], [10, 1]] }, b: poly, cartesian: 0, haversine: 0, vincenty: 0 },
40
+ { a: { type: 'LineString', coordinates: [[1, 3], [4, 3]] }, b: poly, cartesian: 0, haversine: 0, vincenty: 0 },
41
+ { a: { type: 'LineString', coordinates: [[3, 3], [4, 3]] }, b: poly, cartesian: 111195.07973436874, haversine: 111042.6868815999, vincenty: 110576.41652430617 },
42
+ { a: { type: 'LineString', coordinates: [[7.5, 3], [8.5, 3]] }, b: poly, cartesian: 55597.53986718437, haversine: 55521.344888509884, vincenty: 55583.97477025055 },
43
+ { a: { type: 'LineString', coordinates: [[3, 6], [3, 9]] }, b: poly, cartesian: 111195.07973436874, haversine: 110366.22766612672, vincenty: 110495.20453687456 },
44
+
45
+ { a: { type: 'Polygon', coordinates: [[[0, 0], [0, 9], [9, 9], [9, 0], [0, 0]]] }, b: { type: 'Polygon', coordinates: [[[2, 2], [2, 7], [7, 7], [7, 2], [2, 2]]] }, cartesian: 0, haversine: 0, vincenty: 0 },
46
+ { a: { type: 'Polygon', coordinates: [[[0, 0], [0, 9], [9, 9], [9, 0], [0, 0]], [[1, 1], [8, 1], [8, 8], [1, 8], [1, 1]]] }, b: { type: 'Polygon', coordinates: [[[2, 2], [2, 7], [7, 7], [7, 2], [2, 2]]] }, cartesian: 111195.07973436874, haversine: 110366.22766612672, vincenty: 110495.20453687456 },
47
+
48
+ // // Impossible <-> Possible
49
+ { a: { type: 'Impossible', coordinates: [0, 0] } as any, b: { type: 'Point', coordinates: [0, 0] }, cartesian: Infinity, haversine: Infinity, vincenty: Infinity },
50
+ { a: { type: 'Point', coordinates: [0, 0] }, b: { type: 'Impossible', coordinates: [0, 0] } as any, cartesian: Infinity, haversine: Infinity, vincenty: Infinity },
51
+ ];
@@ -0,0 +1,74 @@
1
+ import { Feature, LineString, MultiPoint, Polygon } from "../../source/main";
2
+
3
+ export const coordinates: MultiPoint['coordinates'] = [
4
+ [12.455663681030273, 41.90628554165478],
5
+ [12.457637786865234, 41.90582242096741],
6
+ [12.45750904083252, 41.90323527118919],
7
+ [12.458131313323975, 41.90296377408531],
8
+ [12.458367347717285, 41.902388835231],
9
+ [12.458345890045166, 41.90171806669123],
10
+ [12.457981109619139, 41.90131879635783],
11
+ [12.457423210144043, 41.90115908752542],
12
+ [12.456929683685303, 41.90119102932384],
13
+ [12.456543445587156, 41.901414621465506],
14
+ [12.456221580505371, 41.90165418360565],
15
+ [12.454354763031006, 41.90144656313615],
16
+ [12.454376220703125, 41.900695929652535],
17
+ [12.454547882080078, 41.90034456626665],
18
+ [12.454526424407959, 41.90020082614245],
19
+ [12.452874183654785, 41.900472334994284],
20
+ [12.452852725982666, 41.900296652927864],
21
+ [12.451672554016113, 41.900376508472526],
22
+ [12.450792789459227, 41.900616074507326],
23
+ [12.450792789459227, 41.90082369767715],
24
+ [12.448797225952148, 41.900983407348406],
25
+ [12.44873285293579, 41.90080772668804],
26
+ [12.44802474975586, 41.900663987606414],
27
+ [12.44776725769043, 41.90082369767715],
28
+ [12.447960376739502, 41.90099937829354],
29
+ [12.446715831756592, 41.901765978963454],
30
+ [12.446565628051758, 41.90163821282425],
31
+ [12.44577169418335, 41.90195762769289],
32
+ [12.446587085723877, 41.902356894031726],
33
+ [12.446801662445067, 41.902213158437355],
34
+ [12.44776725769043, 41.903011685422804],
35
+ [12.447617053985596, 41.903107507989986],
36
+ [12.448325157165526, 41.90371438090925],
37
+ [12.448668479919434, 41.903650499820955],
38
+ [12.44901180267334, 41.904672589563994],
39
+ [12.448861598968506, 41.904768409638564],
40
+ [12.44899034500122, 41.90511974868156],
41
+ [12.44922637939453, 41.905199598194436],
42
+ [12.449419498443604, 41.90507183892591],
43
+ [12.450535297393799, 41.905870330159836],
44
+ [12.450342178344727, 41.906014057521375],
45
+ [12.450470924377441, 41.90649314638965],
46
+ [12.451286315917969, 41.90657299418483],
47
+ [12.451479434967041, 41.90636538970964],
48
+ [12.453067302703857, 41.906716719964486],
49
+ [12.453818321228027, 41.906812536971195],
50
+ [12.453839778900146, 41.90698820110995],
51
+ [12.455449104309082, 41.90737146664404],
52
+ ];
53
+ export const multipoint: MultiPoint = {
54
+ type: 'MultiPoint',
55
+ coordinates,
56
+ };
57
+ export const linestring: LineString = {
58
+ type: 'LineString',
59
+ coordinates,
60
+ };
61
+ export const polygon: Polygon = {
62
+ type: 'Polygon',
63
+ coordinates: [coordinates.concat([coordinates[0]])]
64
+ };
65
+ export const feature: Feature = {
66
+ type: 'Feature',
67
+ properties: {
68
+ name: 'Vatican Obelisk',
69
+ },
70
+ geometry: {
71
+ type: 'Point',
72
+ coordinates: [12.457240819931028, 41.90221715109714],
73
+ },
74
+ };
@@ -0,0 +1,300 @@
1
+ import * as Italy from './Italy';
2
+ import * as HolySee from './HolySee';
3
+ import * as SanMarino from './SanMarino';
4
+ import { Feature, FeatureCollection, GeoJSON, GeometryCollection, LineString, MultiLineString, MultiPoint, MultiPolygon, Point, Polygon } from '../../source/main';
5
+ import { Geometry } from '../../source/Domain/GeoJSON/Geometry';
6
+
7
+ const relative = {
8
+ outside1: [
9
+ [12.444055080413818, 41.90334706377874],
10
+ [12.447037696838379, 41.904784379636986],
11
+ [12.449805736541746, 41.90735549729274],
12
+ [12.45450496673584, 41.9085372185006]
13
+ ],
14
+ outside2: [
15
+ [12.456951141357422, 41.910597193707545],
16
+ [12.456693649291992, 41.90660493327494],
17
+ [12.45896816253662, 41.906509115956666],
18
+ [12.458603382110596, 41.903139448813754]
19
+ ],
20
+ partial: [
21
+ [12.457487583160399, 41.90226107033812],
22
+ [12.458195686340332, 41.90229301158531],
23
+ [12.464332580566406, 41.90246868815924]
24
+ ],
25
+ inside1: [
26
+ [12.45425820350647, 41.903925986557695],
27
+ [12.454848289489746, 41.90402979284584],
28
+ [12.455030679702759, 41.90410964372185],
29
+ [12.457063794136047, 41.90400583756355]
30
+ ],
31
+ inside2: [
32
+ [12.454526424407959, 41.90458076185763],
33
+ [12.454580068588257, 41.90358661866875]
34
+ ]
35
+ };
36
+
37
+ function center(...points: Array<Array<number>>): Point['coordinates'] {
38
+ const s = 1e15;
39
+ const c = s * points.length;
40
+ const [x, y] = points
41
+ .reduce(([x1, y1], [x2, y2]) => [x1 + (x2 * s), y1 + (y2 * s)], [0, 0]);
42
+
43
+ return [x / c, y / c];
44
+ }
45
+
46
+ function geometry<T extends Geometry>(type: T['type'], coordinates: Array<unknown>): T {
47
+ return {
48
+ type,
49
+ coordinates: coordinates.slice() as T['coordinates'],
50
+ } as T;
51
+ }
52
+
53
+ function geometryCollection(...geometries: Array<Geometry | GeometryCollection>): GeometryCollection {
54
+ return {
55
+ type: 'GeometryCollection',
56
+ geometries,
57
+ };
58
+ }
59
+
60
+ function feature(geometry: Geometry): Feature {
61
+ return {
62
+ type: 'Feature',
63
+ properties: null,
64
+ geometry,
65
+ };
66
+ }
67
+
68
+ function featureCollection(...features: Array<Feature | Geometry>): FeatureCollection {
69
+ return {
70
+ type: 'FeatureCollection',
71
+ features: features.map((geo) => geo.type === 'Feature' ? geo : feature(geo)),
72
+ };
73
+ }
74
+
75
+ export const shapes: Array<{ a: GeoJSON, b: GeoJSON, intersect: boolean }> = [
76
+ // Point <-> Point
77
+ { a: geometry<Point>('Point', relative.inside1[0]), b: geometry<Point>('Point', relative.inside1[0]), intersect: true },
78
+ { a: geometry<Point>('Point', relative.inside1[0]), b: geometry<Point>('Point', relative.inside1[1]), intersect: false },
79
+
80
+ // MultiPoint <-> Point
81
+ { a: geometry<MultiPoint>('MultiPoint', relative.inside1), b: geometry<Point>('Point', relative.inside1[0]), intersect: true },
82
+ { a: geometry<MultiPoint>('MultiPoint', relative.inside1), b: geometry<Point>('Point', center(relative.inside1[0], relative.inside1[1])), intersect: false },
83
+ { a: geometry<MultiPoint>('MultiPoint', relative.inside1), b: geometry<Point>('Point', center(relative.inside2[0], relative.inside2[1])), intersect: false },
84
+ { a: geometry<MultiPoint>('MultiPoint', relative.inside1), b: geometry<Point>('Point', relative.inside2[1]), intersect: false },
85
+
86
+ // LineString <-> Point
87
+ { a: geometry<LineString>('LineString', relative.inside1), b: geometry<Point>('Point', relative.inside1[0]), intersect: true },
88
+ { a: geometry<LineString>('LineString', relative.inside1), b: geometry<Point>('Point', center(relative.inside1[0], relative.inside1[1])), intersect: true },
89
+ { a: geometry<LineString>('LineString', relative.inside1), b: geometry<Point>('Point', center(relative.inside2[0], relative.inside2[1])), intersect: false },
90
+ { a: geometry<LineString>('LineString', relative.inside1), b: geometry<Point>('Point', relative.inside2[1]), intersect: false },
91
+
92
+ // MultiLineString <-> Point
93
+ { a: geometry<MultiLineString>('MultiLineString', [relative.outside1, relative.inside1]), b: geometry<Point>('Point', relative.inside1[0]), intersect: true },
94
+ { a: geometry<MultiLineString>('MultiLineString', [relative.outside1, relative.inside1]), b: geometry<Point>('Point', center(relative.inside1[0], relative.inside1[1])), intersect: true },
95
+ { a: geometry<MultiLineString>('MultiLineString', [relative.outside1, relative.inside1]), b: geometry<Point>('Point', center(relative.inside2[0], relative.inside2[1])), intersect: false },
96
+ { a: geometry<MultiLineString>('MultiLineString', [relative.outside1, relative.inside1]), b: geometry<Point>('Point', relative.inside2[1]), intersect: false },
97
+
98
+ // Polygon <-> Point
99
+ { a: HolySee.polygon, b: geometry<Point>('Point', relative.inside1[0]), intersect: true },
100
+ { a: HolySee.polygon, b: geometry<Point>('Point', relative.outside1[0]), intersect: false },
101
+ { a: SanMarino.polygon, b: geometry<Point>('Point', relative.inside1[0]), intersect: false },
102
+ { a: geometry<Polygon>('Polygon', Italy.coordinates[0]), b: geometry<Point>('Point', relative.inside1[0]), intersect: false },
103
+ { a: geometry<Polygon>('Polygon', Italy.coordinates[0]), b: geometry<Point>('Point', relative.outside1[0]), intersect: true },
104
+
105
+ // MultiPolygon <-> Point
106
+ { a: Italy.multipolygon, b: geometry<Point>('Point', relative.inside1[0]), intersect: false },
107
+ { a: Italy.multipolygon, b: geometry<Point>('Point', relative.inside2[0]), intersect: false },
108
+ { a: Italy.multipolygon, b: geometry<Point>('Point', relative.outside1[0]), intersect: true },
109
+ { a: Italy.multipolygon, b: geometry<Point>('Point', relative.outside2[0]), intersect: true },
110
+ {
111
+ a: geometry<MultiPolygon>('MultiPolygon', [[[[8, 8], [8, 9], [9, 9], [9, 8], [8, 8]]], [[[0, 0], [0, 7], [7, 7], [7, 0], [0, 0]]]]),
112
+ b: geometry<Point>('Point', [3, 3]),
113
+ intersect: true,
114
+ },
115
+
116
+ // GeometryCollection <-> Point
117
+ { a: geometryCollection(geometry<Point>('Point', relative.inside1[0])), b: geometry<Point>('Point', relative.inside1[0]), intersect: true },
118
+ { a: geometryCollection(geometry<MultiPoint>('MultiPoint', relative.inside1)), b: geometry<Point>('Point', relative.inside2[1]), intersect: false },
119
+
120
+ // Feature <-> Point
121
+ { a: feature(Italy.multipolygon), b: geometry<Point>('Point', relative.outside1[0]), intersect: true },
122
+ { a: feature(HolySee.polygon), b: geometry<Point>('Point', relative.outside1[0]), intersect: false },
123
+
124
+ // FeatureCollection <-> Point
125
+ { a: featureCollection(geometry<MultiLineString>('MultiLineString', [relative.outside1, relative.inside1])), b: geometry<Point>('Point', relative.inside1[0]), intersect: true },
126
+ { a: featureCollection(geometry<MultiPoint>('MultiPoint', relative.inside1)), b: geometry<Point>('Point', relative.inside2[1]), intersect: false },
127
+
128
+
129
+ // MultiPoint <-> MultiPoint
130
+ { a: geometry<MultiPoint>('MultiPoint', [relative.inside1[0], relative.inside1[1]]), b: geometry<MultiPoint>('MultiPoint', [relative.inside1[1], relative.inside1[2]]), intersect: true },
131
+ { a: geometry<MultiPoint>('MultiPoint', [relative.outside1[0], relative.outside1[1]]), b: geometry<MultiPoint>('MultiPoint', [relative.outside1[1], relative.outside1[2]]), intersect: true },
132
+ { a: geometry<MultiPoint>('MultiPoint', [relative.inside1[0], relative.inside1[1]]), b: geometry<MultiPoint>('MultiPoint', [relative.inside1[2], relative.inside1[3]]), intersect: false },
133
+ { a: geometry<MultiPoint>('MultiPoint', relative.inside1), b: geometry<MultiPoint>('MultiPoint', relative.inside2), intersect: false },
134
+
135
+ // MultiPoint <-> LineString
136
+ { a: geometry<MultiPoint>('MultiPoint', [relative.inside1[0], relative.inside1[1]]), b: geometry<LineString>('LineString', [relative.inside1[1], relative.inside1[2]]), intersect: true },
137
+ { a: geometry<MultiPoint>('MultiPoint', [relative.outside1[0], relative.outside1[1]]), b: geometry<LineString>('LineString', [relative.outside1[1], relative.outside1[2]]), intersect: true },
138
+ { a: geometry<MultiPoint>('MultiPoint', [relative.outside1[0], center(relative.outside1[0], relative.outside1[1])]), b: geometry<LineString>('LineString', relative.outside1), intersect: true },
139
+ { a: geometry<MultiPoint>('MultiPoint', [relative.inside1[0], relative.inside1[1]]), b: geometry<LineString>('LineString', [relative.inside1[2], relative.inside1[3]]), intersect: false },
140
+ { a: geometry<MultiPoint>('MultiPoint', relative.inside1), b: geometry<LineString>('LineString', relative.inside2), intersect: false },
141
+
142
+ // MultiPoint <-> MultiLineString
143
+ { a: geometry<MultiPoint>('MultiPoint', [relative.inside1[0], relative.inside1[1]]), b: geometry<MultiLineString>('MultiLineString', [[relative.inside1[1], relative.inside1[2]], relative.outside1]), intersect: true },
144
+ { a: geometry<MultiPoint>('MultiPoint', [relative.outside1[0], relative.outside1[1]]), b: geometry<MultiLineString>('MultiLineString', [[relative.outside1[1], relative.outside1[2]], relative.inside2]), intersect: true },
145
+ { a: geometry<MultiPoint>('MultiPoint', [relative.outside1[0], center(relative.outside1[0], relative.outside1[1])]), b: geometry<MultiLineString>('MultiLineString', [relative.inside1, relative.outside1]), intersect: true },
146
+ { a: geometry<MultiPoint>('MultiPoint', [relative.inside1[0], relative.inside1[1]]), b: geometry<MultiLineString>('MultiLineString', [relative.inside2, relative.outside1]), intersect: false },
147
+ { a: geometry<MultiPoint>('MultiPoint', relative.inside1), b: geometry<MultiLineString>('MultiLineString', [relative.inside2, relative.outside1]), intersect: false },
148
+
149
+ // MultiPoint <-> Polygon
150
+ { a: geometry<MultiPoint>('MultiPoint', relative.inside1), b: HolySee.polygon, intersect: true },
151
+ { a: geometry<MultiPoint>('MultiPoint', relative.partial), b: HolySee.polygon, intersect: true },
152
+ { a: geometry<MultiPoint>('MultiPoint', relative.outside1), b: HolySee.polygon, intersect: false },
153
+
154
+ // MultiPoint <-> MultiPolygon
155
+ { a: geometry<MultiPoint>('MultiPoint', relative.partial), b: Italy.multipolygon, intersect: true },
156
+ { a: geometry<MultiPoint>('MultiPoint', relative.outside1), b: Italy.multipolygon, intersect: true },
157
+ { a: geometry<MultiPoint>('MultiPoint', relative.inside1), b: Italy.multipolygon, intersect: false },
158
+
159
+ // MultiPoint <-> GeometryCollection
160
+ { a: geometry<MultiPoint>('MultiPoint', relative.partial), b: geometryCollection(Italy.multipolygon), intersect: true },
161
+ { a: geometry<MultiPoint>('MultiPoint', relative.outside1), b: geometryCollection(HolySee.polygon), intersect: false },
162
+
163
+ // MultiPoint <-> Feature
164
+ { a: geometry<MultiPoint>('MultiPoint', [relative.inside1[0], relative.inside1[1]]), b: feature(geometry<MultiPoint>('MultiPoint', [relative.inside1[1], relative.inside1[2]])), intersect: true },
165
+ { a: geometry<MultiPoint>('MultiPoint', relative.inside1), b: feature(geometry<MultiLineString>('MultiLineString', [relative.inside2, relative.outside1])), intersect: false },
166
+
167
+ // MultiPoint <-> FeatureCollection
168
+ { a: geometry<MultiPoint>('MultiPoint', [relative.inside1[0], relative.inside1[1]]), b: featureCollection(geometry<MultiPoint>('MultiPoint', [relative.inside1[1], relative.inside1[2]])), intersect: true },
169
+ { a: geometry<MultiPoint>('MultiPoint', relative.inside1), b: featureCollection(Italy.multipolygon), intersect: false },
170
+
171
+
172
+ // LineString <-> LineString
173
+ { a: geometry<LineString>('LineString', relative.inside1), b: geometry<LineString>('LineString', relative.inside2), intersect: true },
174
+ { a: geometry<LineString>('LineString', relative.inside1), b: geometry<LineString>('LineString', relative.outside1), intersect: false },
175
+ { a: geometry<LineString>('LineString', relative.inside1), b: geometry<LineString>('LineString', relative.outside2), intersect: false },
176
+
177
+ // Polygon <-> LineString
178
+ { a: HolySee.polygon, b: geometry<LineString>('LineString', relative.inside2), intersect: true },
179
+ { a: HolySee.polygon, b: geometry<LineString>('LineString', relative.partial), intersect: true },
180
+ { a: HolySee.polygon, b: geometry<LineString>('LineString', relative.outside2), intersect: false },
181
+
182
+ // MultiPolygon <-> LineString
183
+ { a: Italy.multipolygon, b: geometry<LineString>('LineString', relative.partial), intersect: true },
184
+ { a: Italy.multipolygon, b: geometry<LineString>('LineString', relative.outside2), intersect: true },
185
+ { a: Italy.multipolygon, b: geometry<LineString>('LineString', relative.inside2), intersect: false },
186
+
187
+ // GeometryCollection <-> LineString
188
+ { a: geometryCollection(geometry<LineString>('LineString', relative.inside1)), b: geometry<LineString>('LineString', relative.inside2), intersect: true },
189
+ { a: geometryCollection(HolySee.polygon), b: geometry<LineString>('LineString', relative.outside2), intersect: false },
190
+
191
+ // Feature <-> LineString
192
+ { a: feature(HolySee.polygon), b: geometry<LineString>('LineString', relative.inside2), intersect: true },
193
+ { a: feature(geometry<LineString>('LineString', relative.inside1)), b: geometry<LineString>('LineString', relative.outside1), intersect: false },
194
+
195
+ // FeatureCollection <-> LineString
196
+ { a: featureCollection(HolySee.polygon), b: geometry<LineString>('LineString', relative.partial), intersect: true },
197
+ { a: featureCollection(Italy.multipolygon), b: geometry<LineString>('LineString', relative.inside2), intersect: false },
198
+
199
+
200
+ // MultiLineString <-> LineString
201
+ { a: geometry<MultiLineString>('MultiLineString', [relative.partial, relative.inside1]), b: geometry<LineString>('LineString', relative.inside2), intersect: true },
202
+ { a: geometry<MultiLineString>('MultiLineString', [relative.partial, relative.outside1]), b: geometry<LineString>('LineString', relative.inside2), intersect: false },
203
+
204
+ // MultiLineString <-> MultiLineString
205
+ { a: geometry<MultiLineString>('MultiLineString', [relative.partial, relative.inside2]), b: geometry<MultiLineString>('MultiLineString', [relative.outside1, relative.inside1]), intersect: true },
206
+ { a: geometry<MultiLineString>('MultiLineString', [relative.outside1, relative.outside2]), b: geometry<MultiLineString>('MultiLineString', [relative.inside1, relative.inside2]), intersect: false },
207
+
208
+ // MultiLineString <-> Polygon
209
+ { a: geometry<MultiLineString>('MultiLineString', [relative.inside1, relative.outside2]), b: HolySee.polygon, intersect: true },
210
+ { a: geometry<MultiLineString>('MultiLineString', [relative.partial, relative.outside2]), b: HolySee.polygon, intersect: true },
211
+ { a: geometry<MultiLineString>('MultiLineString', [relative.outside1, relative.outside2]), b: HolySee.polygon, intersect: false },
212
+
213
+ // MultiLineString <-> MultiPolygon
214
+ { a: geometry<MultiLineString>('MultiLineString', [relative.outside1, relative.outside2]), b: Italy.multipolygon, intersect: true },
215
+ { a: geometry<MultiLineString>('MultiLineString', [relative.outside2, relative.partial]), b: Italy.multipolygon, intersect: true },
216
+ { a: geometry<MultiLineString>('MultiLineString', [relative.inside1, relative.inside2]), b: Italy.multipolygon, intersect: false },
217
+
218
+ // MultiLineString <-> GeometryCollection
219
+ { a: geometry<MultiLineString>('MultiLineString', [relative.partial, relative.inside2]), b: geometryCollection(geometry<MultiLineString>('MultiLineString', [relative.outside1, relative.inside1])), intersect: true },
220
+ { a: geometry<MultiLineString>('MultiLineString', [relative.inside1, relative.inside2]), b: geometryCollection(Italy.multipolygon), intersect: false },
221
+
222
+ // MultiLineString <-> Feature
223
+ { a: geometry<MultiLineString>('MultiLineString', [relative.partial, relative.inside1]), b: feature(geometry<LineString>('LineString', relative.inside2)), intersect: true },
224
+ { a: geometry<MultiLineString>('MultiLineString', [relative.outside1, relative.outside2]), b: feature(HolySee.polygon), intersect: false },
225
+
226
+ // MultiLineString <-> FeatureCollection
227
+ { a: geometry<MultiLineString>('MultiLineString', [relative.inside1, relative.inside2]), b: featureCollection(Italy.multipolygon), intersect: false },
228
+ { a: geometry<MultiLineString>('MultiLineString', [relative.outside1, relative.outside2]), b: featureCollection(geometry<MultiLineString>('MultiLineString', [relative.inside1, relative.inside2])), intersect: false },
229
+
230
+
231
+ // Polygon <-> Polygon
232
+ { a: geometry<Polygon>('Polygon', [Italy.coordinates[0][0]]), b: HolySee.polygon, intersect: true },
233
+ { a: geometry<Polygon>('Polygon', [Italy.coordinates[0][0]]), b: SanMarino.polygon, intersect: true },
234
+ { a: SanMarino.polygon, b: HolySee.polygon, intersect: false },
235
+
236
+ // Polygon <-> MultiPolygon
237
+ { a: HolySee.polygon, b: geometry<MultiPolygon>('MultiPolygon', [[Italy.coordinates[0][0]], [Italy.coordinates[1]]]), intersect: true },
238
+ { a: SanMarino.polygon, b: geometry<MultiPolygon>('MultiPolygon', [[Italy.coordinates[0][0]], [Italy.coordinates[1]]]), intersect: true },
239
+ { a: geometry<Polygon>('Polygon', Italy.coordinates[1]), b: geometry<MultiPolygon>('MultiPolygon', [HolySee.polygon.coordinates, SanMarino.polygon.coordinates]), intersect: false },
240
+
241
+ // Polygon <-> GeometryCollection
242
+ { a: geometry<Polygon>('Polygon', [Italy.coordinates[0][0]]), b: geometryCollection(HolySee.polygon), intersect: true },
243
+ { a: SanMarino.polygon, b: geometryCollection(HolySee.polygon), intersect: false },
244
+
245
+ // Polygon <-> Feature
246
+ { a: HolySee.polygon, b: feature(geometry<MultiPolygon>('MultiPolygon', [[Italy.coordinates[0][0]], [Italy.coordinates[1]]])), intersect: true },
247
+ { a: geometry<Polygon>('Polygon', Italy.coordinates[1]), b: feature(geometry<MultiPolygon>('MultiPolygon', [HolySee.polygon.coordinates, SanMarino.polygon.coordinates])), intersect: false },
248
+
249
+ // Polygon <-> FeatureCollection
250
+ { a: geometry<Polygon>('Polygon', [Italy.coordinates[0][0]]), b: featureCollection(SanMarino.polygon), intersect: true },
251
+ { a: SanMarino.polygon, b: featureCollection(HolySee.polygon), intersect: false },
252
+
253
+
254
+ // MultiPolygon <-> MultiPolygon
255
+ { a: Italy.multipolygon, b: geometry<MultiPolygon>('MultiPolygon', [HolySee.polygon.coordinates, SanMarino.polygon.coordinates]), intersect: true },
256
+ { a: geometry<MultiPolygon>('MultiPolygon', [HolySee.polygon.coordinates, SanMarino.polygon.coordinates]), b: geometry<MultiPolygon>('MultiPolygon', Italy.coordinates.slice(1)), intersect: false },
257
+
258
+ // MultiPolygon <-> GeometryCollection
259
+ { a: Italy.multipolygon, b: geometryCollection(geometry<MultiPolygon>('MultiPolygon', [HolySee.polygon.coordinates, SanMarino.polygon.coordinates])), intersect: true },
260
+ { a: geometry<MultiPolygon>('MultiPolygon', [HolySee.polygon.coordinates, SanMarino.polygon.coordinates]), b: geometryCollection(geometry<MultiPolygon>('MultiPolygon', Italy.coordinates.slice(1))), intersect: false },
261
+
262
+ // MultiPolygon <-> Feature
263
+ { a: Italy.multipolygon, b: feature(geometry<MultiPolygon>('MultiPolygon', [HolySee.polygon.coordinates, SanMarino.polygon.coordinates])), intersect: true },
264
+ { a: geometry<MultiPolygon>('MultiPolygon', [HolySee.polygon.coordinates, SanMarino.polygon.coordinates]), b: feature(geometry<MultiPolygon>('MultiPolygon', Italy.coordinates.slice(1))), intersect: false },
265
+
266
+ // MultiPolygon <-> FeatureCollection];
267
+ { a: Italy.multipolygon, b: featureCollection(geometry<MultiPolygon>('MultiPolygon', [HolySee.polygon.coordinates, SanMarino.polygon.coordinates])), intersect: true },
268
+ { a: geometry<MultiPolygon>('MultiPolygon', [HolySee.polygon.coordinates, SanMarino.polygon.coordinates]), b: featureCollection(geometry<MultiPolygon>('MultiPolygon', Italy.coordinates.slice(1))), intersect: false },
269
+
270
+
271
+ // GeometryCollection <-> GeometryCollection
272
+ { a: geometryCollection(geometry<Point>('Point', relative.outside1[1])), b: geometryCollection(geometry<LineString>('LineString', relative.outside1)), intersect: true },
273
+ { a: geometryCollection(geometry<Point>('Point', relative.outside1[1])), b: geometryCollection(geometry<LineString>('LineString', relative.outside2)), intersect: false },
274
+
275
+ // GeometryCollection <-> Feature
276
+ { a: geometryCollection(geometry<Point>('Point', relative.outside1[1])), b: feature(geometry<LineString>('LineString', relative.outside1)), intersect: true },
277
+ { a: geometryCollection(geometry<Point>('Point', relative.outside1[1])), b: feature(geometry<LineString>('LineString', relative.outside2)), intersect: false },
278
+
279
+ // GeometryCollection <-> FeatureCollection
280
+ { a: geometryCollection(geometry<Point>('Point', relative.outside1[1])), b: featureCollection(geometry<LineString>('LineString', relative.outside1)), intersect: true },
281
+ { a: geometryCollection(geometry<Point>('Point', relative.outside1[1])), b: featureCollection(geometry<LineString>('LineString', relative.outside2)), intersect: false },
282
+
283
+
284
+ // Feature <-> Feature
285
+ { a: feature(geometry<Point>('Point', relative.outside1[1])), b: feature(geometry<LineString>('LineString', relative.outside1)), intersect: true },
286
+ { a: feature(geometry<Point>('Point', relative.outside1[1])), b: feature(geometry<LineString>('LineString', relative.outside2)), intersect: false },
287
+
288
+ // Feature <-> FeatureCollection
289
+ { a: feature(geometry<Point>('Point', relative.outside1[1])), b: featureCollection(geometry<LineString>('LineString', relative.outside1)), intersect: true },
290
+ { a: feature(geometry<Point>('Point', relative.outside1[1])), b: featureCollection(geometry<LineString>('LineString', relative.outside2)), intersect: false },
291
+
292
+
293
+ // FeatureCollection <-> FeatureCollection
294
+ { a: featureCollection(geometry<Point>('Point', relative.outside1[1])), b: featureCollection(geometry<LineString>('LineString', relative.outside1)), intersect: true },
295
+ { a: featureCollection(geometry<Point>('Point', relative.outside1[1])), b: featureCollection(geometry<LineString>('LineString', relative.outside2)), intersect: false },
296
+
297
+ // Impossible <-> Possible
298
+ { a: { type: 'Impossible', coordinates: [0, 0] } as any, b: geometry<Point>('Point', [0, 0]), intersect: false },
299
+ { a: geometry<Point>('Point', [0, 0]), b: { type: 'Impossible', coordinates: [0, 0] } as any, intersect: false },
300
+ ];