@loaders.gl/kml 4.0.0-alpha.21 → 4.0.0-alpha.23

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/dist/dist.min.js CHANGED
@@ -6048,34 +6048,18 @@
6048
6048
  const geojson = kml(doc);
6049
6049
  const shape = options?.gis?.format || options?.kml?.type || options?.kml?.shape;
6050
6050
  switch (shape) {
6051
- case "object-row-table": {
6051
+ case "object-row-table":
6052
+ default:
6052
6053
  const table = {
6053
6054
  shape: "object-row-table",
6054
6055
  data: geojson.features
6055
6056
  };
6056
6057
  return table;
6057
- }
6058
- case "geojson-row-table": {
6059
- const table = {
6060
- shape: "geojson-row-table",
6061
- data: geojson.features
6062
- };
6063
- return table;
6064
- }
6065
- case "geojson":
6066
- return geojson;
6067
- case "binary":
6068
- return geojsonToBinary(geojson.features);
6069
- case "raw":
6070
- return doc;
6071
- default:
6072
- return geojson;
6073
6058
  }
6074
6059
  }
6075
6060
  var import_xmldom2, VERSION2, KML_HEADER, KMLLoader;
6076
6061
  var init_kml_loader = __esm({
6077
6062
  "src/kml-loader.ts"() {
6078
- init_src();
6079
6063
  init_togeojson_es();
6080
6064
  import_xmldom2 = __toModule(require_lib());
6081
6065
  VERSION2 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
@@ -4,13 +4,13 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports._typecheckGPXLoader = exports.GPXLoader = void 0;
7
+ exports.GPXLoader = void 0;
8
8
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
9
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
10
  var _gis = require("@loaders.gl/gis");
11
11
  var _togeojson = require("@tmcw/togeojson");
12
12
  var _xmldom = require("@xmldom/xmldom");
13
- var VERSION = typeof "4.0.0-alpha.21" !== 'undefined' ? "4.0.0-alpha.21" : 'latest';
13
+ var VERSION = typeof "4.0.0-alpha.23" !== 'undefined' ? "4.0.0-alpha.23" : 'latest';
14
14
  var GPX_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<gpx";
15
15
  var GPXLoader = {
16
16
  name: 'GPX (GPS exchange format)',
@@ -77,6 +77,4 @@ function parseTextSync(text, options) {
77
77
  return geojson;
78
78
  }
79
79
  }
80
- var _typecheckGPXLoader = GPXLoader;
81
- exports._typecheckGPXLoader = _typecheckGPXLoader;
82
80
  //# sourceMappingURL=gpx-loader.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"gpx-loader.js","names":["_gis","require","_togeojson","_xmldom","VERSION","GPX_HEADER","GPXLoader","name","id","module","version","extensions","mimeTypes","text","tests","parse","_parse","_asyncToGenerator2","default","_regenerator","mark","_callee","arrayBuffer","options","wrap","_callee$","_context","prev","next","abrupt","parseTextSync","TextDecoder","decode","stop","_x","_x2","apply","arguments","gpx","gis","exports","_options$gis","_options$gpx","_options$gpx2","doc","DOMParser","parseFromString","geojson","shape","format","type","table","data","features","geojsonToBinary","_typecheckGPXLoader"],"sources":["../../src/gpx-loader.ts"],"sourcesContent":["import type {LoaderOptions, LoaderWithParser} from '@loaders.gl/loader-utils';\nimport {geojsonToBinary} from '@loaders.gl/gis';\nimport type {GeoJSONRowTable, FeatureCollection, ObjectRowTable} from '@loaders.gl/schema';\nimport {gpx} from '@tmcw/togeojson';\nimport {DOMParser} from '@xmldom/xmldom';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type GPXLoaderOptions = LoaderOptions & {\n gpx?: {\n shape?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';\n /** @deprecated. Use options.gpx.shape */\n type?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';\n };\n gis?: {\n /** @deprecated. Use options.gpx.shape */\n format?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';\n };\n};\n\nconst GPX_HEADER = `\\\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<gpx`;\n\n/**\n * Loader for GPX (GPS exchange format)\n */\nexport const GPXLoader = {\n name: 'GPX (GPS exchange format)',\n id: 'gpx',\n module: 'kml',\n version: VERSION,\n extensions: ['gpx'],\n mimeTypes: ['application/gpx+xml'],\n text: true,\n tests: [GPX_HEADER],\n parse: async (arrayBuffer, options?: GPXLoaderOptions) =>\n parseTextSync(new TextDecoder().decode(arrayBuffer), options),\n parseTextSync,\n options: {\n gpx: {},\n gis: {}\n }\n};\n\nfunction parseTextSync(text: string, options?: GPXLoaderOptions) {\n const doc = new DOMParser().parseFromString(text, 'text/xml');\n const geojson: FeatureCollection = gpx(doc);\n\n const shape = options?.gis?.format || options?.gpx?.type || options?.gpx?.shape;\n\n switch (shape) {\n case 'object-row-table': {\n const table: ObjectRowTable = {\n shape: 'object-row-table',\n data: geojson.features\n };\n return table;\n }\n case 'geojson-row-table': {\n const table: GeoJSONRowTable = {\n shape: 'geojson-row-table',\n data: geojson.features\n };\n return table;\n }\n case 'geojson':\n return geojson;\n case 'binary':\n return geojsonToBinary(geojson.features);\n case 'raw':\n return doc;\n default:\n // Default to geojson for backwards compatibility\n return geojson;\n }\n}\n\nexport const _typecheckGPXLoader: LoaderWithParser = GPXLoader;\n"],"mappings":";;;;;;;;;AACA,IAAAA,IAAA,GAAAC,OAAA;AAEA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAIA,IAAMG,OAAO,GAAG,uBAAkB,KAAK,WAAW,sBAAiB,QAAQ;AAc3E,IAAMC,UAAU,qDAEX;AAKE,IAAMC,SAAS,GAAG;EACvBC,IAAI,EAAE,2BAA2B;EACjCC,EAAE,EAAE,KAAK;EACTC,MAAM,EAAE,KAAK;EACbC,OAAO,EAAEN,OA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AAO,CAAEgB,GAAG,cAAAE,YAAA,uBAAZA,YAAA,CAAcQ,MAAM,MAAI1B,OAAO,aAAPA,OAAO,wBAAAmB,YAAA,GAAPnB,OAAO,CAAEe,GAAG,cAAAI,YAAA,uBAAZA,YAAA,CAAcQ,IAAI,MAAI3B,OAAO,aAAPA,OAAO,wBAAAoB,aAAA,GAAPpB,OAAO,CAAEe,GAAG,cAAAK,aAAA,uBAAZA,aAAA,CAAcK,KAAK;EAE/E,QAAQA,KAAK;IACX,KAAK,kBAAkB;MAAE;QACvB,IAAMG,KAAqB,GAAG;UAC5BH,KAAK,EAAE,kBAAkB;UACzBI,IAAI,EAAEL,OAAO,CAACM;QAChB,CAAC;QACD,OAAOF,KAAK;MACd;IACA,KAAK,mBAAmB;MAAE;QACxB,IAAMA,MAAsB,GAAG;UAC7BH,KAAK,EAAE,mBAAmB;UAC1BI,IAAI,EAAEL,OAAO,CAACM;QAChB,CAAC;QACD,OAAOF,MAAK;MACd;IACA,KAAK,SAAS;MACZ,OAAOJ,OAAO;IAChB,KAAK,QAAQ;MACX,OAAO,IAAAO,oBAAe,EAACP,OAAO,CAACM,QAAQ,CAAC;IAC1C,KAAK,KAAK;MACR,OAAOT,GAAG;IACZ;MAEE,OAAOG,OAAO;EAClB;AACF;AAEO,IAAMQ,mBAAqC,GAAGjD,SAAS;AAACkC,OAAA,CAAAe,mBAAA,GAAAA,mBAAA"}
1
+ {"version":3,"file":"gpx-loader.js","names":["_gis","require","_togeojson","_xmldom","VERSION","GPX_HEADER","GPXLoader","name","id","module","version","extensions","mimeTypes","text","tests","parse","_parse","_asyncToGenerator2","default","_regenerator","mark","_callee","arrayBuffer","options","wrap","_callee$","_context","prev","next","abrupt","parseTextSync","TextDecoder","decode","stop","_x","_x2","apply","arguments","gpx","gis","exports","_options$gis","_options$gpx","_options$gpx2","doc","DOMParser","parseFromString","geojson","shape","format","type","table","data","features","geojsonToBinary"],"sources":["../../src/gpx-loader.ts"],"sourcesContent":["import type {LoaderOptions, LoaderWithParser} from '@loaders.gl/loader-utils';\nimport {geojsonToBinary} from '@loaders.gl/gis';\nimport type {GeoJSONRowTable, FeatureCollection, ObjectRowTable} from '@loaders.gl/schema';\nimport {gpx} from '@tmcw/togeojson';\nimport {DOMParser} from '@xmldom/xmldom';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type GPXLoaderOptions = LoaderOptions & {\n gpx?: {\n shape?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';\n /** @deprecated. Use options.gpx.shape */\n type?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';\n };\n gis?: {\n /** @deprecated. Use options.gpx.shape */\n format?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';\n };\n};\n\nconst GPX_HEADER = `\\\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<gpx`;\n\n/**\n * Loader for GPX (GPS exchange format)\n */\nexport const GPXLoader: LoaderWithParser = {\n name: 'GPX (GPS exchange format)',\n id: 'gpx',\n module: 'kml',\n version: VERSION,\n extensions: ['gpx'],\n mimeTypes: ['application/gpx+xml'],\n text: true,\n tests: [GPX_HEADER],\n parse: async (arrayBuffer, options?: GPXLoaderOptions) =>\n parseTextSync(new TextDecoder().decode(arrayBuffer), options),\n parseTextSync,\n options: {\n gpx: {},\n gis: {}\n }\n};\n\nfunction parseTextSync(text: string, options?: GPXLoaderOptions) {\n const doc = new DOMParser().parseFromString(text, 'text/xml');\n const geojson: FeatureCollection = gpx(doc);\n\n const shape = options?.gis?.format || options?.gpx?.type || options?.gpx?.shape;\n\n switch (shape) {\n case 'object-row-table': {\n const table: ObjectRowTable = {\n shape: 'object-row-table',\n data: geojson.features\n };\n return table;\n }\n case 'geojson-row-table': {\n const table: GeoJSONRowTable = {\n shape: 'geojson-row-table',\n data: geojson.features\n };\n return table;\n }\n case 'geojson':\n return geojson;\n case 'binary':\n return geojsonToBinary(geojson.features);\n case 'raw':\n return doc;\n default:\n // Default to geojson for backwards compatibility\n return geojson;\n }\n}\n"],"mappings":";;;;;;;;;AACA,IAAAA,IAAA,GAAAC,OAAA;AAEA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAIA,IAAMG,OAAO,GAAG,uBAAkB,KAAK,WAAW,sBAAiB,QAAQ;AAc3E,IAAMC,UAAU,qDAEX;AAKE,IAAMC,SAA2B,GAAG;EACzCC,IAAI,EAAE,2BAA2B;EACjCC,EAAE,EAAE,KAAK;EACTC,MAAM,EAAE,KAAK;EACbC,OAAO,EAAEN,OAAO;EAChBO,UAAU,EAAE,CAAC,KAAK,CAAC;EACnBC,SAAS,EAAE,CAAC,qBAAqB,CAAC;EAClCC,IAAI,EAAE,IAAI;EACVC,KAAK,EAAE,CAACT,UAAU,CAAC;EACnBU,KAAK;IAAA,IAAAC,MAAA,OAAAC,kBAAA,CAAAC,OAAA,EAAAC,YAAA,CAAAD,OAAA,CAAAE,IAAA,CAAE,SAAAC,QAAOC,WAAW,EAAEC,OAA0B;MAAA,OAAAJ,YAAA,CAAAD,OAAA,CAAAM,IAAA,UAAAC,SAAAC,QAAA;QAAA,kBAAAA,QAAA,CAAAC,IAAA,GAAAD,QAAA,CAAAE,IAAA;UAAA;YAAA,OAAAF,QAAA,CAAAG,MAAA,WACnDC,aAAa,CAAC,IAAIC,WAAW,CAAC,CAAC,CAACC,MAAM,CAACV,WAAW,CAAC,EAAEC,OAAO,CAAC;UAAA;UAAA;YAAA,OAAAG,QAAA,CAAAO,IAAA;QAAA;MAAA,GAAAZ,OAAA;IAAA;IAAA,SAAAN,MAAAmB,EAAA,EAAAC,GAAA;MAAA,OAAAnB,MAAA,CAAAoB,KAAA,OAAAC,SAAA;IAAA;IAAA,OAAAtB,KAAA;EAAA;EAC/De,aAAa,EAAbA,aAAa;EACbP,OAAO,EAAE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;AACF"}
@@ -4,13 +4,12 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports._typecheckKMLLoader = exports.KMLLoader = void 0;
7
+ exports.KMLLoader = void 0;
8
8
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
9
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
- var _gis = require("@loaders.gl/gis");
11
10
  var _togeojson = require("@tmcw/togeojson");
12
11
  var _xmldom = require("@xmldom/xmldom");
13
- var VERSION = typeof "4.0.0-alpha.21" !== 'undefined' ? "4.0.0-alpha.21" : 'latest';
12
+ var VERSION = typeof "4.0.0-alpha.23" !== 'undefined' ? "4.0.0-alpha.23" : 'latest';
14
13
  var KML_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<kml xmlns=\"http://www.opengis.net/kml/2.2\">";
15
14
  var KMLLoader = {
16
15
  name: 'KML (Keyhole Markup Language)',
@@ -52,31 +51,12 @@ function parseTextSync(text, options) {
52
51
  var shape = (options === null || options === void 0 ? void 0 : (_options$gis = options.gis) === null || _options$gis === void 0 ? void 0 : _options$gis.format) || (options === null || options === void 0 ? void 0 : (_options$kml = options.kml) === null || _options$kml === void 0 ? void 0 : _options$kml.type) || (options === null || options === void 0 ? void 0 : (_options$kml2 = options.kml) === null || _options$kml2 === void 0 ? void 0 : _options$kml2.shape);
53
52
  switch (shape) {
54
53
  case 'object-row-table':
55
- {
56
- var table = {
57
- shape: 'object-row-table',
58
- data: geojson.features
59
- };
60
- return table;
61
- }
62
- case 'geojson-row-table':
63
- {
64
- var _table = {
65
- shape: 'geojson-row-table',
66
- data: geojson.features
67
- };
68
- return _table;
69
- }
70
- case 'geojson':
71
- return geojson;
72
- case 'binary':
73
- return (0, _gis.geojsonToBinary)(geojson.features);
74
- case 'raw':
75
- return doc;
76
54
  default:
77
- return geojson;
55
+ var table = {
56
+ shape: 'object-row-table',
57
+ data: geojson.features
58
+ };
59
+ return table;
78
60
  }
79
61
  }
80
- var _typecheckKMLLoader = KMLLoader;
81
- exports._typecheckKMLLoader = _typecheckKMLLoader;
82
62
  //# sourceMappingURL=kml-loader.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"kml-loader.js","names":["_gis","require","_togeojson","_xmldom","VERSION","KML_HEADER","KMLLoader","name","id","module","version","extensions","mimeTypes","text","tests","parse","_parse","_asyncToGenerator2","default","_regenerator","mark","_callee","arrayBuffer","options","wrap","_callee$","_context","prev","next","abrupt","parseTextSync","TextDecoder","decode","stop","_x","_x2","apply","arguments","kml","gis","exports","_options$gis","_options$kml","_options$kml2","doc","DOMParser","parseFromString","geojson","shape","format","type","table","data","features","geojsonToBinary","_typecheckKMLLoader"],"sources":["../../src/kml-loader.ts"],"sourcesContent":["import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport {geojsonToBinary} from '@loaders.gl/gis';\nimport {GeoJSONRowTable, FeatureCollection, ObjectRowTable} from '@loaders.gl/schema';\nimport {kml} from '@tmcw/togeojson';\nimport {DOMParser} from '@xmldom/xmldom';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type KMLLoaderOptions = LoaderOptions & {\n kml?: {\n shape?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';\n /** @deprecated. Use options.kml.shape */\n type?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';\n };\n gis?: {\n /** @deprecated. Use options.kml.shape */\n format?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';\n };\n};\n\nconst KML_HEADER = `\\\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<kml xmlns=\"http://www.opengis.net/kml/2.2\">`;\n\n/**\n * Loader for KML (Keyhole Markup Language)\n */\nexport const KMLLoader = {\n name: 'KML (Keyhole Markup Language)',\n id: 'kml',\n module: 'kml',\n version: VERSION,\n extensions: ['kml'],\n mimeTypes: ['application/vnd.google-earth.kml+xml'],\n text: true,\n tests: [KML_HEADER],\n parse: async (arrayBuffer, options?: KMLLoaderOptions) =>\n parseTextSync(new TextDecoder().decode(arrayBuffer), options),\n parseTextSync,\n options: {\n kml: {},\n gis: {}\n }\n};\n\nfunction parseTextSync(text: string, options?: KMLLoaderOptions) {\n const doc = new DOMParser().parseFromString(text, 'text/xml');\n const geojson: FeatureCollection = kml(doc);\n\n // backwards compatibility\n const shape = options?.gis?.format || options?.kml?.type || options?.kml?.shape;\n switch (shape) {\n case 'object-row-table': {\n const table: ObjectRowTable = {\n shape: 'object-row-table',\n data: geojson.features\n };\n return table;\n }\n case 'geojson-row-table': {\n const table: GeoJSONRowTable = {\n shape: 'geojson-row-table',\n data: geojson.features\n };\n return table;\n }\n case 'geojson':\n return geojson;\n case 'binary':\n return geojsonToBinary(geojson.features);\n case 'raw':\n return doc;\n default:\n // Default to geojson for backwards compatibility\n return geojson;\n }\n}\n\nexport const _typecheckKMLLoader: LoaderWithParser = KMLLoader;\n"],"mappings":";;;;;;;;;AACA,IAAAA,IAAA,GAAAC,OAAA;AAEA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAIA,IAAMG,OAAO,GAAG,uBAAkB,KAAK,WAAW,sBAAiB,QAAQ;AAc3E,IAAMC,UAAU,+FAE6B;AAKtC,IAAMC,SAAS,GAAG;EACvBC,IAAI,EAAE,+BAA+B;EACrCC,EAAE,EAAE,KAAK;EACTC,MAAM,EAAE,KAAK;EACbC,OAAO,EAAEN,OAAO;EAChBO,UAAU,EAAE,CAAC,KAAK,CAAC;EACnBC,SAAS,EAAE,CAAC,sCAAsC,CAAC;EACnDC,IAAI,EAAE,IAAI;EACVC,KAAK,EAAE,CAACT,UAAU,CAAC;EACnBU,KAAK;IAAA,IAAAC,MA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AI,MAAI3B,OAAO,aAAPA,OAAO,wBAAAoB,aAAA,GAAPpB,OAAO,CAAEe,GAAG,cAAAK,aAAA,uBAAZA,aAAA,CAAcK,KAAK;EAC/E,QAAQA,KAAK;IACX,KAAK,kBAAkB;MAAE;QACvB,IAAMG,KAAqB,GAAG;UAC5BH,KAAK,EAAE,kBAAkB;UACzBI,IAAI,EAAEL,OAAO,CAACM;QAChB,CAAC;QACD,OAAOF,KAAK;MACd;IACA,KAAK,mBAAmB;MAAE;QACxB,IAAMA,MAAsB,GAAG;UAC7BH,KAAK,EAAE,mBAAmB;UAC1BI,IAAI,EAAEL,OAAO,CAACM;QAChB,CAAC;QACD,OAAOF,MAAK;MACd;IACA,KAAK,SAAS;MACZ,OAAOJ,OAAO;IAChB,KAAK,QAAQ;MACX,OAAO,IAAAO,oBAAe,EAACP,OAAO,CAACM,QAAQ,CAAC;IAC1C,KAAK,KAAK;MACR,OAAOT,GAAG;IACZ;MAEE,OAAOG,OAAO;EAClB;AACF;AAEO,IAAMQ,mBAAqC,GAAGjD,SAAS;AAACkC,OAAA,CAAAe,mBAAA,GAAAA,mBAAA"}
1
+ {"version":3,"file":"kml-loader.js","names":["_togeojson","require","_xmldom","VERSION","KML_HEADER","KMLLoader","name","id","module","version","extensions","mimeTypes","text","tests","parse","_parse","_asyncToGenerator2","default","_regenerator","mark","_callee","arrayBuffer","options","wrap","_callee$","_context","prev","next","abrupt","parseTextSync","TextDecoder","decode","stop","_x","_x2","apply","arguments","kml","gis","exports","_options$gis","_options$kml","_options$kml2","doc","DOMParser","parseFromString","geojson","shape","format","type","table","data","features"],"sources":["../../src/kml-loader.ts"],"sourcesContent":["import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\n// import {geojsonToBinary} from '@loaders.gl/gis';\n// import {GeoJSONRowTable} from '@loaders.gl/schema';\nimport {FeatureCollection, ObjectRowTable} from '@loaders.gl/schema';\nimport {kml} from '@tmcw/togeojson';\nimport {DOMParser} from '@xmldom/xmldom';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type KMLLoaderOptions = LoaderOptions & {\n kml?: {\n shape?: 'object-row-table' | 'geojson-row-table';\n /** @deprecated. Use options.kml.shape */\n type?: 'object-row-table' | 'geojson-row-table';\n };\n gis?: {\n /** @deprecated. Use options.kml.shape */\n format?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';\n };\n};\n\nconst KML_HEADER = `\\\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<kml xmlns=\"http://www.opengis.net/kml/2.2\">`;\n\n/**\n * Loader for KML (Keyhole Markup Language)\n */\nexport const KMLLoader: LoaderWithParser<ObjectRowTable, never, KMLLoaderOptions> = {\n name: 'KML (Keyhole Markup Language)',\n id: 'kml',\n module: 'kml',\n version: VERSION,\n extensions: ['kml'],\n mimeTypes: ['application/vnd.google-earth.kml+xml'],\n text: true,\n tests: [KML_HEADER],\n parse: async (arrayBuffer, options?: KMLLoaderOptions) =>\n parseTextSync(new TextDecoder().decode(arrayBuffer), options),\n parseTextSync,\n options: {\n kml: {},\n gis: {}\n }\n};\n\nfunction parseTextSync(text: string, options?: KMLLoaderOptions): ObjectRowTable {\n const doc = new DOMParser().parseFromString(text, 'text/xml');\n const geojson: FeatureCollection = kml(doc);\n\n // backwards compatibility\n const shape = options?.gis?.format || options?.kml?.type || options?.kml?.shape;\n switch (shape) {\n // case 'geojson-row-table': {\n // const table: GeoJSONRowTable = {\n // shape: 'geojson-row-table',\n // data: geojson.features\n // };\n // return table;\n // }\n // case 'geojson':\n // return geojson;\n // case 'binary':\n // return geojsonToBinary(geojson.features);\n // case 'raw':\n // return doc;\n case 'object-row-table':\n default:\n const table: ObjectRowTable = {\n shape: 'object-row-table',\n data: geojson.features\n };\n return table;\n }\n}\n"],"mappings":";;;;;;;;;AAIA,IAAAA,UAAA,GAA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C,YAAA,EAAAC,aAAA;EAC/E,IAAMC,GAAG,GAAG,IAAIC,iBAAS,CAAC,CAAC,CAACC,eAAe,CAACjC,IAAI,EAAE,UAAU,CAAC;EAC7D,IAAMkC,OAA0B,GAAG,IAAAT,cAAG,EAACM,GAAG,CAAC;EAG3C,IAAMI,KAAK,GAAG,CAAAzB,OAAO,aAAPA,OAAO,wBAAAkB,YAAA,GAAPlB,OAAO,CAAEgB,GAAG,cAAAE,YAAA,uBAAZA,YAAA,CAAcQ,MAAM,MAAI1B,OAAO,aAAPA,OAAO,wBAAAmB,YAAA,GAAPnB,OAAO,CAAEe,GAAG,cAAAI,YAAA,uBAAZA,YAAA,CAAcQ,IAAI,MAAI3B,OAAO,aAAPA,OAAO,wBAAAoB,aAAA,GAAPpB,OAAO,CAAEe,GAAG,cAAAK,aAAA,uBAAZA,aAAA,CAAcK,KAAK;EAC/E,QAAQA,KAAK;IAcX,KAAK,kBAAkB;IACvB;MACE,IAAMG,KAAqB,GAAG;QAC5BH,KAAK,EAAE,kBAAkB;QACzBI,IAAI,EAAEL,OAAO,CAACM;MAChB,CAAC;MACD,OAAOF,KAAK;EAChB;AACF"}
@@ -4,13 +4,13 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports._typecheckTCXLoader = exports.TCXLoader = void 0;
7
+ exports.TCXLoader = void 0;
8
8
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
9
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
10
  var _gis = require("@loaders.gl/gis");
11
11
  var _togeojson = require("@tmcw/togeojson");
12
12
  var _xmldom = require("@xmldom/xmldom");
13
- var VERSION = typeof "4.0.0-alpha.21" !== 'undefined' ? "4.0.0-alpha.21" : 'latest';
13
+ var VERSION = typeof "4.0.0-alpha.23" !== 'undefined' ? "4.0.0-alpha.23" : 'latest';
14
14
  var TCX_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<TrainingCenterDatabase";
15
15
  var TCXLoader = {
16
16
  name: 'TCX (Training Center XML)',
@@ -77,6 +77,4 @@ function parseTextSync(text, options) {
77
77
  return geojson;
78
78
  }
79
79
  }
80
- var _typecheckTCXLoader = TCXLoader;
81
- exports._typecheckTCXLoader = _typecheckTCXLoader;
82
80
  //# sourceMappingURL=tcx-loader.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tcx-loader.js","names":["_gis","require","_togeojson","_xmldom","VERSION","TCX_HEADER","TCXLoader","name","id","module","version","extensions","mimeTypes","text","tests","parse","_parse","_asyncToGenerator2","default","_regenerator","mark","_callee","arrayBuffer","options","wrap","_callee$","_context","prev","next","abrupt","parseTextSync","TextDecoder","decode","stop","_x","_x2","apply","arguments","tcx","gis","exports","_options$gis","_options$tcx","_options$tcx2","doc","DOMParser","parseFromString","geojson","shape","format","type","table","data","features","geojsonToBinary","_typecheckTCXLoader"],"sources":["../../src/tcx-loader.ts"],"sourcesContent":["import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport {geojsonToBinary} from '@loaders.gl/gis';\nimport type {GeoJSONRowTable, FeatureCollection, ObjectRowTable} from '@loaders.gl/schema';\nimport {tcx} from '@tmcw/togeojson';\nimport {DOMParser} from '@xmldom/xmldom';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type TCXLoaderOptions = LoaderOptions & {\n tcx?: {\n shape?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';\n /** @deprecated. Use options.tcx.shape */\n type?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';\n };\n gis?: {\n /** @deprecated. Use options.tcx.shape */\n format?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';\n };\n};\n\nconst TCX_HEADER = `\\\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<TrainingCenterDatabase`;\n\n/**\n * Loader for TCX (Training Center XML) - Garmin GPS track format\n */\nexport const TCXLoader = {\n name: 'TCX (Training Center XML)',\n id: 'tcx',\n module: 'kml',\n version: VERSION,\n extensions: ['tcx'],\n mimeTypes: ['application/vnd.garmin.tcx+xml'],\n text: true,\n tests: [TCX_HEADER],\n parse: async (arrayBuffer, options?: TCXLoaderOptions) =>\n parseTextSync(new TextDecoder().decode(arrayBuffer), options),\n parseTextSync,\n options: {\n tcx: {},\n gis: {}\n }\n};\n\nfunction parseTextSync(text: string, options?: TCXLoaderOptions) {\n const doc = new DOMParser().parseFromString(text, 'text/xml');\n const geojson: FeatureCollection = tcx(doc);\n\n // backwards compatibility\n const shape = options?.gis?.format || options?.tcx?.type || options?.tcx?.shape;\n\n switch (shape) {\n case 'object-row-table': {\n const table: ObjectRowTable = {\n shape: 'object-row-table',\n data: geojson.features\n };\n return table;\n }\n case 'geojson-row-table': {\n const table: GeoJSONRowTable = {\n shape: 'geojson-row-table',\n data: geojson.features\n };\n return table;\n }\n case 'geojson':\n return geojson;\n case 'binary':\n return geojsonToBinary(geojson.features);\n case 'raw':\n return doc;\n default:\n // Default to geojson for backwards compatibility\n return geojson;\n }\n}\n\nexport const _typecheckTCXLoader: LoaderWithParser = TCXLoader;\n"],"mappings":";;;;;;;;;AACA,IAAAA,IAAA,GAAAC,OAAA;AAEA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAIA,IAAMG,OAAO,GAAG,uBAAkB,KAAK,WAAW,sBAAiB,QAAQ;AAc3E,IAAMC,UAAU,wEAEQ;AAKjB,IAAMC,SAAS,GAAG;EACvBC,IAAI,EAAE,2BAA2B;EACjCC,EAAE,EAAE,KAAK;EACTC,MAAM,EAAE,KAAK;EACbC,OAAO,EAAEN,OAAO;EAChBO,UAAU,EAAE,CAAC,KAAK,CAAC;EACnBC,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CAAcQ,MAAM,MAAI1B,OAAO,aAAPA,OAAO,wBAAAmB,YAAA,GAAPnB,OAAO,CAAEe,GAAG,cAAAI,YAAA,uBAAZA,YAAA,CAAcQ,IAAI,MAAI3B,OAAO,aAAPA,OAAO,wBAAAoB,aAAA,GAAPpB,OAAO,CAAEe,GAAG,cAAAK,aAAA,uBAAZA,aAAA,CAAcK,KAAK;EAE/E,QAAQA,KAAK;IACX,KAAK,kBAAkB;MAAE;QACvB,IAAMG,KAAqB,GAAG;UAC5BH,KAAK,EAAE,kBAAkB;UACzBI,IAAI,EAAEL,OAAO,CAACM;QAChB,CAAC;QACD,OAAOF,KAAK;MACd;IACA,KAAK,mBAAmB;MAAE;QACxB,IAAMA,MAAsB,GAAG;UAC7BH,KAAK,EAAE,mBAAmB;UAC1BI,IAAI,EAAEL,OAAO,CAACM;QAChB,CAAC;QACD,OAAOF,MAAK;MACd;IACA,KAAK,SAAS;MACZ,OAAOJ,OAAO;IAChB,KAAK,QAAQ;MACX,OAAO,IAAAO,oBAAe,EAACP,OAAO,CAACM,QAAQ,CAAC;IAC1C,KAAK,KAAK;MACR,OAAOT,GAAG;IACZ;MAEE,OAAOG,OAAO;EAClB;AACF;AAEO,IAAMQ,mBAAqC,GAAGjD,SAAS;AAACkC,OAAA,CAAAe,mBAAA,GAAAA,mBAAA"}
1
+ {"version":3,"file":"tcx-loader.js","names":["_gis","require","_togeojson","_xmldom","VERSION","TCX_HEADER","TCXLoader","name","id","module","version","extensions","mimeTypes","text","tests","parse","_parse","_asyncToGenerator2","default","_regenerator","mark","_callee","arrayBuffer","options","wrap","_callee$","_context","prev","next","abrupt","parseTextSync","TextDecoder","decode","stop","_x","_x2","apply","arguments","tcx","gis","exports","_options$gis","_options$tcx","_options$tcx2","doc","DOMParser","parseFromString","geojson","shape","format","type","table","data","features","geojsonToBinary"],"sources":["../../src/tcx-loader.ts"],"sourcesContent":["import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport {geojsonToBinary} from '@loaders.gl/gis';\nimport type {GeoJSONRowTable, FeatureCollection, ObjectRowTable} from '@loaders.gl/schema';\nimport {tcx} from '@tmcw/togeojson';\nimport {DOMParser} from '@xmldom/xmldom';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type TCXLoaderOptions = LoaderOptions & {\n tcx?: {\n shape?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';\n /** @deprecated. Use options.tcx.shape */\n type?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';\n };\n gis?: {\n /** @deprecated. Use options.tcx.shape */\n format?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';\n };\n};\n\nconst TCX_HEADER = `\\\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<TrainingCenterDatabase`;\n\n/**\n * Loader for TCX (Training Center XML) - Garmin GPS track format\n */\nexport const TCXLoader: LoaderWithParser = {\n name: 'TCX (Training Center XML)',\n id: 'tcx',\n module: 'kml',\n version: VERSION,\n extensions: ['tcx'],\n mimeTypes: ['application/vnd.garmin.tcx+xml'],\n text: true,\n tests: [TCX_HEADER],\n parse: async (arrayBuffer, options?: TCXLoaderOptions) =>\n parseTextSync(new TextDecoder().decode(arrayBuffer), options),\n parseTextSync,\n options: {\n tcx: {},\n gis: {}\n }\n};\n\nfunction parseTextSync(text: string, options?: TCXLoaderOptions) {\n const doc = new DOMParser().parseFromString(text, 'text/xml');\n const geojson: FeatureCollection = tcx(doc);\n\n // backwards compatibility\n const shape = options?.gis?.format || options?.tcx?.type || options?.tcx?.shape;\n\n switch (shape) {\n case 'object-row-table': {\n const table: ObjectRowTable = {\n shape: 'object-row-table',\n data: geojson.features\n };\n return table;\n }\n case 'geojson-row-table': {\n const table: GeoJSONRowTable = {\n shape: 'geojson-row-table',\n data: geojson.features\n };\n return table;\n }\n case 'geojson':\n return geojson;\n case 'binary':\n return geojsonToBinary(geojson.features);\n case 'raw':\n return doc;\n default:\n // Default to geojson for backwards compatibility\n return geojson;\n }\n}\n"],"mappings":";;;;;;;;;AACA,IAAAA,IAAA,GAAAC,OAAA;AAEA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAIA,IAAMG,OAAO,GAAG,uBAAkB,KAAK,WAAW,sBAAiB,QAAQ;AAc3E,IAAMC,UAAU,wEAEQ;AAKjB,IAAMC,SAA2B,GAAG;EACzCC,IAAI,EAAE,2BAA2B;EACjCC,EAAE,EAAE,KAAK;EACTC,MAAM,EAAE,KAAK;EACbC,OAAO,EAAEN,OAAO;EAChBO,UAAU,EAAE,CAAC,KAAK,CAAC;EACnBC,SAAS,EAAE,CAAC,gCAAgC,CAAC;EAC7CC,IAAI,EAAE,IAAI;EACVC,KAAK,EAAE,CAACT,UAAU,CAAC;EACnBU,KAAK;IAAA,IAAAC,MAAA,OAAAC,kBAAA,CAAAC,OAAA,EAAAC,YAAA,CAAAD,OAAA,CAAAE,IAAA,CAAE,SAAAC,QAAOC,WAAW,EAAEC,OAA0B;MAAA,OAAAJ,YAAA,CAAAD,OAAA,CAAAM,IAAA,UAAAC,SAAAC,QAAA;QAAA,kBAAAA,QAAA,CAAAC,IAAA,GAAAD,QAAA,CAAAE,IAAA;UAAA;YAAA,OAAAF,QAAA,CAAAG,MAAA,WACnDC,aAAa,CAAC,IAAIC,WAAW,CAAC,CAAC,CAACC,MAAM,CAACV,WAAW,CAAC,EAAEC,OAAO,CAAC;UAAA;UAAA;YAAA,OAAAG,QAAA,CAAAO,IAAA;QAAA;MAAA,GAAAZ,OAAA;IAAA;IAAA,SAAAN,MAAAmB,EAAA,EAAAC,GAAA;MAAA,OAAAnB,MAAA,CAAAoB,KAAA,OAAAC,SAAA;IAAA;IAAA,OAAAtB,KAAA;EAAA;EAC/De,aAAa,EAAbA,aAAa;EACbP,OAAO,EAAE;I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ACF"}
@@ -1,7 +1,7 @@
1
1
  import { geojsonToBinary } from '@loaders.gl/gis';
2
2
  import { gpx } from '@tmcw/togeojson';
3
3
  import { DOMParser } from '@xmldom/xmldom';
4
- const VERSION = typeof "4.0.0-alpha.21" !== 'undefined' ? "4.0.0-alpha.21" : 'latest';
4
+ const VERSION = typeof "4.0.0-alpha.23" !== 'undefined' ? "4.0.0-alpha.23" : 'latest';
5
5
  const GPX_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<gpx";
6
6
  export const GPXLoader = {
7
7
  name: 'GPX (GPS exchange format)',
@@ -51,5 +51,4 @@ function parseTextSync(text, options) {
51
51
  return geojson;
52
52
  }
53
53
  }
54
- export const _typecheckGPXLoader = GPXLoader;
55
54
  //# sourceMappingURL=gpx-loader.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"gpx-loader.js","names":["geojsonToBinary","gpx","DOMParser","VERSION","GPX_HEADER","GPXLoader","name","id","module","version","extensions","mimeTypes","text","tests","parse","arrayBuffer","options","parseTextSync","TextDecoder","decode","gis","_options$gis","_options$gpx","_options$gpx2","doc","parseFromString","geojson","shape","format","type","table","data","features","_typecheckGPXLoader"],"sources":["../../src/gpx-loader.ts"],"sourcesContent":["import type {LoaderOptions, LoaderWithParser} from '@loaders.gl/loader-utils';\nimport {geojsonToBinary} from '@loaders.gl/gis';\nimport type {GeoJSONRowTable, FeatureCollection, ObjectRowTable} from '@loaders.gl/schema';\nimport {gpx} from '@tmcw/togeojson';\nimport {DOMParser} from '@xmldom/xmldom';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type GPXLoaderOptions = LoaderOptions & {\n gpx?: {\n shape?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';\n /** @deprecated. Use options.gpx.shape */\n type?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';\n };\n gis?: {\n /** @deprecated. Use options.gpx.shape */\n format?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';\n };\n};\n\nconst GPX_HEADER = `\\\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<gpx`;\n\n/**\n * Loader for GPX (GPS exchange format)\n */\nexport const GPXLoader = {\n name: 'GPX (GPS exchange format)',\n id: 'gpx',\n module: 'kml',\n version: VERSION,\n extensions: ['gpx'],\n mimeTypes: ['application/gpx+xml'],\n text: true,\n tests: [GPX_HEADER],\n parse: async (arrayBuffer, options?: GPXLoaderOptions) =>\n parseTextSync(new TextDecoder().decode(arrayBuffer), options),\n parseTextSync,\n options: {\n gpx: {},\n gis: {}\n }\n};\n\nfunction parseTextSync(text: string, options?: GPXLoaderOptions) {\n const doc = new DOMParser().parseFromString(text, 'text/xml');\n const geojson: FeatureCollection = gpx(doc);\n\n const shape = options?.gis?.format || options?.gpx?.type || options?.gpx?.shape;\n\n switch (shape) {\n case 'object-row-table': {\n const table: ObjectRowTable = {\n shape: 'object-row-table',\n data: geojson.features\n };\n return table;\n }\n case 'geojson-row-table': {\n const table: GeoJSONRowTable = {\n shape: 'geojson-row-table',\n data: geojson.features\n };\n return table;\n }\n case 'geojson':\n return geojson;\n case 'binary':\n return geojsonToBinary(geojson.features);\n case 'raw':\n return doc;\n default:\n // Default to geojson for backwards compatibility\n return geojson;\n }\n}\n\nexport const _typecheckGPXLoader: LoaderWithParser = GPXLoader;\n"],"mappings":"AACA,SAAQA,eAAe,QAAO,iBAAiB;AAE/C,SAAQC,GAAG,QAAO,iBAAiB;AACnC,SAAQC,SAAS,QAAO,gBAAgB;AAIxC,MAAMC,OAAO,GAAG,uBAAkB,KAAK,WAAW,sBAAiB,QAAQ;AAc3E,MAAMC,UAAU,qDAEX;AAKL,OAAO,MAAMC,SAAS,GAAG;EACvBC,IAAI,EAAE,2BAA2B;EACjCC,EAAE,EAAE,KAAK;EACTC,MAAM,EAAE,KAA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B,GAAG;UAC7BH,KAAK,EAAE,mBAAmB;UAC1BI,IAAI,EAAEL,OAAO,CAACM;QAChB,CAAC;QACD,OAAOF,KAAK;MACd;IACA,KAAK,SAAS;MACZ,OAAOJ,OAAO;IAChB,KAAK,QAAQ;MACX,OAAO1B,eAAe,CAAC0B,OAAO,CAACM,QAAQ,CAAC;IAC1C,KAAK,KAAK;MACR,OAAOR,GAAG;IACZ;MAEE,OAAOE,OAAO;EAClB;AACF;AAEA,OAAO,MAAMO,mBAAqC,GAAG5B,SAAS"}
1
+ {"version":3,"file":"gpx-loader.js","names":["geojsonToBinary","gpx","DOMParser","VERSION","GPX_HEADER","GPXLoader","name","id","module","version","extensions","mimeTypes","text","tests","parse","arrayBuffer","options","parseTextSync","TextDecoder","decode","gis","_options$gis","_options$gpx","_options$gpx2","doc","parseFromString","geojson","shape","format","type","table","data","features"],"sources":["../../src/gpx-loader.ts"],"sourcesContent":["import type {LoaderOptions, LoaderWithParser} from '@loaders.gl/loader-utils';\nimport {geojsonToBinary} from '@loaders.gl/gis';\nimport type {GeoJSONRowTable, FeatureCollection, ObjectRowTable} from '@loaders.gl/schema';\nimport {gpx} from '@tmcw/togeojson';\nimport {DOMParser} from '@xmldom/xmldom';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type GPXLoaderOptions = LoaderOptions & {\n gpx?: {\n shape?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';\n /** @deprecated. Use options.gpx.shape */\n type?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';\n };\n gis?: {\n /** @deprecated. Use options.gpx.shape */\n format?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';\n };\n};\n\nconst GPX_HEADER = `\\\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<gpx`;\n\n/**\n * Loader for GPX (GPS exchange format)\n */\nexport const GPXLoader: LoaderWithParser = {\n name: 'GPX (GPS exchange format)',\n id: 'gpx',\n module: 'kml',\n version: VERSION,\n extensions: ['gpx'],\n mimeTypes: ['application/gpx+xml'],\n text: true,\n tests: [GPX_HEADER],\n parse: async (arrayBuffer, options?: GPXLoaderOptions) =>\n parseTextSync(new TextDecoder().decode(arrayBuffer), options),\n parseTextSync,\n options: {\n gpx: {},\n gis: {}\n }\n};\n\nfunction parseTextSync(text: string, options?: GPXLoaderOptions) {\n const doc = new DOMParser().parseFromString(text, 'text/xml');\n const geojson: FeatureCollection = gpx(doc);\n\n const shape = options?.gis?.format || options?.gpx?.type || options?.gpx?.shape;\n\n switch (shape) {\n case 'object-row-table': {\n const table: ObjectRowTable = {\n shape: 'object-row-table',\n data: geojson.features\n };\n return table;\n }\n case 'geojson-row-table': {\n const table: GeoJSONRowTable = {\n shape: 'geojson-row-table',\n data: geojson.features\n };\n return table;\n }\n case 'geojson':\n return geojson;\n case 'binary':\n return geojsonToBinary(geojson.features);\n case 'raw':\n return doc;\n default:\n // Default to geojson for backwards compatibility\n return geojson;\n }\n}\n"],"mappings":"AACA,SAAQA,eAAe,QAAO,iBAAiB;AAE/C,SAAQC,GAAG,QAAO,iBAAiB;AACnC,SAAQC,SAAS,QAAO,gBAAgB;AAIxC,MAAMC,OAAO,GAAG,uBAAkB,KAAK,WAAW,sBAAiB,QAAQ;AAc3E,MAAMC,UAAU,qDAEX;AAKL,OAAO,MAAMC,SAA2B,GAAG;EACzCC,IAAI,EAAE,2BAA2B;EACjCC,EAAE,EAAE,KAAK;EACTC,MAAM,EAAE,KAAK;EACbC,OAAO,EAAEN,OAAO;EAChBO,UAAU,EAAE,CAAC,KAAK,CAAC;EACnBC,SAAS,EAAE,CAAC,qBAAqB,CAAC;EAClCC,IAAI,EAAE,IAAI;EACVC,KAAK,EAAE,CAACT,UAAU,CAAC;EACnBU,KAAK,EAAE,MAAAA,CAAOC,WAAW,EAAEC,OAA0B,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C,KAAK,KAAK;MACR,OAAOR,GAAG;IACZ;MAEE,OAAOE,OAAO;EAClB;AACF"}
@@ -1,7 +1,6 @@
1
- import { geojsonToBinary } from '@loaders.gl/gis';
2
1
  import { kml } from '@tmcw/togeojson';
3
2
  import { DOMParser } from '@xmldom/xmldom';
4
- const VERSION = typeof "4.0.0-alpha.21" !== 'undefined' ? "4.0.0-alpha.21" : 'latest';
3
+ const VERSION = typeof "4.0.0-alpha.23" !== 'undefined' ? "4.0.0-alpha.23" : 'latest';
5
4
  const KML_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<kml xmlns=\"http://www.opengis.net/kml/2.2\">";
6
5
  export const KMLLoader = {
7
6
  name: 'KML (Keyhole Markup Language)',
@@ -26,30 +25,12 @@ function parseTextSync(text, options) {
26
25
  const shape = (options === null || options === void 0 ? void 0 : (_options$gis = options.gis) === null || _options$gis === void 0 ? void 0 : _options$gis.format) || (options === null || options === void 0 ? void 0 : (_options$kml = options.kml) === null || _options$kml === void 0 ? void 0 : _options$kml.type) || (options === null || options === void 0 ? void 0 : (_options$kml2 = options.kml) === null || _options$kml2 === void 0 ? void 0 : _options$kml2.shape);
27
26
  switch (shape) {
28
27
  case 'object-row-table':
29
- {
30
- const table = {
31
- shape: 'object-row-table',
32
- data: geojson.features
33
- };
34
- return table;
35
- }
36
- case 'geojson-row-table':
37
- {
38
- const table = {
39
- shape: 'geojson-row-table',
40
- data: geojson.features
41
- };
42
- return table;
43
- }
44
- case 'geojson':
45
- return geojson;
46
- case 'binary':
47
- return geojsonToBinary(geojson.features);
48
- case 'raw':
49
- return doc;
50
28
  default:
51
- return geojson;
29
+ const table = {
30
+ shape: 'object-row-table',
31
+ data: geojson.features
32
+ };
33
+ return table;
52
34
  }
53
35
  }
54
- export const _typecheckKMLLoader = KMLLoader;
55
36
  //# sourceMappingURL=kml-loader.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"kml-loader.js","names":["geojsonToBinary","kml","DOMParser","VERSION","KML_HEADER","KMLLoader","name","id","module","version","extensions","mimeTypes","text","tests","parse","arrayBuffer","options","parseTextSync","TextDecoder","decode","gis","_options$gis","_options$kml","_options$kml2","doc","parseFromString","geojson","shape","format","type","table","data","features","_typecheckKMLLoader"],"sources":["../../src/kml-loader.ts"],"sourcesContent":["import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport {geojsonToBinary} from '@loaders.gl/gis';\nimport {GeoJSONRowTable, FeatureCollection, ObjectRowTable} from '@loaders.gl/schema';\nimport {kml} from '@tmcw/togeojson';\nimport {DOMParser} from '@xmldom/xmldom';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type KMLLoaderOptions = LoaderOptions & {\n kml?: {\n shape?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';\n /** @deprecated. Use options.kml.shape */\n type?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';\n };\n gis?: {\n /** @deprecated. Use options.kml.shape */\n format?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';\n };\n};\n\nconst KML_HEADER = `\\\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<kml xmlns=\"http://www.opengis.net/kml/2.2\">`;\n\n/**\n * Loader for KML (Keyhole Markup Language)\n */\nexport const KMLLoader = {\n name: 'KML (Keyhole Markup Language)',\n id: 'kml',\n module: 'kml',\n version: VERSION,\n extensions: ['kml'],\n mimeTypes: ['application/vnd.google-earth.kml+xml'],\n text: true,\n tests: [KML_HEADER],\n parse: async (arrayBuffer, options?: KMLLoaderOptions) =>\n parseTextSync(new TextDecoder().decode(arrayBuffer), options),\n parseTextSync,\n options: {\n kml: {},\n gis: {}\n }\n};\n\nfunction parseTextSync(text: string, options?: KMLLoaderOptions) {\n const doc = new DOMParser().parseFromString(text, 'text/xml');\n const geojson: FeatureCollection = kml(doc);\n\n // backwards compatibility\n const shape = options?.gis?.format || options?.kml?.type || options?.kml?.shape;\n switch (shape) {\n case 'object-row-table': {\n const table: ObjectRowTable = {\n shape: 'object-row-table',\n data: geojson.features\n };\n return table;\n }\n case 'geojson-row-table': {\n const table: GeoJSONRowTable = {\n shape: 'geojson-row-table',\n data: geojson.features\n };\n return table;\n }\n case 'geojson':\n return geojson;\n case 'binary':\n return geojsonToBinary(geojson.features);\n case 'raw':\n return doc;\n default:\n // Default to geojson for backwards compatibility\n return geojson;\n }\n}\n\nexport const _typecheckKMLLoader: LoaderWithParser = KMLLoader;\n"],"mappings":"AACA,SAAQA,eAAe,QAAO,iBAAiB;AAE/C,SAAQC,GAAG,QAAO,iBAAiB;AACnC,SAAQC,SAAS,QAAO,gBAAgB;AAIxC,MAAMC,OAAO,GAAG,uBAAkB,KAAK,WAAW,sBAAiB,QAAQ;AAc3E,MAAMC,UAAU,+FAE6B;AAK7C,OAAO,MAAMC,SAAS,GAAG;EACvBC,IAAI,EAAE,+BAA+B;EACrCC,EAAE,EAAE,KAAK;EACTC,MAAM,EAAE,KAAK;EACbC,OAAO,EAAEN,OAAO;EAChBO,UAAU,EAAE,CAAC,KAAK,CAAC;EACnBC,SAAS,EAAE,CAAC,sCAAsC,CAAC;EACnDC,IAAI,EAAE,IAAI;EACVC,KAAK,EAAE,CAACT,UAAU,CAAC;EACnBU,KAAK,EAAE,MAAAA,CAAOC,WAAW,EAAEC,OAA0B,KACnDC,aAAa,CAAC,IAAIC,WAAW,CAAC,CAAC,CAACC,MAAM,CAACJ,WAAW,CAAC,EAAEC,OAAO,CAAC;EAC/DC,aAAa;EACbD,OAAO,EAAE;IACPf,GAAG,EAAE,CAAC,CAAC;IACPmB,GAAG,EAAE,CAAC;EACR;AACF,CAAC;AAED,SAASH,aAAaA,CAACL,IAAY,EAAEI,OAA0B,EAAE;EAAA,IAAAK,YAAA,EAAAC,YAAA,EAAAC,aAAA;EAC/D,MAAMC,GAAG,GAAG,IAAItB,SAAS,CAAC,CAAC,CAACuB,eAAe,CAACb,IAAI,EAAE,UAAU,CAAC;EAC7D,MAAMc,OAA0B,GAAGzB,GAAG,CAACuB,GAAG,CAAC;EAG3C,MAAMG,KAAK,GAAG,CAAAX,OAAO,aAAPA,OAAO,wBAAAK,YAAA,GAAPL,OAAO,CAAEI,GAAG,cAAAC,YAAA,uBAAZA,YAAA,CAAcO,MAAM,MAAIZ,OAAO,aAAPA,OAAO,wBAAAM,YAAA,GAAPN,OAAO,CAAEf,GAAG,cAAAqB,YAAA,uBAAZA,YAAA,CAAcO,IAAI,MAAIb,OAAO,aAAPA,OAAO,wBAAAO,aAAA,GAAPP,OAAO,CAAEf,GAAG,cAAAsB,aAAA,uBAAZA,aAAA,CAAcI,KAAK;EAC/E,QAAQA,KAAK;IACX,KAAK,kBAAkB;MAAE;QACvB,MAAMG,KAAqB,GAAG;UAC5BH,KAAK,EAAE,kBAAkB;UACzBI,IAAI,EAAEL,OAAO,CAACM;QAChB,CAAC;QACD,OAAOF,KAAK;MACd;IACA,KAAK,mBAAmB;MAAE;QACxB,MAAMA,KAAsB,GAAG;UAC7BH,KAAK,EAAE,mBAAmB;UAC1BI,IAAI,EAAEL,OAAO,CAACM;QAChB,CAAC;QACD,OAAOF,KAAK;MACd;IACA,KAAK,SAAS;MACZ,OAAOJ,OAAO;IAChB,KAAK,QAAQ;MACX,OAAO1B,eAAe,CAAC0B,OAAO,CAACM,QAAQ,CAAC;IAC1C,KAAK,KAAK;MACR,OAAOR,GAAG;IACZ;MAEE,OAAOE,OAAO;EAClB;AACF;AAEA,OAAO,MAAMO,mBAAqC,GAAG5B,SAAS"}
1
+ {"version":3,"file":"kml-loader.js","names":["kml","DOMParser","VERSION","KML_HEADER","KMLLoader","name","id","module","version","extensions","mimeTypes","text","tests","parse","arrayBuffer","options","parseTextSync","TextDecoder","decode","gis","_options$gis","_options$kml","_options$kml2","doc","parseFromString","geojson","shape","format","type","table","data","features"],"sources":["../../src/kml-loader.ts"],"sourcesContent":["import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\n// import {geojsonToBinary} from '@loaders.gl/gis';\n// import {GeoJSONRowTable} from '@loaders.gl/schema';\nimport {FeatureCollection, ObjectRowTable} from '@loaders.gl/schema';\nimport {kml} from '@tmcw/togeojson';\nimport {DOMParser} from '@xmldom/xmldom';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type KMLLoaderOptions = LoaderOptions & {\n kml?: {\n shape?: 'object-row-table' | 'geojson-row-table';\n /** @deprecated. Use options.kml.shape */\n type?: 'object-row-table' | 'geojson-row-table';\n };\n gis?: {\n /** @deprecated. Use options.kml.shape */\n format?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';\n };\n};\n\nconst KML_HEADER = `\\\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<kml xmlns=\"http://www.opengis.net/kml/2.2\">`;\n\n/**\n * Loader for KML (Keyhole Markup Language)\n */\nexport const KMLLoader: LoaderWithParser<ObjectRowTable, never, KMLLoaderOptions> = {\n name: 'KML (Keyhole Markup Language)',\n id: 'kml',\n module: 'kml',\n version: VERSION,\n extensions: ['kml'],\n mimeTypes: ['application/vnd.google-earth.kml+xml'],\n text: true,\n tests: [KML_HEADER],\n parse: async (arrayBuffer, options?: KMLLoaderOptions) =>\n parseTextSync(new TextDecoder().decode(arrayBuffer), options),\n parseTextSync,\n options: {\n kml: {},\n gis: {}\n }\n};\n\nfunction parseTextSync(text: string, options?: KMLLoaderOptions): ObjectRowTable {\n const doc = new DOMParser().parseFromString(text, 'text/xml');\n const geojson: FeatureCollection = kml(doc);\n\n // backwards compatibility\n const shape = options?.gis?.format || options?.kml?.type || options?.kml?.shape;\n switch (shape) {\n // case 'geojson-row-table': {\n // const table: GeoJSONRowTable = {\n // shape: 'geojson-row-table',\n // data: geojson.features\n // };\n // return table;\n // }\n // case 'geojson':\n // return geojson;\n // case 'binary':\n // return geojsonToBinary(geojson.features);\n // case 'raw':\n // return doc;\n case 'object-row-table':\n default:\n const table: ObjectRowTable = {\n shape: 'object-row-table',\n data: geojson.features\n };\n return table;\n }\n}\n"],"mappings":"AAIA,SAAQA,GAAG,QAAO,iBAAiB;AACnC,SAAQC,SAAS,QAAO,gBAAgB;AAIxC,MAAMC,OAAO,GAAG,uBAAkB,KAAK,WAAW,sBAAiB,QAAQ;AAc3E,MAAMC,UAAU,+FAE6B;AAK7C,OAAO,MAAMC,SAAoE,GAAG;EAClFC,IAAI,EAAE,+BAA+B;EACrCC,EAAE,EAAE,KAAK;EACTC,MAAM,EAAE,KAAK;EACbC,OAAO,EAAEN,OAAO;EAChBO,UAAU,EAAE,CAAC,KAAK,CAAC;EACnBC,SAAS,EAAE,CAAC,sCAAsC,CAAC;EACnDC,IAAI,EAAE,IAAI;EACVC,KAAK,EAAE,CAACT,UAAU,CAAC;EACnBU,KAAK,EAAE,MAAAA,CAAOC,WAAW,EAAEC,OAA0B,KACnDC,aAAa,CAAC,IAAIC,WAAW,CAAC,CAAC,CAACC,MAAM,CAACJ,WAAW,CAAC,EAAEC,OAAO,CAAC;EAC/DC,aAAa;EACbD,OAAO,EAAE;IACPf,GAAG,EAAE,CAAC,CAAC;IACPmB,GAAG,EAAE,CAAC;EACR;AACF,CAAC;AAED,SAASH,aAAaA,CAACL,IAAY,EAAEI,OAA0B,EAAkB;EAAA,IAAAK,YAAA,EAAAC,YAAA,EAAAC,aAAA;EAC/E,MAAMC,GAAG,GAAG,IAAItB,SAAS,CAAC,CAAC,CAACuB,eAAe,CAACb,IAAI,EAAE,UAAU,CAAC;EAC7D,MAAMc,OAA0B,GAAGzB,GAAG,CAACuB,GAAG,CAAC;EAG3C,MAAMG,KAAK,GAAG,CAAAX,OAAO,aAAPA,OAAO,wBAAAK,YAAA,GAAPL,OAAO,CAAEI,GAAG,cAAAC,YAAA,uBAAZA,YAAA,CAAcO,MAAM,MAAIZ,OAAO,aAAPA,OAAO,wBAAAM,YAAA,GAAPN,OAAO,CAAEf,GAAG,cAAAqB,YAAA,uBAAZA,YAAA,CAAcO,IAAI,MAAIb,OAAO,aAAPA,OAAO,wBAAAO,aAAA,GAAPP,OAAO,CAAEf,GAAG,cAAAsB,aAAA,uBAAZA,aAAA,CAAcI,KAAK;EAC/E,QAAQA,KAAK;IAcX,KAAK,kBAAkB;IACvB;MACE,MAAMG,KAAqB,GAAG;QAC5BH,KAAK,EAAE,kBAAkB;QACzBI,IAAI,EAAEL,OAAO,CAACM;MAChB,CAAC;MACD,OAAOF,KAAK;EAChB;AACF"}
@@ -1,7 +1,7 @@
1
1
  import { geojsonToBinary } from '@loaders.gl/gis';
2
2
  import { tcx } from '@tmcw/togeojson';
3
3
  import { DOMParser } from '@xmldom/xmldom';
4
- const VERSION = typeof "4.0.0-alpha.21" !== 'undefined' ? "4.0.0-alpha.21" : 'latest';
4
+ const VERSION = typeof "4.0.0-alpha.23" !== 'undefined' ? "4.0.0-alpha.23" : 'latest';
5
5
  const TCX_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<TrainingCenterDatabase";
6
6
  export const TCXLoader = {
7
7
  name: 'TCX (Training Center XML)',
@@ -51,5 +51,4 @@ function parseTextSync(text, options) {
51
51
  return geojson;
52
52
  }
53
53
  }
54
- export const _typecheckTCXLoader = TCXLoader;
55
54
  //# sourceMappingURL=tcx-loader.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tcx-loader.js","names":["geojsonToBinary","tcx","DOMParser","VERSION","TCX_HEADER","TCXLoader","name","id","module","version","extensions","mimeTypes","text","tests","parse","arrayBuffer","options","parseTextSync","TextDecoder","decode","gis","_options$gis","_options$tcx","_options$tcx2","doc","parseFromString","geojson","shape","format","type","table","data","features","_typecheckTCXLoader"],"sources":["../../src/tcx-loader.ts"],"sourcesContent":["import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport {geojsonToBinary} from '@loaders.gl/gis';\nimport type {GeoJSONRowTable, FeatureCollection, ObjectRowTable} from '@loaders.gl/schema';\nimport {tcx} from '@tmcw/togeojson';\nimport {DOMParser} from '@xmldom/xmldom';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type TCXLoaderOptions = LoaderOptions & {\n tcx?: {\n shape?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';\n /** @deprecated. Use options.tcx.shape */\n type?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';\n };\n gis?: {\n /** @deprecated. Use options.tcx.shape */\n format?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';\n };\n};\n\nconst TCX_HEADER = `\\\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<TrainingCenterDatabase`;\n\n/**\n * Loader for TCX (Training Center XML) - Garmin GPS track format\n */\nexport const TCXLoader = {\n name: 'TCX (Training Center XML)',\n id: 'tcx',\n module: 'kml',\n version: VERSION,\n extensions: ['tcx'],\n mimeTypes: ['application/vnd.garmin.tcx+xml'],\n text: true,\n tests: [TCX_HEADER],\n parse: async (arrayBuffer, options?: TCXLoaderOptions) =>\n parseTextSync(new TextDecoder().decode(arrayBuffer), options),\n parseTextSync,\n options: {\n tcx: {},\n gis: {}\n }\n};\n\nfunction parseTextSync(text: string, options?: TCXLoaderOptions) {\n const doc = new DOMParser().parseFromString(text, 'text/xml');\n const geojson: FeatureCollection = tcx(doc);\n\n // backwards compatibility\n const shape = options?.gis?.format || options?.tcx?.type || options?.tcx?.shape;\n\n switch (shape) {\n case 'object-row-table': {\n const table: ObjectRowTable = {\n shape: 'object-row-table',\n data: geojson.features\n };\n return table;\n }\n case 'geojson-row-table': {\n const table: GeoJSONRowTable = {\n shape: 'geojson-row-table',\n data: geojson.features\n };\n return table;\n }\n case 'geojson':\n return geojson;\n case 'binary':\n return geojsonToBinary(geojson.features);\n case 'raw':\n return doc;\n default:\n // Default to geojson for backwards compatibility\n return geojson;\n }\n}\n\nexport const _typecheckTCXLoader: LoaderWithParser = TCXLoader;\n"],"mappings":"AACA,SAAQA,eAAe,QAAO,iBAAiB;AAE/C,SAAQC,GAAG,QAAO,iBAAiB;AACnC,SAAQC,SAAS,QAAO,gBAAgB;AAIxC,MAAMC,OAAO,GAAG,uBAAkB,KAAK,WAAW,sBAAiB,QAAQ;AAc3E,MAAMC,UAAU,wEAEQ;AAKxB,OAAO,MAAMC,SAAS,GAAG;EACvBC,IAAI,EAAE,2BAA2B;EACjCC,EAAE,EAAE,KAAK;EACTC,MAAM,EAAE,KAAK;EACbC,OAAO,EAAEN,OAAO;EAChBO,UAAU,EAAE,CAAC,KAAK,CAAC;EACnBC,SAAS,EAAE,CAAC,gCAAgC,CAAC;EAC7CC,IAAI,EAAE,IAAI;EACVC,KAAK,EAAE,CAACT,UAAU,CAAC;EACnBU,KAAK,EAAE,MAAAA,CAAOC,WAAW,EAAEC,OAA0B,KACnDC,aAAa,CAAC,IAAIC,WAAW,CAAC,CAAC,CAACC,MAAM,CAACJ,WAAW,CAAC,EAAEC,OAAO,CAAC;EAC/DC,aAAa;EACbD,OAAO,EAAE;IACPf,GAAG,EAAE,CAAC,CAAC;IACPmB,GAAG,EAAE,CAAC;EACR;AACF,CAAC;AAED,SAASH,aAAaA,CAACL,IAAY,EAAEI,OAA0B,EAAE;EAAA,IAAAK,YAAA,EAAAC,YAAA,EAAAC,aAAA;EAC/D,MAAMC,GAAG,GAAG,IAAItB,SAAS,CAAC,CAAC,CAACuB,eAAe,CAACb,IAAI,EAAE,UAAU,CAAC;EAC7D,MAAMc,OAA0B,GAAGzB,GAAG,CAACuB,GAAG,CAAC;EAG3C,MAAMG,KAAK,GAAG,CAAAX,OAAO,aAAPA,OAAO,wBAAAK,YAAA,GAAPL,OAAO,CAAEI,GAAG,cAAAC,YAAA,uBAAZA,YAAA,CAAcO,MAAM,MAAIZ,OAAO,aAAPA,OAAO,wBAAAM,YAAA,GAAPN,OAAO,CAAEf,GAAG,cAAAqB,YAAA,uBAAZA,YAAA,CAAcO,IAAI,MAAIb,OAAO,aAAPA,OAAO,wBAAAO,aAAA,GAAPP,OAAO,CAAEf,GAAG,cAAAsB,aAAA,uBAAZA,aAAA,CAAcI,KAAK;EAE/E,QAAQA,KAAK;IACX,KAAK,kBAAkB;MAAE;QACvB,MAAMG,KAAqB,GAAG;UAC5BH,KAAK,EAAE,kBAAkB;UACzBI,IAAI,EAAEL,OAAO,CAACM;QAChB,CAAC;QACD,OAAOF,KAAK;MACd;IACA,KAAK,mBAAmB;MAAE;QACxB,MAAMA,KAAsB,GAAG;UAC7BH,KAAK,EAAE,mBAAmB;UAC1BI,IAAI,EAAEL,OAAO,CAACM;QAChB,CAAC;QACD,OAAOF,KAAK;MACd;IACA,KAAK,SAAS;MACZ,OAAOJ,OAAO;IAChB,KAAK,QAAQ;MACX,OAAO1B,eAAe,CAAC0B,OAAO,CAACM,QAAQ,CAAC;IAC1C,KAAK,KAAK;MACR,OAAOR,GAAG;IACZ;MAEE,OAAOE,OAAO;EAClB;AACF;AAEA,OAAO,MAAMO,mBAAqC,GAAG5B,SAAS"}
1
+ {"version":3,"file":"tcx-loader.js","names":["geojsonToBinary","tcx","DOMParser","VERSION","TCX_HEADER","TCXLoader","name","id","module","version","extensions","mimeTypes","text","tests","parse","arrayBuffer","options","parseTextSync","TextDecoder","decode","gis","_options$gis","_options$tcx","_options$tcx2","doc","parseFromString","geojson","shape","format","type","table","data","features"],"sources":["../../src/tcx-loader.ts"],"sourcesContent":["import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport {geojsonToBinary} from '@loaders.gl/gis';\nimport type {GeoJSONRowTable, FeatureCollection, ObjectRowTable} from '@loaders.gl/schema';\nimport {tcx} from '@tmcw/togeojson';\nimport {DOMParser} from '@xmldom/xmldom';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type TCXLoaderOptions = LoaderOptions & {\n tcx?: {\n shape?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';\n /** @deprecated. Use options.tcx.shape */\n type?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';\n };\n gis?: {\n /** @deprecated. Use options.tcx.shape */\n format?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';\n };\n};\n\nconst TCX_HEADER = `\\\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<TrainingCenterDatabase`;\n\n/**\n * Loader for TCX (Training Center XML) - Garmin GPS track format\n */\nexport const TCXLoader: LoaderWithParser = {\n name: 'TCX (Training Center XML)',\n id: 'tcx',\n module: 'kml',\n version: VERSION,\n extensions: ['tcx'],\n mimeTypes: ['application/vnd.garmin.tcx+xml'],\n text: true,\n tests: [TCX_HEADER],\n parse: async (arrayBuffer, options?: TCXLoaderOptions) =>\n parseTextSync(new TextDecoder().decode(arrayBuffer), options),\n parseTextSync,\n options: {\n tcx: {},\n gis: {}\n }\n};\n\nfunction parseTextSync(text: string, options?: TCXLoaderOptions) {\n const doc = new DOMParser().parseFromString(text, 'text/xml');\n const geojson: FeatureCollection = tcx(doc);\n\n // backwards compatibility\n const shape = options?.gis?.format || options?.tcx?.type || options?.tcx?.shape;\n\n switch (shape) {\n case 'object-row-table': {\n const table: ObjectRowTable = {\n shape: 'object-row-table',\n data: geojson.features\n };\n return table;\n }\n case 'geojson-row-table': {\n const table: GeoJSONRowTable = {\n shape: 'geojson-row-table',\n data: geojson.features\n };\n return table;\n }\n case 'geojson':\n return geojson;\n case 'binary':\n return geojsonToBinary(geojson.features);\n case 'raw':\n return doc;\n default:\n // Default to geojson for backwards compatibility\n return geojson;\n }\n}\n"],"mappings":"AACA,SAA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BAAAO,aAAA,GAAPP,OAAO,CAAEf,GAAG,cAAAsB,aAAA,uBAAZA,aAAA,CAAcI,KAAK;EAE/E,QAAQA,KAAK;IACX,KAAK,kBAAkB;MAAE;QACvB,MAAMG,KAAqB,GAAG;UAC5BH,KAAK,EAAE,kBAAkB;UACzBI,IAAI,EAAEL,OAAO,CAACM;QAChB,CAAC;QACD,OAAOF,KAAK;MACd;IACA,KAAK,mBAAmB;MAAE;QACxB,MAAMA,KAAsB,GAAG;UAC7BH,KAAK,EAAE,mBAAmB;UAC1BI,IAAI,EAAEL,OAAO,CAACM;QAChB,CAAC;QACD,OAAOF,KAAK;MACd;IACA,KAAK,SAAS;MACZ,OAAOJ,OAAO;IAChB,KAAK,QAAQ;MACX,OAAO1B,eAAe,CAAC0B,OAAO,CAACM,QAAQ,CAAC;IAC1C,KAAK,KAAK;MACR,OAAOR,GAAG;IACZ;MAEE,OAAOE,OAAO;EAClB;AACF"}
@@ -1,5 +1,4 @@
1
1
  import type { LoaderOptions, LoaderWithParser } from '@loaders.gl/loader-utils';
2
- import type { GeoJSONRowTable, FeatureCollection, ObjectRowTable } from '@loaders.gl/schema';
3
2
  export type GPXLoaderOptions = LoaderOptions & {
4
3
  gpx?: {
5
4
  shape?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';
@@ -14,23 +13,5 @@ export type GPXLoaderOptions = LoaderOptions & {
14
13
  /**
15
14
  * Loader for GPX (GPS exchange format)
16
15
  */
17
- export declare const GPXLoader: {
18
- name: string;
19
- id: string;
20
- module: string;
21
- version: any;
22
- extensions: string[];
23
- mimeTypes: string[];
24
- text: boolean;
25
- tests: string[];
26
- parse: (arrayBuffer: any, options?: GPXLoaderOptions) => Promise<Document | FeatureCollection<import("geojson").Geometry, import("geojson").GeoJsonProperties> | ObjectRowTable | GeoJSONRowTable | import("@loaders.gl/schema").BinaryFeatures>;
27
- parseTextSync: typeof parseTextSync;
28
- options: {
29
- gpx: {};
30
- gis: {};
31
- };
32
- };
33
- declare function parseTextSync(text: string, options?: GPXLoaderOptions): Document | FeatureCollection<import("geojson").Geometry, import("geojson").GeoJsonProperties> | ObjectRowTable | GeoJSONRowTable | import("@loaders.gl/schema").BinaryFeatures;
34
- export declare const _typecheckGPXLoader: LoaderWithParser;
35
- export {};
16
+ export declare const GPXLoader: LoaderWithParser;
36
17
  //# sourceMappingURL=gpx-loader.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"gpx-loader.d.ts","sourceRoot":"","sources":["../src/gpx-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,EAAE,gBAAgB,EAAC,MAAM,0BAA0B,CAAC;AAE9E,OAAO,KAAK,EAAC,eAAe,EAAE,iBAAiB,EAAE,cAAc,EAAC,MAAM,oBAAoB,CAAC;AAQ3F,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG;IAC7C,GAAG,CAAC,EAAE;QACJ,KAAK,CAAC,EAAE,kBAAkB,GAAG,mBAAmB,GAAG,SAAS,GAAG,QAAQ,GAAG,KAAK,CAAC;QAChF,yCAAyC;QACzC,IAAI,CAAC,EAAE,kBAAkB,GAAG,mBAAmB,GAAG,SAAS,GAAG,QAAQ,GAAG,KAAK,CAAC;KAChF,CAAC;IACF,GAAG,CAAC,EAAE;QACJ,yCAAyC;QACzC,MAAM,CAAC,EAAE,kBAAkB,GAAG,mBAAmB,GAAG,SAAS,GAAG,QAAQ,GAAG,KAAK,CAAC;KAClF,CAAC;CACH,CAAC;AAMF;;GAEG;AACH,eAAO,MAAM,SAAS;;;;;;;;;wCASiB,gBAAgB;;;;;;CAOtD,CAAC;AAEF,iBAAS,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB,kLA+B9D;AAED,eAAO,MAAM,mBAAmB,EAAE,gBAA4B,CAAC"}
1
+ {"version":3,"file":"gpx-loader.d.ts","sourceRoot":"","sources":["../src/gpx-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,EAAE,gBAAgB,EAAC,MAAM,0BAA0B,CAAC;AAU9E,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG;IAC7C,GAAG,CAAC,EAAE;QACJ,KAAK,CAAC,EAAE,kBAAkB,GAAG,mBAAmB,GAAG,SAAS,GAAG,QAAQ,GAAG,KAAK,CAAC;QAChF,yCAAyC;QACzC,IAAI,CAAC,EAAE,kBAAkB,GAAG,mBAAmB,GAAG,SAAS,GAAG,QAAQ,GAAG,KAAK,CAAC;KAChF,CAAC;IACF,GAAG,CAAC,EAAE;QACJ,yCAAyC;QACzC,MAAM,CAAC,EAAE,kBAAkB,GAAG,mBAAmB,GAAG,SAAS,GAAG,QAAQ,GAAG,KAAK,CAAC;KAClF,CAAC;CACH,CAAC;AAMF;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,gBAgBvB,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports._typecheckGPXLoader = exports.GPXLoader = void 0;
3
+ exports.GPXLoader = void 0;
4
4
  const gis_1 = require("@loaders.gl/gis");
5
5
  const togeojson_1 = require("@tmcw/togeojson");
6
6
  const xmldom_1 = require("@xmldom/xmldom");
@@ -59,4 +59,3 @@ function parseTextSync(text, options) {
59
59
  return geojson;
60
60
  }
61
61
  }
62
- exports._typecheckGPXLoader = exports.GPXLoader;
@@ -1,10 +1,10 @@
1
1
  import type { LoaderWithParser, LoaderOptions } from '@loaders.gl/loader-utils';
2
- import { GeoJSONRowTable, FeatureCollection, ObjectRowTable } from '@loaders.gl/schema';
2
+ import { ObjectRowTable } from '@loaders.gl/schema';
3
3
  export type KMLLoaderOptions = LoaderOptions & {
4
4
  kml?: {
5
- shape?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';
5
+ shape?: 'object-row-table' | 'geojson-row-table';
6
6
  /** @deprecated. Use options.kml.shape */
7
- type?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';
7
+ type?: 'object-row-table' | 'geojson-row-table';
8
8
  };
9
9
  gis?: {
10
10
  /** @deprecated. Use options.kml.shape */
@@ -14,23 +14,5 @@ export type KMLLoaderOptions = LoaderOptions & {
14
14
  /**
15
15
  * Loader for KML (Keyhole Markup Language)
16
16
  */
17
- export declare const KMLLoader: {
18
- name: string;
19
- id: string;
20
- module: string;
21
- version: any;
22
- extensions: string[];
23
- mimeTypes: string[];
24
- text: boolean;
25
- tests: string[];
26
- parse: (arrayBuffer: any, options?: KMLLoaderOptions) => Promise<Document | FeatureCollection<import("geojson").Geometry, import("geojson").GeoJsonProperties> | ObjectRowTable | GeoJSONRowTable | import("@loaders.gl/schema").BinaryFeatures>;
27
- parseTextSync: typeof parseTextSync;
28
- options: {
29
- kml: {};
30
- gis: {};
31
- };
32
- };
33
- declare function parseTextSync(text: string, options?: KMLLoaderOptions): Document | FeatureCollection<import("geojson").Geometry, import("geojson").GeoJsonProperties> | ObjectRowTable | GeoJSONRowTable | import("@loaders.gl/schema").BinaryFeatures;
34
- export declare const _typecheckKMLLoader: LoaderWithParser;
35
- export {};
17
+ export declare const KMLLoader: LoaderWithParser<ObjectRowTable, never, KMLLoaderOptions>;
36
18
  //# sourceMappingURL=kml-loader.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"kml-loader.d.ts","sourceRoot":"","sources":["../src/kml-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,gBAAgB,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAE9E,OAAO,EAAC,eAAe,EAAE,iBAAiB,EAAE,cAAc,EAAC,MAAM,oBAAoB,CAAC;AAQtF,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG;IAC7C,GAAG,CAAC,EAAE;QACJ,KAAK,CAAC,EAAE,kBAAkB,GAAG,mBAAmB,GAAG,SAAS,GAAG,QAAQ,GAAG,KAAK,CAAC;QAChF,yCAAyC;QACzC,IAAI,CAAC,EAAE,kBAAkB,GAAG,mBAAmB,GAAG,SAAS,GAAG,QAAQ,GAAG,KAAK,CAAC;KAChF,CAAC;IACF,GAAG,CAAC,EAAE;QACJ,yCAAyC;QACzC,MAAM,CAAC,EAAE,kBAAkB,GAAG,mBAAmB,GAAG,SAAS,GAAG,QAAQ,GAAG,KAAK,CAAC;KAClF,CAAC;CACH,CAAC;AAMF;;GAEG;AACH,eAAO,MAAM,SAAS;;;;;;;;;wCASiB,gBAAgB;;;;;;CAOtD,CAAC;AAEF,iBAAS,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB,kLA+B9D;AAED,eAAO,MAAM,mBAAmB,EAAE,gBAA4B,CAAC"}
1
+ {"version":3,"file":"kml-loader.d.ts","sourceRoot":"","sources":["../src/kml-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,gBAAgB,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAG9E,OAAO,EAAoB,cAAc,EAAC,MAAM,oBAAoB,CAAC;AAQrE,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG;IAC7C,GAAG,CAAC,EAAE;QACJ,KAAK,CAAC,EAAE,kBAAkB,GAAG,mBAAmB,CAAC;QACjD,yCAAyC;QACzC,IAAI,CAAC,EAAE,kBAAkB,GAAG,mBAAmB,CAAC;KACjD,CAAC;IACF,GAAG,CAAC,EAAE;QACJ,yCAAyC;QACzC,MAAM,CAAC,EAAE,kBAAkB,GAAG,mBAAmB,GAAG,SAAS,GAAG,QAAQ,GAAG,KAAK,CAAC;KAClF,CAAC;CACH,CAAC;AAMF;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,gBAAgB,CAAC,cAAc,EAAE,KAAK,EAAE,gBAAgB,CAgB/E,CAAC"}
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports._typecheckKMLLoader = exports.KMLLoader = void 0;
4
- const gis_1 = require("@loaders.gl/gis");
3
+ exports.KMLLoader = void 0;
5
4
  const togeojson_1 = require("@tmcw/togeojson");
6
5
  const xmldom_1 = require("@xmldom/xmldom");
7
6
  // __VERSION__ is injected by babel-plugin-version-inline
@@ -35,29 +34,25 @@ function parseTextSync(text, options) {
35
34
  // backwards compatibility
36
35
  const shape = options?.gis?.format || options?.kml?.type || options?.kml?.shape;
37
36
  switch (shape) {
38
- case 'object-row-table': {
37
+ // case 'geojson-row-table': {
38
+ // const table: GeoJSONRowTable = {
39
+ // shape: 'geojson-row-table',
40
+ // data: geojson.features
41
+ // };
42
+ // return table;
43
+ // }
44
+ // case 'geojson':
45
+ // return geojson;
46
+ // case 'binary':
47
+ // return geojsonToBinary(geojson.features);
48
+ // case 'raw':
49
+ // return doc;
50
+ case 'object-row-table':
51
+ default:
39
52
  const table = {
40
53
  shape: 'object-row-table',
41
54
  data: geojson.features
42
55
  };
43
56
  return table;
44
- }
45
- case 'geojson-row-table': {
46
- const table = {
47
- shape: 'geojson-row-table',
48
- data: geojson.features
49
- };
50
- return table;
51
- }
52
- case 'geojson':
53
- return geojson;
54
- case 'binary':
55
- return (0, gis_1.geojsonToBinary)(geojson.features);
56
- case 'raw':
57
- return doc;
58
- default:
59
- // Default to geojson for backwards compatibility
60
- return geojson;
61
57
  }
62
58
  }
63
- exports._typecheckKMLLoader = exports.KMLLoader;
@@ -1,5 +1,4 @@
1
1
  import type { LoaderWithParser, LoaderOptions } from '@loaders.gl/loader-utils';
2
- import type { GeoJSONRowTable, FeatureCollection, ObjectRowTable } from '@loaders.gl/schema';
3
2
  export type TCXLoaderOptions = LoaderOptions & {
4
3
  tcx?: {
5
4
  shape?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';
@@ -14,23 +13,5 @@ export type TCXLoaderOptions = LoaderOptions & {
14
13
  /**
15
14
  * Loader for TCX (Training Center XML) - Garmin GPS track format
16
15
  */
17
- export declare const TCXLoader: {
18
- name: string;
19
- id: string;
20
- module: string;
21
- version: any;
22
- extensions: string[];
23
- mimeTypes: string[];
24
- text: boolean;
25
- tests: string[];
26
- parse: (arrayBuffer: any, options?: TCXLoaderOptions) => Promise<Document | FeatureCollection<import("geojson").Geometry, import("geojson").GeoJsonProperties> | ObjectRowTable | GeoJSONRowTable | import("@loaders.gl/schema").BinaryFeatures>;
27
- parseTextSync: typeof parseTextSync;
28
- options: {
29
- tcx: {};
30
- gis: {};
31
- };
32
- };
33
- declare function parseTextSync(text: string, options?: TCXLoaderOptions): Document | FeatureCollection<import("geojson").Geometry, import("geojson").GeoJsonProperties> | ObjectRowTable | GeoJSONRowTable | import("@loaders.gl/schema").BinaryFeatures;
34
- export declare const _typecheckTCXLoader: LoaderWithParser;
35
- export {};
16
+ export declare const TCXLoader: LoaderWithParser;
36
17
  //# sourceMappingURL=tcx-loader.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tcx-loader.d.ts","sourceRoot":"","sources":["../src/tcx-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,gBAAgB,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAE9E,OAAO,KAAK,EAAC,eAAe,EAAE,iBAAiB,EAAE,cAAc,EAAC,MAAM,oBAAoB,CAAC;AAQ3F,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG;IAC7C,GAAG,CAAC,EAAE;QACJ,KAAK,CAAC,EAAE,kBAAkB,GAAG,mBAAmB,GAAG,SAAS,GAAG,QAAQ,GAAG,KAAK,CAAC;QAChF,yCAAyC;QACzC,IAAI,CAAC,EAAE,kBAAkB,GAAG,mBAAmB,GAAG,SAAS,GAAG,QAAQ,GAAG,KAAK,CAAC;KAChF,CAAC;IACF,GAAG,CAAC,EAAE;QACJ,yCAAyC;QACzC,MAAM,CAAC,EAAE,kBAAkB,GAAG,mBAAmB,GAAG,SAAS,GAAG,QAAQ,GAAG,KAAK,CAAC;KAClF,CAAC;CACH,CAAC;AAMF;;GAEG;AACH,eAAO,MAAM,SAAS;;;;;;;;;wCASiB,gBAAgB;;;;;;CAOtD,CAAC;AAEF,iBAAS,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB,kLAgC9D;AAED,eAAO,MAAM,mBAAmB,EAAE,gBAA4B,CAAC"}
1
+ {"version":3,"file":"tcx-loader.d.ts","sourceRoot":"","sources":["../src/tcx-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,gBAAgB,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAU9E,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG;IAC7C,GAAG,CAAC,EAAE;QACJ,KAAK,CAAC,EAAE,kBAAkB,GAAG,mBAAmB,GAAG,SAAS,GAAG,QAAQ,GAAG,KAAK,CAAC;QAChF,yCAAyC;QACzC,IAAI,CAAC,EAAE,kBAAkB,GAAG,mBAAmB,GAAG,SAAS,GAAG,QAAQ,GAAG,KAAK,CAAC;KAChF,CAAC;IACF,GAAG,CAAC,EAAE;QACJ,yCAAyC;QACzC,MAAM,CAAC,EAAE,kBAAkB,GAAG,mBAAmB,GAAG,SAAS,GAAG,QAAQ,GAAG,KAAK,CAAC;KAClF,CAAC;CACH,CAAC;AAMF;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,gBAgBvB,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports._typecheckTCXLoader = exports.TCXLoader = void 0;
3
+ exports.TCXLoader = void 0;
4
4
  const gis_1 = require("@loaders.gl/gis");
5
5
  const togeojson_1 = require("@tmcw/togeojson");
6
6
  const xmldom_1 = require("@xmldom/xmldom");
@@ -60,4 +60,3 @@ function parseTextSync(text, options) {
60
60
  return geojson;
61
61
  }
62
62
  }
63
- exports._typecheckTCXLoader = exports.TCXLoader;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loaders.gl/kml",
3
- "version": "4.0.0-alpha.21",
3
+ "version": "4.0.0-alpha.23",
4
4
  "description": "Framework-independent loader for the KML format",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -32,11 +32,11 @@
32
32
  "build-bundle": "esbuild src/bundle.ts --bundle --outfile=dist/dist.min.js"
33
33
  },
34
34
  "dependencies": {
35
- "@loaders.gl/gis": "4.0.0-alpha.21",
36
- "@loaders.gl/loader-utils": "4.0.0-alpha.21",
37
- "@loaders.gl/schema": "4.0.0-alpha.21",
35
+ "@loaders.gl/gis": "4.0.0-alpha.23",
36
+ "@loaders.gl/loader-utils": "4.0.0-alpha.23",
37
+ "@loaders.gl/schema": "4.0.0-alpha.23",
38
38
  "@tmcw/togeojson": "^4.5.0",
39
39
  "@xmldom/xmldom": "^0.7.13"
40
40
  },
41
- "gitHead": "df5d670b136192b26941396e944f9c46be788e83"
41
+ "gitHead": "e212f2a0c0e342f7cb65ce84fa2ff39f64b7d94b"
42
42
  }
package/src/gpx-loader.ts CHANGED
@@ -27,7 +27,7 @@ const GPX_HEADER = `\
27
27
  /**
28
28
  * Loader for GPX (GPS exchange format)
29
29
  */
30
- export const GPXLoader = {
30
+ export const GPXLoader: LoaderWithParser = {
31
31
  name: 'GPX (GPS exchange format)',
32
32
  id: 'gpx',
33
33
  module: 'kml',
@@ -77,5 +77,3 @@ function parseTextSync(text: string, options?: GPXLoaderOptions) {
77
77
  return geojson;
78
78
  }
79
79
  }
80
-
81
- export const _typecheckGPXLoader: LoaderWithParser = GPXLoader;
package/src/kml-loader.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';
2
- import {geojsonToBinary} from '@loaders.gl/gis';
3
- import {GeoJSONRowTable, FeatureCollection, ObjectRowTable} from '@loaders.gl/schema';
2
+ // import {geojsonToBinary} from '@loaders.gl/gis';
3
+ // import {GeoJSONRowTable} from '@loaders.gl/schema';
4
+ import {FeatureCollection, ObjectRowTable} from '@loaders.gl/schema';
4
5
  import {kml} from '@tmcw/togeojson';
5
6
  import {DOMParser} from '@xmldom/xmldom';
6
7
 
@@ -10,9 +11,9 @@ const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';
10
11
 
11
12
  export type KMLLoaderOptions = LoaderOptions & {
12
13
  kml?: {
13
- shape?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';
14
+ shape?: 'object-row-table' | 'geojson-row-table';
14
15
  /** @deprecated. Use options.kml.shape */
15
- type?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';
16
+ type?: 'object-row-table' | 'geojson-row-table';
16
17
  };
17
18
  gis?: {
18
19
  /** @deprecated. Use options.kml.shape */
@@ -27,7 +28,7 @@ const KML_HEADER = `\
27
28
  /**
28
29
  * Loader for KML (Keyhole Markup Language)
29
30
  */
30
- export const KMLLoader = {
31
+ export const KMLLoader: LoaderWithParser<ObjectRowTable, never, KMLLoaderOptions> = {
31
32
  name: 'KML (Keyhole Markup Language)',
32
33
  id: 'kml',
33
34
  module: 'kml',
@@ -45,37 +46,32 @@ export const KMLLoader = {
45
46
  }
46
47
  };
47
48
 
48
- function parseTextSync(text: string, options?: KMLLoaderOptions) {
49
+ function parseTextSync(text: string, options?: KMLLoaderOptions): ObjectRowTable {
49
50
  const doc = new DOMParser().parseFromString(text, 'text/xml');
50
51
  const geojson: FeatureCollection = kml(doc);
51
52
 
52
53
  // backwards compatibility
53
54
  const shape = options?.gis?.format || options?.kml?.type || options?.kml?.shape;
54
55
  switch (shape) {
55
- case 'object-row-table': {
56
+ // case 'geojson-row-table': {
57
+ // const table: GeoJSONRowTable = {
58
+ // shape: 'geojson-row-table',
59
+ // data: geojson.features
60
+ // };
61
+ // return table;
62
+ // }
63
+ // case 'geojson':
64
+ // return geojson;
65
+ // case 'binary':
66
+ // return geojsonToBinary(geojson.features);
67
+ // case 'raw':
68
+ // return doc;
69
+ case 'object-row-table':
70
+ default:
56
71
  const table: ObjectRowTable = {
57
72
  shape: 'object-row-table',
58
73
  data: geojson.features
59
74
  };
60
75
  return table;
61
- }
62
- case 'geojson-row-table': {
63
- const table: GeoJSONRowTable = {
64
- shape: 'geojson-row-table',
65
- data: geojson.features
66
- };
67
- return table;
68
- }
69
- case 'geojson':
70
- return geojson;
71
- case 'binary':
72
- return geojsonToBinary(geojson.features);
73
- case 'raw':
74
- return doc;
75
- default:
76
- // Default to geojson for backwards compatibility
77
- return geojson;
78
76
  }
79
77
  }
80
-
81
- export const _typecheckKMLLoader: LoaderWithParser = KMLLoader;
package/src/tcx-loader.ts CHANGED
@@ -27,7 +27,7 @@ const TCX_HEADER = `\
27
27
  /**
28
28
  * Loader for TCX (Training Center XML) - Garmin GPS track format
29
29
  */
30
- export const TCXLoader = {
30
+ export const TCXLoader: LoaderWithParser = {
31
31
  name: 'TCX (Training Center XML)',
32
32
  id: 'tcx',
33
33
  module: 'kml',
@@ -78,5 +78,3 @@ function parseTextSync(text: string, options?: TCXLoaderOptions) {
78
78
  return geojson;
79
79
  }
80
80
  }
81
-
82
- export const _typecheckTCXLoader: LoaderWithParser = TCXLoader;