@@ -30,3 +30,206 @@ export namespace firestore {
30
30
firestore ?( ) : types . FirebaseFirestore ;
31
31
}
32
32
}
33
+
34
+ /// GEOJSON
35
+
36
+ // Type definitions for geojson 7946.0
37
+ // Project: https://geojson.org/
38
+ // Definitions by: Jacob Bruun <https://github.com/cobster>
39
+ // Arne Schubert <https://github.com/atd-schubert>
40
+ // Jeff Jacobson <https://github.com/JeffJacobson>
41
+ // Ilia Choly <https://github.com/icholy>
42
+ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
43
+ // TypeScript Version: 2.3
44
+
45
+ // Note: as of the RFC 7946 version of GeoJSON, Coordinate Reference Systems
46
+ // are no longer supported. (See https://tools.ietf.org/html/rfc7946#appendix-B) }
47
+
48
+ /**
49
+ * The valid values for the "type" property of GeoJSON geometry objects.
50
+ * https://tools.ietf.org/html/rfc7946#section-1.4
51
+ */
52
+ export type GeoJsonGeometryTypes =
53
+ | 'Point'
54
+ | 'LineString'
55
+ | 'MultiPoint'
56
+ | 'Polygon'
57
+ | 'MultiLineString'
58
+ | 'MultiPolygon'
59
+ | 'GeometryCollection' ;
60
+
61
+ /**
62
+ * The value values for the "type" property of GeoJSON Objects.
63
+ * https://tools.ietf.org/html/rfc7946#section-1.4
64
+ */
65
+ export type GeoJsonTypes =
66
+ | 'FeatureCollection'
67
+ | 'Feature'
68
+ | GeoJsonGeometryTypes ;
69
+
70
+ /**
71
+ * Bounding box
72
+ * https://tools.ietf.org/html/rfc7946#section-5
73
+ */
74
+ export type BBox =
75
+ | [ number , number , number , number ]
76
+ | [ number , number , number , number , number , number ] ;
77
+
78
+ /**
79
+ * A Position is an array of coordinates.
80
+ * https://tools.ietf.org/html/rfc7946#section-3.1.1
81
+ * Array should contain between two and three elements.
82
+ * The previous GeoJSON specification allowed more elements (e.g., which could be used to represent M values),
83
+ * but the current specification only allows X, Y, and (optionally) Z to be defined.
84
+ */
85
+ export type Position = number [ ] ; // [number, number] | [number, number, number];
86
+
87
+ /**
88
+ * The base GeoJSON object.
89
+ * https://tools.ietf.org/html/rfc7946#section-3
90
+ * The GeoJSON specification also allows foreign members
91
+ * (https://tools.ietf.org/html/rfc7946#section-6.1)
92
+ * Developers should use "&" type in TypeScript or extend the interface
93
+ * to add these foreign members.
94
+ */
95
+ export interface GeoJsonObject {
96
+ // Don't include foreign members directly into this type def.
97
+ // in order to preserve type safety.
98
+ // [key: string]: any;
99
+ /**
100
+ * Specifies the type of GeoJSON object.
101
+ */
102
+ type : GeoJsonTypes ;
103
+ /**
104
+ * Bounding box of the coordinate range of the object's Geometries, Features, or Feature Collections.
105
+ * https://tools.ietf.org/html/rfc7946#section-5
106
+ */
107
+ bbox ?: BBox ;
108
+ }
109
+
110
+ /**
111
+ * Union of GeoJSON objects.
112
+ */
113
+ export type GeoJSON = Geometry | Feature | FeatureCollection ;
114
+
115
+ /**
116
+ * A geometry object.
117
+ * https://tools.ietf.org/html/rfc7946#section-3
118
+ */
119
+ export interface GeometryObject extends GeoJsonObject {
120
+ type : GeoJsonGeometryTypes ;
121
+ }
122
+
123
+ /**
124
+ * Union of geometry objects.
125
+ * https://tools.ietf.org/html/rfc7946#section-3
126
+ */
127
+ export type Geometry =
128
+ | Point
129
+ | MultiPoint
130
+ | LineString
131
+ | MultiLineString
132
+ | Polygon
133
+ | MultiPolygon
134
+ | GeometryCollection ;
135
+
136
+ /**
137
+ * Point geometry object.
138
+ * https://tools.ietf.org/html/rfc7946#section-3.1.2
139
+ */
140
+ export interface Point extends GeometryObject {
141
+ type : 'Point' ;
142
+ coordinates : Position ;
143
+ }
144
+
145
+ /**
146
+ * MultiPoint geometry object.
147
+ * https://tools.ietf.org/html/rfc7946#section-3.1.3
148
+ */
149
+ export interface MultiPoint extends GeometryObject {
150
+ type : 'MultiPoint' ;
151
+ coordinates : Position [ ] ;
152
+ }
153
+
154
+ /**
155
+ * LineString geometry object.
156
+ * https://tools.ietf.org/html/rfc7946#section-3.1.4
157
+ */
158
+ export interface LineString extends GeometryObject {
159
+ type : 'LineString' ;
160
+ coordinates : Position [ ] ;
161
+ }
162
+
163
+ /**
164
+ * MultiLineString geometry object.
165
+ * https://tools.ietf.org/html/rfc7946#section-3.1.5
166
+ */
167
+ export interface MultiLineString extends GeometryObject {
168
+ type : 'MultiLineString' ;
169
+ coordinates : Position [ ] [ ] ;
170
+ }
171
+
172
+ /**
173
+ * Polygon geometry object.
174
+ * https://tools.ietf.org/html/rfc7946#section-3.1.6
175
+ */
176
+ export interface Polygon extends GeometryObject {
177
+ type : 'Polygon' ;
178
+ coordinates : Position [ ] [ ] ;
179
+ }
180
+
181
+ /**
182
+ * MultiPolygon geometry object.
183
+ * https://tools.ietf.org/html/rfc7946#section-3.1.7
184
+ */
185
+ export interface MultiPolygon extends GeometryObject {
186
+ type : 'MultiPolygon' ;
187
+ coordinates : Position [ ] [ ] [ ] ;
188
+ }
189
+
190
+ /**
191
+ * Geometry Collection
192
+ * https://tools.ietf.org/html/rfc7946#section-3.1.8
193
+ */
194
+ export interface GeometryCollection extends GeometryObject {
195
+ type : 'GeometryCollection' ;
196
+ geometries : Geometry [ ] ;
197
+ }
198
+
199
+ export type GeoJsonProperties = { [ name : string ] : any } | null ;
200
+
201
+ /**
202
+ * A feature object which contains a geometry and associated properties.
203
+ * https://tools.ietf.org/html/rfc7946#section-3.2
204
+ */
205
+ export interface Feature <
206
+ G extends GeometryObject | null = Geometry ,
207
+ P = GeoJsonProperties
208
+ > extends GeoJsonObject {
209
+ type : 'Feature' ;
210
+ /**
211
+ * The feature's geometry
212
+ */
213
+ geometry : G ;
214
+ /**
215
+ * A value that uniquely identifies this feature in a
216
+ * https://tools.ietf.org/html/rfc7946#section-3.2.
217
+ */
218
+ id ?: string | number ;
219
+ /**
220
+ * Properties associated with this feature.
221
+ */
222
+ properties : P ;
223
+ }
224
+
225
+ /**
226
+ * A collection of feature objects.
227
+ * https://tools.ietf.org/html/rfc7946#section-3.3
228
+ */
229
+ export interface FeatureCollection <
230
+ G extends GeometryObject | null = Geometry ,
231
+ P = GeoJsonProperties
232
+ > extends GeoJsonObject {
233
+ type : 'FeatureCollection' ;
234
+ features : Array < Feature < G , P > > ;
235
+ }
0 commit comments