@tmcw/togeojson 4.4.1 → 4.6.1-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 CHANGED
@@ -2,6 +2,27 @@
2
2
 
3
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
4
 
5
+ ### [4.6.1-0](https://github.com/tmcw/togeojson/compare/v4.6.0...v4.6.1-0) (2022-03-07)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * Make module system more convoluted ([845ff7a](https://github.com/tmcw/togeojson/commit/845ff7a2c08220d8b87860231b262709d8db070a))
11
+
12
+ ## [4.6.0](https://github.com/tmcw/togeojson/compare/v4.5.0...v4.6.0) (2022-03-07)
13
+
14
+
15
+ ### Features
16
+
17
+ * Support additional GPX extensions ([ae2f00f](https://github.com/tmcw/togeojson/commit/ae2f00f685f5fd1e74b19864b0bba8211310d31a))
18
+
19
+ ## [4.5.0](https://github.com/tmcw/togeojson/compare/v4.4.1...v4.5.0) (2021-08-03)
20
+
21
+
22
+ ### Features
23
+
24
+ * Load TCX Courses ([#53](https://github.com/tmcw/togeojson/issues/53)) ([8924925](https://github.com/tmcw/togeojson/commit/89249255bd86d8c38e855f14b62fffad3f556abf))
25
+
5
26
  ### [4.4.1](https://github.com/tmcw/togeojson/compare/v4.4.0...v4.4.1) (2021-04-27)
6
27
 
7
28
 
package/README.md CHANGED
@@ -1,7 +1,6 @@
1
- # Convert KML and GPX to GeoJSON.
1
+ # Convert KML, GPX, and TCX to GeoJSON.
2
2
 
3
- :sparkles: _This is a maintained and modernized fork of the toGeoJSON project, which I (Tom) wrote while at Mapbox,
4
- and am now maintaining on a personal basis because the Mapbox-owned project is abandoned._
3
+ _togeojson development is supported by 🌎 [placemark.io](https://placemark.io/)_
5
4
 
6
5
  This converts [KML](https://developers.google.com/kml/documentation/), [TCX](https://en.wikipedia.org/wiki/Training_Center_XML), & [GPX](http://www.topografix.com/gpx.asp)
7
6
  to [GeoJSON](http://www.geojson.org/), in a browser or with [Node.js](http://nodejs.org/).
@@ -55,6 +54,11 @@ that yields output feature by feature.
55
54
  Convert a TCX document to GeoJSON. The first argument, `doc`, must be a TCX
56
55
  document as an XML DOM - not as a string.
57
56
 
57
+ ### `toGeoJSON.tcxGen(doc)`
58
+
59
+ Convert a TCX document to GeoJSON incrementally, returning a [Generator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators)
60
+ that yields output feature by feature. The first argument, `doc`, must be a TCX
61
+ document as an XML DOM - not as a string.
58
62
 
59
63
  ## Property conversions
60
64
 
@@ -99,8 +103,6 @@ const DOMParser = require("xmldom").DOMParser;
99
103
  const kml = new DOMParser().parseFromString(fs.readFileSync("foo.kml", "utf8"));
100
104
 
101
105
  const converted = tj.kml(kml);
102
-
103
- const convertedWithStyles = tj.kml(kml, { styles: true });
104
106
  ```
105
107
 
106
108
  ## ES Modules
@@ -118,10 +120,10 @@ import { kml } from "@tmcw/togeojson";
118
120
  import { kml } from "https://unpkg.com/@tmcw/togeojson?module";
119
121
 
120
122
  fetch("test/data/linestring.kml")
121
- .then(function(response) {
123
+ .then(function (response) {
122
124
  return response.text();
123
125
  })
124
- .then(function(xml) {
126
+ .then(function (xml) {
125
127
  console.log(kml(new DOMParser().parseFromString(xml, "text/xml")));
126
128
  });
127
129
  </script>
@@ -211,8 +213,26 @@ support for them is out of scope for toGeoJSON.
211
213
 
212
214
  ## Protips:
213
215
 
214
- Have a string of XML and need an XML DOM?
216
+ Have a string of XML and need an XML DOM? There are two main options:
217
+
218
+ - Use [xmldom](https://www.npmjs.com/package/@xmldom/xmldom), a JavaScript module that contains its own XML parser
219
+ - Use [`DOMParser`](https://developer.mozilla.org/en-US/docs/Web/API/DOMParser), the native platform XML parser
220
+
221
+ We recommend that **you use xmldom**, not the platform. DOMParser requires XML to be valid, which means that any XML namespaces that a KML, GPX, or TCX file contains are valid. A lot of existing data is invalid XML, and will be parsed only in part by DOMParser, but can be fully parsed by xmldom.
222
+
223
+ Using xmldom (recommended):
224
+
225
+ ```js
226
+ const xmldom = require("@xmldom/xmldom");
227
+ const dom = new xmldom.DOMParser().parseFromString(xmlStr, "text/xml");
228
+ ```
229
+
230
+ Using DOMParser:
215
231
 
216
232
  ```js
217
233
  var dom = new DOMParser().parseFromString(xmlStr, "text/xml");
218
234
  ```
235
+
236
+ ---
237
+
238
+ [![Maintainability](https://api.codeclimate.com/v1/badges/b3673a9a9f6e132ec991/maintainability)](https://codeclimate.com/github/placemark/togeojson/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/b3673a9a9f6e132ec991/test_coverage)](https://codeclimate.com/github/placemark/togeojson/test_coverage)