@tmcw/togeojson 5.6.2 → 5.8.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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,432 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
+
5
+ ### [5.6.2](https://github.com/placemark/togeojson/compare/v5.6.1...v5.6.2) (2023-05-30)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * Zero elevation data in GPX should still be included ([6457106](https://github.com/placemark/togeojson/commit/6457106b98f174d7b3d1299748168351ae649696))
11
+
12
+ ### [5.6.1](https://github.com/placemark/togeojson/compare/v5.6.0...v5.6.1) (2023-05-05)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * adds types definitions to exports in package.json ([#109](https://github.com/placemark/togeojson/issues/109)) ([f382d30](https://github.com/placemark/togeojson/commit/f382d30126104433b203acc70e14d056f57df0d2))
18
+
19
+ ## [5.6.0](https://github.com/placemark/togeojson/compare/v5.5.0...v5.6.0) (2022-12-30)
20
+
21
+
22
+ ### Features
23
+
24
+ * Support LinearRing as direct descendent of a Placemark element ([#105](https://github.com/placemark/togeojson/issues/105)) ([3673a7f](https://github.com/placemark/togeojson/commit/3673a7fa4c7c2d8ed0403b94fb663654016200f7))
25
+
26
+
27
+ ### Bug Fixes
28
+
29
+ * Export F type ([#106](https://github.com/placemark/togeojson/issues/106)) ([c9870b2](https://github.com/placemark/togeojson/commit/c9870b27f5043f24effcc9dce89ce4f2c633ca60))
30
+
31
+ ## [5.5.0](https://github.com/placemark/togeojson/compare/v5.4.0...v5.5.0) (2022-11-12)
32
+
33
+
34
+ ### Features
35
+
36
+ * Add support for Schema tag and convert properties to correct datatype ([#100](https://github.com/placemark/togeojson/issues/100)) ([22479aa](https://github.com/placemark/togeojson/commit/22479aa3723d26f789561c1f4fb369fdc3be8085)), closes [#69](https://github.com/placemark/togeojson/issues/69)
37
+
38
+ ## [5.4.0](https://github.com/placemark/togeojson/compare/v5.3.0...v5.4.0) (2022-10-31)
39
+
40
+
41
+ ### Features
42
+
43
+ * Ground overlays ([#98](https://github.com/placemark/togeojson/issues/98)) ([43d357d](https://github.com/placemark/togeojson/commit/43d357db277db069caa2d543ba88f9f7ef862ad0))
44
+
45
+ ## [5.3.0](https://github.com/placemark/togeojson/compare/v5.2.1...v5.3.0) (2022-10-23)
46
+
47
+
48
+ ### Features
49
+
50
+ * Import visibility ([#94](https://github.com/placemark/togeojson/issues/94)) ([920c869](https://github.com/placemark/togeojson/commit/920c869f4233d5f0dba04e6ba7cbc5739d8cca86))
51
+
52
+
53
+ ### Bug Fixes
54
+
55
+ * properly support KMLs with sibling MultiGeometries ([#96](https://github.com/placemark/togeojson/issues/96)) ([f0e978a](https://github.com/placemark/togeojson/commit/f0e978a2932268cc5b1f9e023882a32d16fe6abd))
56
+
57
+ ### [5.2.2](https://github.com/placemark/togeojson/compare/v5.2.1...v5.2.2) (2022-08-09)
58
+
59
+ ### [5.2.1](https://github.com/placemarkio/togeojson/compare/v5.2.0...v5.2.1) (2022-06-15)
60
+
61
+
62
+ ### Bug Fixes
63
+
64
+ * Limit extracted coordinates to 3 ([#91](https://github.com/placemarkio/togeojson/issues/91)) ([b35d5a2](https://github.com/placemarkio/togeojson/commit/b35d5a2b21dfd392dee816f22caf4dd000aa6b91))
65
+
66
+ ## [5.2.0](https://github.com/placemarkio/togeojson/compare/v5.1.3...v5.2.0) (2022-06-12)
67
+
68
+
69
+ ### Features
70
+
71
+ * Handle HTML in description tags ([#90](https://github.com/placemarkio/togeojson/issues/90)) ([1d2dbfe](https://github.com/placemarkio/togeojson/commit/1d2dbfe160d6b998fd945d2c6194451a7928ed02))
72
+
73
+ ## [5.2.0-1](https://github.com/placemarkio/togeojson/compare/v5.2.0-0...v5.2.0-1) (2022-06-12)
74
+
75
+
76
+ ### Bug Fixes
77
+
78
+ * Fix typo ([4a9a57a](https://github.com/placemarkio/togeojson/commit/4a9a57a9cc6f9ec63a2df1cc2944dbb763a19b1c))
79
+
80
+ ## [5.2.0-0](https://github.com/placemarkio/togeojson/compare/v5.1.3...v5.2.0-0) (2022-06-12)
81
+
82
+
83
+ ### Features
84
+
85
+ * Handle HTML in description tags ([e156191](https://github.com/placemarkio/togeojson/commit/e156191780ba5618a63d6787ae481fd50bc0c075))
86
+
87
+ ### [5.1.3](https://github.com/placemarkio/togeojson/compare/v5.1.2...v5.1.3) (2022-05-22)
88
+
89
+
90
+ ### Bug Fixes
91
+
92
+ * Switch ESM entry point to use .mjs ending to fix Node.js native ESM support ([cd366b8](https://github.com/placemarkio/togeojson/commit/cd366b8b497a53803451221ebd8704d72e4c6e4a))
93
+
94
+ ### [5.1.3-0](https://github.com/placemarkio/togeojson/compare/v5.1.2...v5.1.3-0) (2022-05-22)
95
+
96
+ ### [5.1.2](https://github.com/placemarkio/togeojson/compare/v5.1.0...v5.1.2) (2022-04-24)
97
+
98
+
99
+ ### Bug Fixes
100
+
101
+ * Add fixtures, block invalid GPX inputs ([#80](https://github.com/placemarkio/togeojson/issues/80)) ([d57cd80](https://github.com/placemarkio/togeojson/commit/d57cd80757deb34e5442973f4ab44acb1d4660c8))
102
+
103
+ ### [5.1.1](https://github.com/placemarkio/togeojson/compare/v5.1.0...v5.1.1) (2022-04-24)
104
+
105
+
106
+ ### Bug Fixes
107
+
108
+ * Add fixtures, block invalid GPX inputs ([#80](https://github.com/placemarkio/togeojson/issues/80)) ([d57cd80](https://github.com/placemarkio/togeojson/commit/d57cd80757deb34e5442973f4ab44acb1d4660c8))
109
+
110
+ ## [5.1.0](https://github.com/placemarkio/togeojson/compare/v5.0.0...v5.1.0) (2022-04-23)
111
+
112
+
113
+ ### Features
114
+
115
+ * Translate hotspot units ([#79](https://github.com/placemarkio/togeojson/issues/79)) ([114dcea](https://github.com/placemarkio/togeojson/commit/114dceac3844e430d6d38ad24e77d85b0ecfc99b))
116
+
117
+ ## [5.0.0](https://github.com/placemarkio/togeojson/compare/v5.0.0-5...v5.0.0) (2022-04-22)
118
+
119
+
120
+ ### Bug Fixes
121
+
122
+ * Fix color extraction ([#77](https://github.com/placemarkio/togeojson/issues/77)) ([5712bc3](https://github.com/placemarkio/togeojson/commit/5712bc3f40a49e31a279643c102f832d4216797a))
123
+
124
+ ## [5.0.0-5](https://github.com/placemarkio/togeojson/compare/v5.0.0-4...v5.0.0-5) (2022-03-19)
125
+
126
+
127
+ ### Bug Fixes
128
+
129
+ * Folder structure fixes ([#72](https://github.com/placemarkio/togeojson/issues/72)) ([ef0e3fe](https://github.com/placemarkio/togeojson/commit/ef0e3fe4109e4d2b08ea9517f5866a760d806613))
130
+
131
+ ## [5.0.0-4](https://github.com/placemarkio/togeojson/compare/v5.0.0-3...v5.0.0-4) (2022-03-15)
132
+
133
+
134
+ ### Bug Fixes
135
+
136
+ * Allow meta object to contain new values ([6dd282e](https://github.com/placemarkio/togeojson/commit/6dd282e33755699dbc95b4455fe06fdfbe8692cb))
137
+
138
+ ## [5.0.0-3](https://github.com/placemarkio/togeojson/compare/v5.0.0-2...v5.0.0-3) (2022-03-15)
139
+
140
+
141
+ ### Bug Fixes
142
+
143
+ * Export Folder and Root types ([b9fa7f0](https://github.com/placemarkio/togeojson/commit/b9fa7f0827d8417addbaca76dc9f440495cc5336))
144
+
145
+ ## [5.0.0-2](https://github.com/placemarkio/togeojson/compare/v5.0.0-1...v5.0.0-2) (2022-03-14)
146
+
147
+ ## [5.0.0-1](https://github.com/placemarkio/togeojson/compare/v5.0.0-0...v5.0.0-1) (2022-03-14)
148
+
149
+ ## [5.0.0-0](https://github.com/tmcw/togeojson/compare/v4.8.0-0...v5.0.0-0) (2022-03-14)
150
+
151
+ ## [4.8.0-0](https://github.com/tmcw/togeojson/compare/v4.7.0...v4.8.0-0) (2022-03-14)
152
+
153
+
154
+ ### Features
155
+
156
+ * Folders and TypeScript ([6f36fd3](https://github.com/tmcw/togeojson/commit/6f36fd381798377909632eae11efef9e8b9be596))
157
+
158
+ ### [4.7.1-0](https://github.com/tmcw/togeojson/compare/v4.7.0...v4.7.1-0) (2022-03-09)
159
+
160
+ ## [4.7.0](https://github.com/tmcw/togeojson/compare/v4.6.1...v4.7.0) (2022-03-08)
161
+
162
+
163
+ ### Features
164
+
165
+ * Support gx:CascadingStyle ([600c542](https://github.com/tmcw/togeojson/commit/600c542b016684066fb31107c5896bedad0b5329))
166
+
167
+ ### [4.6.1](https://github.com/tmcw/togeojson/compare/v4.6.1-1...v4.6.1) (2022-03-07)
168
+
169
+ ### [4.6.1-1](https://github.com/tmcw/togeojson/compare/v4.6.1-0...v4.6.1-1) (2022-03-07)
170
+
171
+
172
+ ### Bug Fixes
173
+
174
+ * Typo ([9cb1ed0](https://github.com/tmcw/togeojson/commit/9cb1ed06ffcd60954c629838d0cc5ba8df3aa953))
175
+
176
+ ### [4.6.1-0](https://github.com/tmcw/togeojson/compare/v4.6.0...v4.6.1-0) (2022-03-07)
177
+
178
+
179
+ ### Bug Fixes
180
+
181
+ * Make module system more convoluted ([845ff7a](https://github.com/tmcw/togeojson/commit/845ff7a2c08220d8b87860231b262709d8db070a))
182
+
183
+ ## [4.6.0](https://github.com/tmcw/togeojson/compare/v4.5.0...v4.6.0) (2022-03-07)
184
+
185
+
186
+ ### Features
187
+
188
+ * Support additional GPX extensions ([ae2f00f](https://github.com/tmcw/togeojson/commit/ae2f00f685f5fd1e74b19864b0bba8211310d31a))
189
+
190
+ ## [4.5.0](https://github.com/tmcw/togeojson/compare/v4.4.1...v4.5.0) (2021-08-03)
191
+
192
+
193
+ ### Features
194
+
195
+ * Load TCX Courses ([#53](https://github.com/tmcw/togeojson/issues/53)) ([8924925](https://github.com/tmcw/togeojson/commit/89249255bd86d8c38e855f14b62fffad3f556abf))
196
+
197
+ ### [4.4.1](https://github.com/tmcw/togeojson/compare/v4.4.0...v4.4.1) (2021-04-27)
198
+
199
+
200
+ ### Bug Fixes
201
+
202
+ * Rename heartRates coordinate property to heart ([#48](https://github.com/tmcw/togeojson/issues/48)) ([8fc03f2](https://github.com/tmcw/togeojson/commit/8fc03f2a65ab01a53b81564f7ed6fac2a66452ad))
203
+
204
+ ## [4.4.0](https://github.com/tmcw/togeojson/compare/v4.3.0...v4.4.0) (2021-03-31)
205
+
206
+
207
+ ### Features
208
+
209
+ * Add coordinate properties for times and heartRates ([#47](https://github.com/tmcw/togeojson/issues/47)) ([5e3958b](https://github.com/tmcw/togeojson/commit/5e3958b18509a85eba4b9b78ef5095b01d7dc213))
210
+
211
+ ## [4.3.0](https://github.com/tmcw/togeojson/compare/v4.2.0...v4.3.0) (2020-12-28)
212
+
213
+
214
+ ### Features
215
+
216
+ * Add heartRates to geojson properties for tcx files ([#42](https://github.com/tmcw/togeojson/issues/42)) ([ecde092](https://github.com/tmcw/togeojson/commit/ecde09219abdb507527f70358a400c799b01c2d1))
217
+
218
+ ## [4.2.0](https://github.com/tmcw/togeojson/compare/v4.1.0...v4.2.0) (2020-09-05)
219
+
220
+
221
+ ### Features
222
+
223
+ * Preserve GPX linestring type in a _gpxType property that is either rte or trk ([54fa558](https://github.com/tmcw/togeojson/commit/54fa5581a99095f87ccfe937c6da539f6b7d9995))
224
+ * TCX Support ([6df0878](https://github.com/tmcw/togeojson/commit/6df087891dffa06474479b17fc0595110ff76b3e))
225
+
226
+ ## [4.1.0](https://github.com/tmcw/togeojson/compare/v4.0.0...v4.1.0) (2020-06-13)
227
+
228
+
229
+ ### Features
230
+
231
+ * Add LabelStyle support and complete IconStyle support for KML ([f920b16](https://github.com/tmcw/togeojson/commit/f920b16493a79b7d5370a940387ae77386a00771))
232
+
233
+ ## [4.0.0](https://github.com/tmcw/togeojson/compare/v3.2.0...v4.0.0) (2020-04-05)
234
+
235
+
236
+ ### ⚠ BREAKING CHANGES
237
+
238
+ * Previously, togeojson would ignore Placemarks that did not have
239
+ associated geometry. [Per the GeoJSON
240
+ specification](https://tools.ietf.org/html/rfc7946#section-3.2),
241
+ Feature objects can have null geometries. After this change, togeojson
242
+ will output features with null geometries as the translation of KML
243
+ Placemarks with no geometry, instead of ommitting those items entirely.
244
+
245
+ ## [3.2.0](https://github.com/tmcw/togeojson/compare/v3.1.0...v3.2.0) (2019-12-29)
246
+
247
+
248
+ ### Features
249
+
250
+ * add garmin extension handling ([2e95798](https://github.com/tmcw/togeojson/commit/2e9579839bc294ad08cf83127e498bc27749eb81))
251
+
252
+ <a name="3.1.0"></a>
253
+ # [3.1.0](https://github.com/tmcw/togeojson/compare/v3.0.1...v3.1.0) (2019-12-25)
254
+
255
+
256
+ ### Features
257
+
258
+ * Add parsing of GPX extensions speed, course, hAcc, vAcc ([#18](https://github.com/tmcw/togeojson/issues/18)) ([99301bd](https://github.com/tmcw/togeojson/commit/99301bd))
259
+
260
+
261
+
262
+ <a name="3.0.1"></a>
263
+ ## [3.0.1](https://github.com/tmcw/togeojson/compare/v3.0.0...v3.0.1) (2019-06-17)
264
+
265
+
266
+ ### Bug Fixes
267
+
268
+ * Typo in rollup configuration ([1af08f6](https://github.com/tmcw/togeojson/commit/1af08f6))
269
+
270
+
271
+
272
+ <a name="3.0.0"></a>
273
+ # [3.0.0](https://github.com/tmcw/togeojson/compare/v2.0.0...v3.0.0) (2019-03-28)
274
+
275
+
276
+ ### Code Refactoring
277
+
278
+ * switch from initializeArray to Array.fill ([#11](https://github.com/tmcw/togeojson/issues/11)) ([dac617a](https://github.com/tmcw/togeojson/commit/dac617a)), closes [#10](https://github.com/tmcw/togeojson/issues/10)
279
+
280
+
281
+ ### BREAKING CHANGES
282
+
283
+ * this may modify browser support if you’re using
284
+ an old browser. See the MDN page for full details:
285
+
286
+ https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/fill
287
+
288
+
289
+
290
+ <a name="2.0.0"></a>
291
+ # [2.0.0](https://github.com/tmcw/togeojson/compare/v1.0.0...v2.0.0) (2019-03-08)
292
+
293
+
294
+ ### Features
295
+
296
+ * Generator methods, removed CLI ([f37a30b](https://github.com/tmcw/togeojson/commit/f37a30b))
297
+
298
+
299
+ ### BREAKING CHANGES
300
+
301
+ * the cli that was previously installed along with togeojson has been removed, and will be installable as @tmcw/togeojson-cli
302
+
303
+ Other changes in this pass:
304
+
305
+ - Switch from microbundle to rollup to build
306
+ - Remove dependencies
307
+ - Remove reliance on XMLSerializer. This will make togeojson work in worker contexts.
308
+
309
+
310
+
311
+ <a name="1.0.0"></a>
312
+ # [1.0.0](https://github.com/tmcw/togeojson/compare/v1.0.0-alpha.1...v1.0.0) (2019-01-18)
313
+
314
+
315
+
316
+ <a name="1.0.0-alpha.1"></a>
317
+ # [1.0.0-alpha.1](https://github.com/tmcw/togeojson/compare/v1.0.0-alpha.0...v1.0.0-alpha.1) (2019-01-18)
318
+
319
+
320
+
321
+ <a name="1.0.0-alpha.0"></a>
322
+ # [1.0.0-alpha.0](https://github.com/tmcw/togeojson/compare/v0.16.0...v1.0.0-alpha.0) (2019-01-18)
323
+
324
+
325
+
326
+ ## 0.16.0
327
+
328
+ * Supports the `link` tag in GPX data.
329
+ * Supports the `type` tag for waypoints in GPX data.
330
+
331
+ ## 0.15.0
332
+
333
+ * Supports the `cmt` (comment) tag in GPX data.
334
+
335
+ ## 0.14.2
336
+
337
+ * Fixes a potential crash with QGIS-generated GPX files.
338
+
339
+ ## 0.14.0
340
+
341
+ * Now includes TimeStamp property from Placemarks, if it exists.
342
+
343
+ ## 0.13.0
344
+
345
+ * Added support for StyleMap elements in Google-flavored KML
346
+ * Improved test coverage
347
+ * Made `#` prefix for internal style references optional
348
+ * Uses `eslint` for code style uniformity
349
+
350
+ ## 0.12.2
351
+
352
+ * Fix `#` prefix on exported hex colors
353
+
354
+ ## 0.12.1
355
+
356
+ * Fix trackpoints with elevation=0 having their elevation skipped
357
+
358
+ ## 0.12.0
359
+
360
+ * Fix rte based GPX based tracks
361
+ * Add CDATA support to KML
362
+
363
+ ## 0.11.0
364
+
365
+ * Add heartrate support for GPX tracks
366
+ * Fix elevation support
367
+ * Fix test runner
368
+
369
+ ## 0.10.1
370
+
371
+ * Fix an IE9 error: IE9 'supports' `XMLSerializer` inasmuch as it will create
372
+ an instance that fails always and hard.
373
+
374
+ ## 0.10.0
375
+
376
+ * Encode timestamps along lines in GPX and KML as a `coordTimes` property.
377
+
378
+ ## 0.9.0
379
+
380
+ * Encode KML id attributes on Placemarks as GeoJSON Feature id properties.
381
+
382
+ ## 0.8.0
383
+
384
+ * Support for the `gx:Track` and `gx:MultiTrack` extensions to GPX
385
+
386
+ ## 0.7.0
387
+
388
+ * GPX conversion creates MultiLineString geometries when given multiple track segments.
389
+
390
+ ## 0.6.0
391
+
392
+ * Support for [simplestyle spec](https://github.com/mapbox/simplestyle-spec) 1.1.0
393
+ * Tests in [tape](https://github.com/substack/tape) rather than mocha/expect.js
394
+
395
+ ## 0.5.0
396
+
397
+ * Elevation values along linestrings and in points for GPX are now parsed
398
+ correctly into `Z` coordinate values in GeoJSON.
399
+
400
+ ## 0.4.2
401
+
402
+ * No longer bundles xmldom for browsers
403
+
404
+ ## 0.3.1
405
+
406
+ * Stricter check for browser versus browserify when requiring `xmldom`
407
+
408
+ ## 0.3.0
409
+
410
+ * Support for pipes and streams
411
+
412
+ ```sh
413
+ echo "LineString(0 0, 10 10)" | wellknown | tokml | togeojson > map.geojson
414
+ ```
415
+
416
+ ## 0.2.0
417
+
418
+ * Improve documentation
419
+ * Make style hashing on by default, remove options object
420
+
421
+ ## 0.1.1
422
+
423
+ * Fix global leak.
424
+
425
+ ## 0.1.0
426
+
427
+ * Comments
428
+ * GPX Support
429
+
430
+ ## 0.0.1
431
+
432
+ * Support GeometryCollections as themselves.
package/dist/index.d.ts CHANGED
@@ -33,6 +33,24 @@ declare function tcx(node: Document): FeatureCollection;
33
33
 
34
34
  declare type F = Feature<Geometry | null>;
35
35
 
36
+ /**
37
+ * Options to customize KML output.
38
+ *
39
+ * The only option currently
40
+ * is `skipNullGeometry`. Both the KML and GeoJSON formats support
41
+ * the idea of features that don't have geometries: in KML,
42
+ * this is a Placemark without a Point, etc element, and in GeoJSON
43
+ * it's a geometry member with a value of `null`.
44
+ *
45
+ * toGeoJSON, by default, translates null geometries in KML to
46
+ * null geometries in GeoJSON. For systems that use GeoJSON but
47
+ * don't support null geometries, you can specify `skipNullGeometry`
48
+ * to omit these features entirely and only include
49
+ * features that have a geometry defined.
50
+ */
51
+ interface KMLOptions {
52
+ skipNullGeometry?: boolean;
53
+ }
36
54
  /**
37
55
  * A folder including metadata. Folders
38
56
  * may contain other folders or features,
@@ -104,13 +122,13 @@ interface Root {
104
122
  * with a separate method to other features, depending
105
123
  * on which map framework you're using.
106
124
  */
107
- declare function kmlWithFolders(node: Document): Root;
125
+ declare function kmlWithFolders(node: Document, options?: KMLOptions): Root;
108
126
  /**
109
127
  * Convert KML to GeoJSON incrementally, returning
110
128
  * a [Generator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators)
111
129
  * that yields output feature by feature.
112
130
  */
113
- declare function kmlGen(node: Document): Generator<F>;
131
+ declare function kmlGen(node: Document, options?: KMLOptions): Generator<F>;
114
132
  /**
115
133
  * Convert a KML document to GeoJSON. The first argument, `doc`, must be a KML
116
134
  * document as an XML DOM - not as a string. You can get this using jQuery's default
@@ -121,6 +139,6 @@ declare function kmlGen(node: Document): Generator<F>;
121
139
  * with [JSON.stringify](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify)
122
140
  * or use it directly in libraries.
123
141
  */
124
- declare function kml(node: Document): FeatureCollection<Geometry | null>;
142
+ declare function kml(node: Document, options?: KMLOptions): FeatureCollection<Geometry | null>;
125
143
 
126
- export { F, Folder, Root, gpx, gpxGen, kml, kmlGen, kmlWithFolders, tcx, tcxGen };
144
+ export { F, Folder, KMLOptions, Root, gpx, gpxGen, kml, kmlGen, kmlWithFolders, tcx, tcxGen };
@@ -799,11 +799,15 @@ function geometryListToGeometry(geometries) {
799
799
  geometries,
800
800
  };
801
801
  }
802
- function getPlacemark(node, styleMap, schema) {
802
+ function getPlacemark(node, styleMap, schema, options) {
803
803
  const { coordTimes, geometries } = getGeometry(node);
804
+ const geometry = geometryListToGeometry(geometries);
805
+ if (!geometry && options.skipNullGeometry) {
806
+ return null;
807
+ }
804
808
  const feature = {
805
809
  type: "Feature",
806
- geometry: geometryListToGeometry(geometries),
810
+ geometry,
807
811
  properties: Object.assign(getMulti(node, [
808
812
  "name",
809
813
  "address",
@@ -833,8 +837,10 @@ function getGroundOverlayBox(node) {
833
837
  if (latLonQuad) {
834
838
  const ring = fixRing(coord(getCoordinates(node)));
835
839
  return {
836
- type: "Polygon",
837
- coordinates: [ring],
840
+ geometry: {
841
+ type: "Polygon",
842
+ coordinates: [ring],
843
+ },
838
844
  };
839
845
  }
840
846
  return getLatLonBox(node);
@@ -881,15 +887,22 @@ function getLatLonBox(node) {
881
887
  coordinates = rotateBox(bbox, coordinates, rotation);
882
888
  }
883
889
  return {
884
- type: "Polygon",
885
- coordinates,
890
+ bbox,
891
+ geometry: {
892
+ type: "Polygon",
893
+ coordinates,
894
+ },
886
895
  };
887
896
  }
888
897
  }
889
898
  return null;
890
899
  }
891
- function getGroundOverlay(node, styleMap, schema) {
892
- const geometry = getGroundOverlayBox(node);
900
+ function getGroundOverlay(node, styleMap, schema, options) {
901
+ const box = getGroundOverlayBox(node);
902
+ const geometry = box?.geometry || null;
903
+ if (!geometry && options.skipNullGeometry) {
904
+ return null;
905
+ }
893
906
  const feature = {
894
907
  type: "Feature",
895
908
  geometry,
@@ -907,6 +920,9 @@ function getGroundOverlay(node, styleMap, schema) {
907
920
  "description",
908
921
  ]), getMaybeHTMLDescription(node), extractCascadedStyle(node, styleMap), extractStyle(node), extractIconHref(node), extractExtendedData(node, schema), extractTimeSpan(node), extractTimeStamp(node)),
909
922
  };
923
+ if (box?.bbox) {
924
+ feature.bbox = box.bbox;
925
+ }
910
926
  if (feature.properties?.visibility !== undefined) {
911
927
  feature.properties.visibility = feature.properties.visibility !== "0";
912
928
  }
@@ -1013,22 +1029,24 @@ function getFolder(node) {
1013
1029
  * with a separate method to other features, depending
1014
1030
  * on which map framework you're using.
1015
1031
  */
1016
- function kmlWithFolders(node) {
1032
+ function kmlWithFolders(node, options = {
1033
+ skipNullGeometry: false,
1034
+ }) {
1017
1035
  const styleMap = buildStyleMap(node);
1018
1036
  const schema = buildSchema(node);
1019
1037
  const tree = { type: "root", children: [] };
1020
- function traverse(node, pointer) {
1038
+ function traverse(node, pointer, options) {
1021
1039
  if (isElement(node)) {
1022
1040
  switch (node.tagName) {
1023
1041
  case "GroundOverlay": {
1024
- const placemark = getGroundOverlay(node, styleMap, schema);
1042
+ const placemark = getGroundOverlay(node, styleMap, schema, options);
1025
1043
  if (placemark) {
1026
1044
  pointer.children.push(placemark);
1027
1045
  }
1028
1046
  break;
1029
1047
  }
1030
1048
  case "Placemark": {
1031
- const placemark = getPlacemark(node, styleMap, schema);
1049
+ const placemark = getPlacemark(node, styleMap, schema, options);
1032
1050
  if (placemark) {
1033
1051
  pointer.children.push(placemark);
1034
1052
  }
@@ -1044,11 +1062,11 @@ function kmlWithFolders(node) {
1044
1062
  }
1045
1063
  if (node.childNodes) {
1046
1064
  for (let i = 0; i < node.childNodes.length; i++) {
1047
- traverse(node.childNodes[i], pointer);
1065
+ traverse(node.childNodes[i], pointer, options);
1048
1066
  }
1049
1067
  }
1050
1068
  }
1051
- traverse(node, tree);
1069
+ traverse(node, tree, options);
1052
1070
  return tree;
1053
1071
  }
1054
1072
  /**
@@ -1056,16 +1074,18 @@ function kmlWithFolders(node) {
1056
1074
  * a [Generator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators)
1057
1075
  * that yields output feature by feature.
1058
1076
  */
1059
- function* kmlGen(node) {
1077
+ function* kmlGen(node, options = {
1078
+ skipNullGeometry: false,
1079
+ }) {
1060
1080
  const styleMap = buildStyleMap(node);
1061
1081
  const schema = buildSchema(node);
1062
1082
  for (const placemark of $(node, "Placemark")) {
1063
- const feature = getPlacemark(placemark, styleMap, schema);
1083
+ const feature = getPlacemark(placemark, styleMap, schema, options);
1064
1084
  if (feature)
1065
1085
  yield feature;
1066
1086
  }
1067
1087
  for (const groundOverlay of $(node, "GroundOverlay")) {
1068
- const feature = getGroundOverlay(groundOverlay, styleMap, schema);
1088
+ const feature = getGroundOverlay(groundOverlay, styleMap, schema, options);
1069
1089
  if (feature)
1070
1090
  yield feature;
1071
1091
  }
@@ -1080,10 +1100,12 @@ function* kmlGen(node) {
1080
1100
  * with [JSON.stringify](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify)
1081
1101
  * or use it directly in libraries.
1082
1102
  */
1083
- function kml(node) {
1103
+ function kml(node, options = {
1104
+ skipNullGeometry: false,
1105
+ }) {
1084
1106
  return {
1085
1107
  type: "FeatureCollection",
1086
- features: Array.from(kmlGen(node)),
1108
+ features: Array.from(kmlGen(node, options)),
1087
1109
  };
1088
1110
  }
1089
1111