@konfirm/geojson 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/README.md +7 -7
  2. package/dist/{geojson.d.ts → main.d.mts} +18 -79
  3. package/dist/main.d.ts +137 -15
  4. package/dist/main.global.js +853 -0
  5. package/dist/main.global.js.map +1 -0
  6. package/dist/main.js +824 -0
  7. package/dist/main.js.map +1 -0
  8. package/dist/main.mjs +772 -0
  9. package/dist/main.mjs.map +1 -0
  10. package/package.json +101 -63
  11. package/.editorconfig +0 -16
  12. package/.github/workflows/release.yml +0 -21
  13. package/.github/workflows/tests.yml +0 -56
  14. package/CHANGELOG.md +0 -21
  15. package/dist/Domain/Constants.d.ts +0 -5
  16. package/dist/Domain/GeoJSON/Concept/Altitude.d.ts +0 -3
  17. package/dist/Domain/GeoJSON/Concept/BoundingBox.d.ts +0 -6
  18. package/dist/Domain/GeoJSON/Concept/ExteriorRing.d.ts +0 -4
  19. package/dist/Domain/GeoJSON/Concept/GeoJSONObject.d.ts +0 -11
  20. package/dist/Domain/GeoJSON/Concept/InteriorRing.d.ts +0 -4
  21. package/dist/Domain/GeoJSON/Concept/Latitude.d.ts +0 -3
  22. package/dist/Domain/GeoJSON/Concept/LinearRing.d.ts +0 -4
  23. package/dist/Domain/GeoJSON/Concept/Longitude.d.ts +0 -3
  24. package/dist/Domain/GeoJSON/Concept/Position.d.ts +0 -7
  25. package/dist/Domain/GeoJSON/Feature.d.ts +0 -12
  26. package/dist/Domain/GeoJSON/FeatureCollection.d.ts +0 -8
  27. package/dist/Domain/GeoJSON/GeoJSON.d.ts +0 -7
  28. package/dist/Domain/GeoJSON/Geometry/LineString.d.ts +0 -11
  29. package/dist/Domain/GeoJSON/Geometry/MultiLineString.d.ts +0 -7
  30. package/dist/Domain/GeoJSON/Geometry/MultiPoint.d.ts +0 -8
  31. package/dist/Domain/GeoJSON/Geometry/MultiPolygon.d.ts +0 -7
  32. package/dist/Domain/GeoJSON/Geometry/Point.d.ts +0 -11
  33. package/dist/Domain/GeoJSON/Geometry/Polygon.d.ts +0 -11
  34. package/dist/Domain/GeoJSON/Geometry.d.ts +0 -9
  35. package/dist/Domain/GeoJSON/GeometryCollection.d.ts +0 -8
  36. package/dist/Domain/GeoJSON/GeometryObject.d.ts +0 -12
  37. package/dist/Domain/Guards/Number.d.ts +0 -3
  38. package/dist/Domain/Guards/Tuple.d.ts +0 -3
  39. package/dist/Domain/Iterator/IterablePair.d.ts +0 -32
  40. package/dist/Domain/Iterator/SimpleGeometry.d.ts +0 -90
  41. package/dist/Domain/Utility/Calculate.d.ts +0 -9
  42. package/dist/Domain/Utility/Distance.d.ts +0 -3
  43. package/dist/Domain/Utility/Intersect.d.ts +0 -2
  44. package/dist/Domain/Utility/Segments.d.ts +0 -2
  45. package/dist/Domain/Utility/Winding.d.ts +0 -3
  46. package/dist/geojson.cjs.js +0 -655
  47. package/dist/geojson.cjs.min.js +0 -1
  48. package/dist/geojson.es.js +0 -627
  49. package/dist/geojson.es.min.js +0 -1
  50. package/dist/geojson.js +0 -660
  51. package/dist/geojson.min.js +0 -1
  52. package/rollup.config.mjs +0 -43
  53. package/source/Domain/Constants.ts +0 -5
  54. package/source/Domain/GeoJSON/Concept/Altitude.ts +0 -9
  55. package/source/Domain/GeoJSON/Concept/BoundingBox.ts +0 -31
  56. package/source/Domain/GeoJSON/Concept/ExteriorRing.ts +0 -12
  57. package/source/Domain/GeoJSON/Concept/GeoJSONObject.ts +0 -23
  58. package/source/Domain/GeoJSON/Concept/InteriorRing.ts +0 -12
  59. package/source/Domain/GeoJSON/Concept/Latitude.ts +0 -7
  60. package/source/Domain/GeoJSON/Concept/LinearRing.ts +0 -14
  61. package/source/Domain/GeoJSON/Concept/Longitude.ts +0 -7
  62. package/source/Domain/GeoJSON/Concept/Position.ts +0 -18
  63. package/source/Domain/GeoJSON/Feature.ts +0 -24
  64. package/source/Domain/GeoJSON/FeatureCollection.ts +0 -16
  65. package/source/Domain/GeoJSON/GeoJSON.ts +0 -9
  66. package/source/Domain/GeoJSON/Geometry/LineString.ts +0 -12
  67. package/source/Domain/GeoJSON/Geometry/MultiLineString.ts +0 -9
  68. package/source/Domain/GeoJSON/Geometry/MultiPoint.ts +0 -10
  69. package/source/Domain/GeoJSON/Geometry/MultiPolygon.ts +0 -9
  70. package/source/Domain/GeoJSON/Geometry/Point.ts +0 -12
  71. package/source/Domain/GeoJSON/Geometry/Polygon.ts +0 -20
  72. package/source/Domain/GeoJSON/Geometry.ts +0 -11
  73. package/source/Domain/GeoJSON/GeometryCollection.ts +0 -23
  74. package/source/Domain/GeoJSON/GeometryObject.ts +0 -20
  75. package/source/Domain/Guards/Number.ts +0 -13
  76. package/source/Domain/Guards/Tuple.ts +0 -6
  77. package/source/Domain/Guards/Utility.ts +0 -1
  78. package/source/Domain/Iterator/IterablePair.ts +0 -47
  79. package/source/Domain/Iterator/SimpleGeometry.ts +0 -137
  80. package/source/Domain/Utility/Calculate.ts +0 -143
  81. package/source/Domain/Utility/Distance.ts +0 -56
  82. package/source/Domain/Utility/Intersect.ts +0 -42
  83. package/source/Domain/Utility/Numeric.ts +0 -8
  84. package/source/Domain/Utility/Segments.ts +0 -5
  85. package/source/Domain/Utility/Winding.ts +0 -19
  86. package/source/main.ts +0 -20
  87. package/test/Domain/GeoJSON/Concept/Altitude.ts +0 -58
  88. package/test/Domain/GeoJSON/Concept/BoundingBox.ts +0 -77
  89. package/test/Domain/GeoJSON/Concept/ExteriorRing.ts +0 -65
  90. package/test/Domain/GeoJSON/Concept/GeoJSONObject.ts +0 -56
  91. package/test/Domain/GeoJSON/Concept/InteriorRing.ts +0 -65
  92. package/test/Domain/GeoJSON/Concept/Latitude.ts +0 -56
  93. package/test/Domain/GeoJSON/Concept/LinearRing.ts +0 -63
  94. package/test/Domain/GeoJSON/Concept/Longitude.ts +0 -56
  95. package/test/Domain/GeoJSON/Concept/Position.ts +0 -56
  96. package/test/Domain/GeoJSON/Feature.ts +0 -9
  97. package/test/Domain/GeoJSON/FeatureCollection.ts +0 -9
  98. package/test/Domain/GeoJSON/GeoJSON.ts +0 -21
  99. package/test/Domain/GeoJSON/Geometry/LineString.ts +0 -11
  100. package/test/Domain/GeoJSON/Geometry/MultiLineString.ts +0 -11
  101. package/test/Domain/GeoJSON/Geometry/MultiPoint.ts +0 -11
  102. package/test/Domain/GeoJSON/Geometry/MultiPolygon.ts +0 -11
  103. package/test/Domain/GeoJSON/Geometry/Point.ts +0 -11
  104. package/test/Domain/GeoJSON/Geometry/Polygon.ts +0 -11
  105. package/test/Domain/GeoJSON/Geometry.ts +0 -9
  106. package/test/Domain/GeoJSON/GeometryCollection.ts +0 -9
  107. package/test/Domain/GeoJSON/GeometryObject.ts +0 -4
  108. package/test/Domain/Guards/Number.ts +0 -49
  109. package/test/Domain/Guards/Tuple.ts +0 -27
  110. package/test/Domain/Iterator/IterablePair.ts +0 -203
  111. package/test/Domain/Iterator/SimpleGeometry.ts +0 -195
  112. package/test/Domain/Utility/Calculate.ts +0 -178
  113. package/test/Domain/Utility/Distance.ts +0 -19
  114. package/test/Domain/Utility/Intersect.ts +0 -54
  115. package/test/Domain/Utility/Numeric.ts +0 -30
  116. package/test/Domain/Utility/Winding.ts +0 -52
  117. package/test/README.ts +0 -123
  118. package/test/data/Distance.ts +0 -51
  119. package/test/data/HolySee.ts +0 -74
  120. package/test/data/Intersect.ts +0 -300
  121. package/test/data/Italy.ts +0 -2883
  122. package/test/data/SanMarino.ts +0 -83
  123. package/test/data/Shapes.ts +0 -107
  124. package/test/helper/geometry.ts +0 -76
  125. package/test/helper/malform.ts +0 -82
  126. package/test/main.ts +0 -4
  127. package/tsconfig.json +0 -12
package/README.md CHANGED
@@ -33,7 +33,7 @@ The `isStrict*` variants of the type guards also validate the following:
33
33
  - `Latitude` is a number in the range (inclusive) `-90..90`
34
34
  - `Altitude` is a number in the range (inclusive) `-6371008.7714..20180000` (Earth center(-ish) up to the GPS satelite distance)
35
35
  - `Polygon` "LinearRing" are closed (first and last `Position` are identical)
36
- - `Polygon` "LinearRing" have the correct winding (counterclockwise for exterior rings (outline), clockwise for interior rings (holes))
36
+ - ~~`Polygon` "LinearRing" have the correct winding (counterclockwise for exterior rings (outline), clockwise for interior rings (holes))~~ _(not yet enforced — planned for v2)_
37
37
 
38
38
 
39
39
  | type | guard | strict guard | description |
@@ -107,7 +107,7 @@ import { distance, Feature } from '@konfirm/geojson';
107
107
  const a: Feature = {
108
108
  type: 'Feature',
109
109
  properties: {
110
- name: 'Schiphol Airpoirt, Amsterdam',
110
+ name: 'Schiphol Airport, Amsterdam',
111
111
  },
112
112
  geometry: {
113
113
  type: 'Point',
@@ -125,15 +125,15 @@ import { distance, Feature } from '@konfirm/geojson';
125
125
  },
126
126
  };
127
127
 
128
- console.log(distance(a, b)); // 8829424.604594177
129
- console.log(distance(a, b, 'direct'); // 8829424.604594177 ('direct' is the default)
130
- console.log(distance(a, b, 'haversine'); // 5847546.425707642
131
- console.log(distance(a, b, 'vincenty'); // 5863355.371234315
128
+ console.log(distance(a, b)); // 8829424.604594177 ('cartesian' is the default)
129
+ console.log(distance(a, b, 'cartesian')); // 8829424.604594177
130
+ console.log(distance(a, b, 'haversine')); // 5847546.425707642
131
+ console.log(distance(a, b, 'vincenty')); // 5863355.371234315
132
132
  ```
133
133
 
134
134
  ### SimpleGeometryIterator
135
135
 
136
- The SimpleGeometryIterator class is a convenience helper utility which yeilds all simple Geometric shapes (`Point`, `LineString`, `Polygon`) from any GeoJSON object. Using a SimpleGeometryIterator allows you to focus on just implementing logic for the simple Geometric shapes whilst supporting any compbination of GeoJSON objects as input.
136
+ The SimpleGeometryIterator class is a convenience helper utility which yields all simple Geometric shapes (`Point`, `LineString`, `Polygon`) from any GeoJSON object. Using a SimpleGeometryIterator allows you to focus on just implementing logic for the simple Geometric shapes whilst supporting any combination of GeoJSON objects as input.
137
137
 
138
138
  | input type | yields type(s) | description |
139
139
  | -------------------- | ---------------------------------- | ---------------------------------------------------------------------------------------- |
@@ -1,12 +1,15 @@
1
1
  import * as _konfirm_guard from '@konfirm/guard';
2
+ import { Guard } from '@konfirm/guard';
2
3
 
3
- type Guard<T> = (value: any) => value is T;
4
-
5
- type Longitude = number;
4
+ type Altitude = number;
6
5
 
7
6
  type Latitude = number;
8
7
 
9
- type Altitude = number;
8
+ type Longitude = number;
9
+
10
+ type Position = [Longitude, Latitude, Altitude?];
11
+ declare const isPosition: _konfirm_guard.Guard<Position>;
12
+ declare const isStrictPosition: _konfirm_guard.Guard<Position>;
10
13
 
11
14
  type BoundingBox = [Longitude, Latitude, Altitude, Longitude, Latitude, Altitude] | [Longitude, Latitude, Longitude, Latitude];
12
15
 
@@ -17,10 +20,6 @@ type GeoJSONBase = {
17
20
  };
18
21
  type GeoJSONObject<T extends GeoJSONBase = GeoJSONBase> = GeoJSONBase & T;
19
22
 
20
- type Position = [Longitude, Latitude, Altitude?];
21
- declare const isPosition: _konfirm_guard.Guard<Position>;
22
- declare const isStrictPosition: _konfirm_guard.Guard<Position>;
23
-
24
23
  type GeometryBase = GeoJSONObject & {
25
24
  coordinates: Array<unknown>;
26
25
  };
@@ -38,8 +37,8 @@ declare const isPoint: Guard<Point>;
38
37
  declare const isStrictPoint: Guard<Point>;
39
38
 
40
39
  type MultiPoint = MultiGeometryObject<Point>;
41
- declare const isMultiPoint: _konfirm_guard.Guard<MultiPoint>;
42
- declare const isStrictMultiPoint: _konfirm_guard.Guard<MultiPoint>;
40
+ declare const isMultiPoint: Guard<MultiPoint>;
41
+ declare const isStrictMultiPoint: Guard<MultiPoint>;
43
42
 
44
43
  type LineString = GeometryObject<{
45
44
  type: 'LineString';
@@ -77,8 +76,8 @@ type GeometryCollection = GeoJSONObject<{
77
76
  type: 'GeometryCollection';
78
77
  geometries: Array<Geometry | GeometryCollection>;
79
78
  }>;
80
- declare function isGeometryCollection(value: any): value is GeometryCollection;
81
- declare function isStrictGeometryCollection(value: any): value is GeometryCollection;
79
+ declare function isGeometryCollection(value: unknown): value is GeometryCollection;
80
+ declare function isStrictGeometryCollection(value: unknown): value is GeometryCollection;
82
81
 
83
82
  type Feature = GeoJSONObject<{
84
83
  type: 'Feature';
@@ -101,12 +100,6 @@ type GeoJSON = Geometry | GeometryCollection | Feature | FeatureCollection;
101
100
  declare const isGeoJSON: _konfirm_guard.Guard<GeoJSON>;
102
101
  declare const isStrictGeoJSON: _konfirm_guard.Guard<GeoJSON>;
103
102
 
104
- declare function intersect(a: GeoJSON, b: GeoJSON): boolean;
105
-
106
- type PointToPointCalculation = 'cartesian' | 'haversine' | 'vincenty' | ((a: Point['coordinates'], b: Point['coordinates']) => number);
107
-
108
- declare function distance(a: GeoJSON, b: GeoJSON, calculation?: PointToPointCalculation): number;
109
-
110
103
  type SimpleGeometry = Point | LineString | Polygon;
111
104
  /**
112
105
  * Iterator class to turn any GeoJSON structure into one or more SimpleGeometry (Point | LineString | Polygon) objects
@@ -116,12 +109,6 @@ type SimpleGeometry = Point | LineString | Polygon;
116
109
  */
117
110
  declare class SimpleGeometryIterator {
118
111
  private readonly inputs;
119
- /**
120
- * Creates an instance of SimpleGeometryIterator
121
- *
122
- * @param {...[GeoJSON, ...Array<GeoJSON>]} inputs
123
- * @memberof SimpleGeometryIterator
124
- */
125
112
  constructor(...inputs: [GeoJSON, ...Array<GeoJSON>]);
126
113
  /**
127
114
  * Generator yielding all SimpleGeometry objects from the provided GeoJSON structure(s)
@@ -139,60 +126,12 @@ declare class SimpleGeometryIterator {
139
126
  * @memberof SimpleGeometryIterator
140
127
  */
141
128
  private unwrap;
142
- /**
143
- * Generate the geometries in a GeometryCollection
144
- *
145
- * @private
146
- * @param {GeometryCollection} { geometries }
147
- * @return {*} {Iterable<SimpleGeometry>}
148
- * @memberof SimpleGeometryIterator
149
- */
150
- private GeometryCollection;
151
- /**
152
- * Generate the geometries of the Feature object(s) in a FeatureCollection
153
- *
154
- * @private
155
- * @param {FeatureCollection} { features }
156
- * @return {*} {Iterable<SimpleGeometry>}
157
- * @memberof SimpleGeometryIterator
158
- */
159
- private FeatureCollection;
160
- /**
161
- * Generate the geometry of a Feature object
162
- *
163
- * @private
164
- * @param {Feature} { geometry }
165
- * @return {*} {Iterable<SimpleGeometry>}
166
- * @memberof SimpleGeometryIterator
167
- */
168
- private Feature;
169
- /**
170
- * Generate Point objects from a MultiPoint object
171
- *
172
- * @private
173
- * @param {MultiPoint} multi
174
- * @return {*} {Iterable<Point>}
175
- * @memberof SimpleGeometryIterator
176
- */
177
- private MultiPoint;
178
- /**
179
- * Generate LineString objects from a MultiLineString object
180
- *
181
- * @private
182
- * @param {MultiLineString} multi
183
- * @return {*} {Iterable<LineString>}
184
- * @memberof SimpleGeometryIterator
185
- */
186
- private MultiLineString;
187
- /**
188
- * Generate Polygon objects from a MultiPolygon object
189
- *
190
- * @private
191
- * @param {MultiPolygon} multi
192
- * @return {*} {Iterable<Polygon>}
193
- * @memberof SimpleGeometryIterator
194
- */
195
- private MultiPolygon;
196
129
  }
197
130
 
198
- export { Feature, FeatureCollection, GeoJSON, Geometry, GeometryCollection, LineString, MultiLineString, MultiPoint, MultiPolygon, Point, Polygon, Position, SimpleGeometryIterator, distance, intersect, isFeature, isFeatureCollection, isGeoJSON, isGeometry, isGeometryCollection, isLineString, isMultiLineString, isMultiPoint, isMultiPolygon, isPoint, isPolygon, isPosition, isStrictFeature, isStrictFeatureCollection, isStrictGeoJSON, isStrictGeometry, isStrictGeometryCollection, isStrictLineString, isStrictMultiLineString, isStrictMultiPoint, isStrictMultiPolygon, isStrictPoint, isStrictPolygon, isStrictPosition };
131
+ type PointToPointCalculation = 'cartesian' | 'haversine' | 'vincenty' | ((a: Point['coordinates'], b: Point['coordinates']) => number);
132
+
133
+ declare function distance(a: GeoJSON, b: GeoJSON, calculation?: PointToPointCalculation): number;
134
+
135
+ declare function intersect(a: GeoJSON, b: GeoJSON): boolean;
136
+
137
+ export { type Feature, type FeatureCollection, type GeoJSON, type Geometry, type GeometryCollection, type LineString, type MultiLineString, type MultiPoint, type MultiPolygon, type Point, type Polygon, type Position, SimpleGeometryIterator, distance, intersect, isFeature, isFeatureCollection, isGeoJSON, isGeometry, isGeometryCollection, isLineString, isMultiLineString, isMultiPoint, isMultiPolygon, isPoint, isPolygon, isPosition, isStrictFeature, isStrictFeatureCollection, isStrictGeoJSON, isStrictGeometry, isStrictGeometryCollection, isStrictLineString, isStrictMultiLineString, isStrictMultiPoint, isStrictMultiPolygon, isStrictPoint, isStrictPolygon, isStrictPosition };
package/dist/main.d.ts CHANGED
@@ -1,15 +1,137 @@
1
- export { intersect } from './Domain/Utility/Intersect';
2
- export { distance } from './Domain/Utility/Distance';
3
- export { SimpleGeometryIterator } from './Domain/Iterator/SimpleGeometry';
4
- export { Position, isPosition, isStrictPosition } from './Domain/GeoJSON/Concept/Position';
5
- export { Point, isPoint, isStrictPoint } from './Domain/GeoJSON/Geometry/Point';
6
- export { MultiPoint, isMultiPoint, isStrictMultiPoint } from './Domain/GeoJSON/Geometry/MultiPoint';
7
- export { LineString, isLineString, isStrictLineString } from './Domain/GeoJSON/Geometry/LineString';
8
- export { MultiLineString, isMultiLineString, isStrictMultiLineString } from './Domain/GeoJSON/Geometry/MultiLineString';
9
- export { Polygon, isPolygon, isStrictPolygon } from './Domain/GeoJSON/Geometry/Polygon';
10
- export { MultiPolygon, isMultiPolygon, isStrictMultiPolygon } from './Domain/GeoJSON/Geometry/MultiPolygon';
11
- export { GeometryCollection, isGeometryCollection, isStrictGeometryCollection } from './Domain/GeoJSON/GeometryCollection';
12
- export { Geometry, isGeometry, isStrictGeometry } from './Domain/GeoJSON/Geometry';
13
- export { Feature, isFeature, isStrictFeature } from './Domain/GeoJSON/Feature';
14
- export { FeatureCollection, isFeatureCollection, isStrictFeatureCollection } from './Domain/GeoJSON/FeatureCollection';
15
- export { GeoJSON, isGeoJSON, isStrictGeoJSON } from './Domain/GeoJSON/GeoJSON';
1
+ import * as _konfirm_guard from '@konfirm/guard';
2
+ import { Guard } from '@konfirm/guard';
3
+
4
+ type Altitude = number;
5
+
6
+ type Latitude = number;
7
+
8
+ type Longitude = number;
9
+
10
+ type Position = [Longitude, Latitude, Altitude?];
11
+ declare const isPosition: _konfirm_guard.Guard<Position>;
12
+ declare const isStrictPosition: _konfirm_guard.Guard<Position>;
13
+
14
+ type BoundingBox = [Longitude, Latitude, Altitude, Longitude, Latitude, Altitude] | [Longitude, Latitude, Longitude, Latitude];
15
+
16
+ type GeoJSONBase = {
17
+ type: string;
18
+ bbox?: BoundingBox;
19
+ [key: string]: unknown;
20
+ };
21
+ type GeoJSONObject<T extends GeoJSONBase = GeoJSONBase> = GeoJSONBase & T;
22
+
23
+ type GeometryBase = GeoJSONObject & {
24
+ coordinates: Array<unknown>;
25
+ };
26
+ type GeometryObject<T extends GeometryBase> = Omit<GeometryBase, 'coordinates'> & T;
27
+ type MultiGeometryObject<T extends GeometryBase> = GeometryObject<{
28
+ type: `Multi${T['type']}`;
29
+ coordinates: Array<T['coordinates']>;
30
+ }>;
31
+
32
+ type Point = GeometryObject<{
33
+ type: 'Point';
34
+ coordinates: Position;
35
+ }>;
36
+ declare const isPoint: Guard<Point>;
37
+ declare const isStrictPoint: Guard<Point>;
38
+
39
+ type MultiPoint = MultiGeometryObject<Point>;
40
+ declare const isMultiPoint: Guard<MultiPoint>;
41
+ declare const isStrictMultiPoint: Guard<MultiPoint>;
42
+
43
+ type LineString = GeometryObject<{
44
+ type: 'LineString';
45
+ coordinates: MultiPoint['coordinates'];
46
+ }>;
47
+ declare const isLineString: Guard<LineString>;
48
+ declare const isStrictLineString: Guard<LineString>;
49
+
50
+ type MultiLineString = MultiGeometryObject<LineString>;
51
+ declare const isMultiLineString: _konfirm_guard.Guard<MultiLineString>;
52
+ declare const isStrictMultiLineString: _konfirm_guard.Guard<MultiLineString>;
53
+
54
+ type LinearRing = Array<Position>;
55
+
56
+ type ExteriorRing = LinearRing;
57
+
58
+ type InteriorRing = LinearRing;
59
+
60
+ type Polygon = GeometryObject<{
61
+ type: 'Polygon';
62
+ coordinates: [ExteriorRing, ...Array<InteriorRing>];
63
+ }>;
64
+ declare const isPolygon: _konfirm_guard.Guard<Polygon>;
65
+ declare const isStrictPolygon: _konfirm_guard.Guard<Polygon>;
66
+
67
+ type MultiPolygon = MultiGeometryObject<Polygon>;
68
+ declare const isMultiPolygon: _konfirm_guard.Guard<MultiPolygon>;
69
+ declare const isStrictMultiPolygon: _konfirm_guard.Guard<MultiPolygon>;
70
+
71
+ type Geometry = Point | MultiPoint | LineString | MultiLineString | Polygon | MultiPolygon;
72
+ declare const isGeometry: _konfirm_guard.Guard<Geometry>;
73
+ declare const isStrictGeometry: _konfirm_guard.Guard<Geometry>;
74
+
75
+ type GeometryCollection = GeoJSONObject<{
76
+ type: 'GeometryCollection';
77
+ geometries: Array<Geometry | GeometryCollection>;
78
+ }>;
79
+ declare function isGeometryCollection(value: unknown): value is GeometryCollection;
80
+ declare function isStrictGeometryCollection(value: unknown): value is GeometryCollection;
81
+
82
+ type Feature = GeoJSONObject<{
83
+ type: 'Feature';
84
+ geometry: Geometry | GeometryCollection;
85
+ properties: {
86
+ [key: string]: unknown;
87
+ } | null;
88
+ }>;
89
+ declare const isFeature: _konfirm_guard.Guard<Feature>;
90
+ declare const isStrictFeature: _konfirm_guard.Guard<Feature>;
91
+
92
+ type FeatureCollection = GeoJSONObject<{
93
+ type: 'FeatureCollection';
94
+ features: Array<Feature>;
95
+ }>;
96
+ declare const isFeatureCollection: _konfirm_guard.Guard<FeatureCollection>;
97
+ declare const isStrictFeatureCollection: _konfirm_guard.Guard<FeatureCollection>;
98
+
99
+ type GeoJSON = Geometry | GeometryCollection | Feature | FeatureCollection;
100
+ declare const isGeoJSON: _konfirm_guard.Guard<GeoJSON>;
101
+ declare const isStrictGeoJSON: _konfirm_guard.Guard<GeoJSON>;
102
+
103
+ type SimpleGeometry = Point | LineString | Polygon;
104
+ /**
105
+ * Iterator class to turn any GeoJSON structure into one or more SimpleGeometry (Point | LineString | Polygon) objects
106
+ *
107
+ * @export
108
+ * @class SimpleGeometryIterator
109
+ */
110
+ declare class SimpleGeometryIterator {
111
+ private readonly inputs;
112
+ constructor(...inputs: [GeoJSON, ...Array<GeoJSON>]);
113
+ /**
114
+ * Generator yielding all SimpleGeometry objects from the provided GeoJSON structure(s)
115
+ *
116
+ * @return {*} {Iterator<SimpleGeometry>}
117
+ * @memberof SimpleGeometryIterator
118
+ */
119
+ [Symbol.iterator](): Iterator<SimpleGeometry>;
120
+ /**
121
+ * unwrap any GeoJSON object into one or more SimpleGeometry object
122
+ *
123
+ * @private
124
+ * @param {GeoJSON} geo
125
+ * @return {*} {Iterable<SimpleGeometry>}
126
+ * @memberof SimpleGeometryIterator
127
+ */
128
+ private unwrap;
129
+ }
130
+
131
+ type PointToPointCalculation = 'cartesian' | 'haversine' | 'vincenty' | ((a: Point['coordinates'], b: Point['coordinates']) => number);
132
+
133
+ declare function distance(a: GeoJSON, b: GeoJSON, calculation?: PointToPointCalculation): number;
134
+
135
+ declare function intersect(a: GeoJSON, b: GeoJSON): boolean;
136
+
137
+ export { type Feature, type FeatureCollection, type GeoJSON, type Geometry, type GeometryCollection, type LineString, type MultiLineString, type MultiPoint, type MultiPolygon, type Point, type Polygon, type Position, SimpleGeometryIterator, distance, intersect, isFeature, isFeatureCollection, isGeoJSON, isGeometry, isGeometryCollection, isLineString, isMultiLineString, isMultiPoint, isMultiPolygon, isPoint, isPolygon, isPosition, isStrictFeature, isStrictFeatureCollection, isStrictGeoJSON, isStrictGeometry, isStrictGeometryCollection, isStrictLineString, isStrictMultiLineString, isStrictMultiPoint, isStrictMultiPolygon, isStrictPoint, isStrictPolygon, isStrictPosition };