@loaders.gl/kml 3.4.0-alpha.2 → 3.4.0-alpha.4
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 +22 -0
- package/dist/es5/gpx-loader.js +7 -10
- package/dist/es5/gpx-loader.js.map +1 -1
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/kml-loader.js +7 -11
- package/dist/es5/kml-loader.js.map +1 -1
- package/dist/es5/tcx-loader.js +7 -11
- package/dist/es5/tcx-loader.js.map +1 -1
- package/dist/esm/bundle.js +0 -1
- package/dist/esm/bundle.js.map +1 -1
- package/dist/esm/gpx-loader.js +1 -2
- package/dist/esm/gpx-loader.js.map +1 -1
- package/dist/esm/kml-loader.js +1 -3
- package/dist/esm/kml-loader.js.map +1 -1
- package/dist/esm/tcx-loader.js +1 -3
- package/dist/esm/tcx-loader.js.map +1 -1
- package/package.json +5 -5
package/dist/dist.min.js
CHANGED
|
@@ -13,9 +13,31 @@
|
|
|
13
13
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
+
// ../../node_modules/@babel/runtime/helpers/esm/typeof.js
|
|
17
|
+
var init_typeof = __esm({
|
|
18
|
+
"../../node_modules/@babel/runtime/helpers/esm/typeof.js"() {
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
// ../../node_modules/@babel/runtime/helpers/esm/toPrimitive.js
|
|
23
|
+
var init_toPrimitive = __esm({
|
|
24
|
+
"../../node_modules/@babel/runtime/helpers/esm/toPrimitive.js"() {
|
|
25
|
+
init_typeof();
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
// ../../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
|
|
30
|
+
var init_toPropertyKey = __esm({
|
|
31
|
+
"../../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js"() {
|
|
32
|
+
init_typeof();
|
|
33
|
+
init_toPrimitive();
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
|
|
16
37
|
// ../../node_modules/@babel/runtime/helpers/esm/defineProperty.js
|
|
17
38
|
var init_defineProperty = __esm({
|
|
18
39
|
"../../node_modules/@babel/runtime/helpers/esm/defineProperty.js"() {
|
|
40
|
+
init_toPropertyKey();
|
|
19
41
|
}
|
|
20
42
|
});
|
|
21
43
|
|
package/dist/es5/gpx-loader.js
CHANGED
|
@@ -9,9 +9,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
|
-
var VERSION = typeof "3.4.0-alpha.
|
|
12
|
+
var VERSION = typeof "3.4.0-alpha.4" !== 'undefined' ? "3.4.0-alpha.4" : 'latest';
|
|
13
13
|
var GPX_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<gpx";
|
|
14
|
-
|
|
15
14
|
var GPXLoader = {
|
|
16
15
|
name: 'GPX (GPS exchange format)',
|
|
17
16
|
id: 'gpx',
|
|
@@ -24,14 +23,12 @@ var GPXLoader = {
|
|
|
24
23
|
parse: function () {
|
|
25
24
|
var _parse = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(arrayBuffer, options) {
|
|
26
25
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
27
|
-
while (1) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
return _context.stop();
|
|
34
|
-
}
|
|
26
|
+
while (1) switch (_context.prev = _context.next) {
|
|
27
|
+
case 0:
|
|
28
|
+
return _context.abrupt("return", parseTextSync(new TextDecoder().decode(arrayBuffer), options));
|
|
29
|
+
case 1:
|
|
30
|
+
case "end":
|
|
31
|
+
return _context.stop();
|
|
35
32
|
}
|
|
36
33
|
}, _callee);
|
|
37
34
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gpx-loader.js","names":["VERSION","GPX_HEADER","GPXLoader","name","id","module","version","extensions","mimeTypes","text","tests","parse","arrayBuffer","options","parseTextSync","TextDecoder","decode","gpx","gis","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 {gpx} from '@tmcw/togeojson';\nimport type {GeoJSONRowTable, FeatureCollection, ObjectRowTable} from '@loaders.gl/schema';\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;AACA;AAKA,
|
|
1
|
+
{"version":3,"file":"gpx-loader.js","names":["_gis","require","_togeojson","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 {gpx} from '@tmcw/togeojson';\nimport type {GeoJSONRowTable, FeatureCollection, ObjectRowTable} from '@loaders.gl/schema';\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;AACA,IAAAC,UAAA,GAAAD,OAAA;AAKA,IAAME,OAAO,GAAG,sBAAkB,KAAK,WAAW,qBAAiB,QAAQ;AAc3E,IAAMC,UAAU,qDAEX;AAKE,IAAMC,SAAS,GAAG;EACvBC,IAAI,EAAE,2BAA2B;EACjCC,EAAE,EAAE,KAAK;EACTC,MAAM,EAAE,KAAK;E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kB,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;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"}
|
package/dist/es5/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/index.ts"],"sourcesContent":["export type {GPXLoaderOptions} from './gpx-loader';\nexport {GPXLoader} from './gpx-loader';\n\nexport type {KMLLoaderOptions} from './kml-loader';\nexport {KMLLoader} from './kml-loader';\n\nexport type {TCXLoaderOptions} from './tcx-loader';\nexport {TCXLoader} from './tcx-loader';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA;AAGA;AAGA"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["_gpxLoader","require","_kmlLoader","_tcxLoader"],"sources":["../../src/index.ts"],"sourcesContent":["export type {GPXLoaderOptions} from './gpx-loader';\nexport {GPXLoader} from './gpx-loader';\n\nexport type {KMLLoaderOptions} from './kml-loader';\nexport {KMLLoader} from './kml-loader';\n\nexport type {TCXLoaderOptions} from './tcx-loader';\nexport {TCXLoader} from './tcx-loader';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA,IAAAA,UAAA,GAAAC,OAAA;AAGA,IAAAC,UAAA,GAAAD,OAAA;AAGA,IAAAE,UAAA,GAAAF,OAAA"}
|
package/dist/es5/kml-loader.js
CHANGED
|
@@ -9,9 +9,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
|
-
var VERSION = typeof "3.4.0-alpha.
|
|
12
|
+
var VERSION = typeof "3.4.0-alpha.4" !== 'undefined' ? "3.4.0-alpha.4" : 'latest';
|
|
13
13
|
var KML_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<kml xmlns=\"http://www.opengis.net/kml/2.2\">";
|
|
14
|
-
|
|
15
14
|
var KMLLoader = {
|
|
16
15
|
name: 'KML (Keyhole Markup Language)',
|
|
17
16
|
id: 'kml',
|
|
@@ -24,14 +23,12 @@ var KMLLoader = {
|
|
|
24
23
|
parse: function () {
|
|
25
24
|
var _parse = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(arrayBuffer, options) {
|
|
26
25
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
27
|
-
while (1) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
return _context.stop();
|
|
34
|
-
}
|
|
26
|
+
while (1) switch (_context.prev = _context.next) {
|
|
27
|
+
case 0:
|
|
28
|
+
return _context.abrupt("return", parseTextSync(new TextDecoder().decode(arrayBuffer), options));
|
|
29
|
+
case 1:
|
|
30
|
+
case "end":
|
|
31
|
+
return _context.stop();
|
|
35
32
|
}
|
|
36
33
|
}, _callee);
|
|
37
34
|
}));
|
|
@@ -51,7 +48,6 @@ function parseTextSync(text, options) {
|
|
|
51
48
|
var _options$gis, _options$kml, _options$kml2;
|
|
52
49
|
var doc = new DOMParser().parseFromString(text, 'text/xml');
|
|
53
50
|
var geojson = (0, _togeojson.kml)(doc);
|
|
54
|
-
|
|
55
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);
|
|
56
52
|
switch (shape) {
|
|
57
53
|
case 'object-row-table':
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kml-loader.js","names":["VERSION","KML_HEADER","KMLLoader","name","id","module","version","extensions","mimeTypes","text","tests","parse","arrayBuffer","options","parseTextSync","TextDecoder","decode","kml","gis","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 {kml} from '@tmcw/togeojson';\nimport {GeoJSONRowTable, FeatureCollection, ObjectRowTable} from '@loaders.gl/schema';\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;AACA;AAKA,
|
|
1
|
+
{"version":3,"file":"kml-loader.js","names":["_gis","require","_togeojson","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 {kml} from '@tmcw/togeojson';\nimport {GeoJSONRowTable, FeatureCollection, ObjectRowTable} from '@loaders.gl/schema';\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;AACA,IAAAC,UAAA,GAAAD,OAAA;AAKA,IAAME,OAAO,GAAG,sBAAkB,KAAK,WAAW,qBAAiB,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,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,WAA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AAK,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"}
|
package/dist/es5/tcx-loader.js
CHANGED
|
@@ -9,9 +9,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
|
-
var VERSION = typeof "3.4.0-alpha.
|
|
12
|
+
var VERSION = typeof "3.4.0-alpha.4" !== 'undefined' ? "3.4.0-alpha.4" : 'latest';
|
|
13
13
|
var TCX_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<TrainingCenterDatabase";
|
|
14
|
-
|
|
15
14
|
var TCXLoader = {
|
|
16
15
|
name: 'TCX (Training Center XML)',
|
|
17
16
|
id: 'tcx',
|
|
@@ -24,14 +23,12 @@ var TCXLoader = {
|
|
|
24
23
|
parse: function () {
|
|
25
24
|
var _parse = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(arrayBuffer, options) {
|
|
26
25
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
27
|
-
while (1) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
return _context.stop();
|
|
34
|
-
}
|
|
26
|
+
while (1) switch (_context.prev = _context.next) {
|
|
27
|
+
case 0:
|
|
28
|
+
return _context.abrupt("return", parseTextSync(new TextDecoder().decode(arrayBuffer), options));
|
|
29
|
+
case 1:
|
|
30
|
+
case "end":
|
|
31
|
+
return _context.stop();
|
|
35
32
|
}
|
|
36
33
|
}, _callee);
|
|
37
34
|
}));
|
|
@@ -51,7 +48,6 @@ function parseTextSync(text, options) {
|
|
|
51
48
|
var _options$gis, _options$tcx, _options$tcx2;
|
|
52
49
|
var doc = new DOMParser().parseFromString(text, 'text/xml');
|
|
53
50
|
var geojson = (0, _togeojson.tcx)(doc);
|
|
54
|
-
|
|
55
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$tcx = options.tcx) === null || _options$tcx === void 0 ? void 0 : _options$tcx.type) || (options === null || options === void 0 ? void 0 : (_options$tcx2 = options.tcx) === null || _options$tcx2 === void 0 ? void 0 : _options$tcx2.shape);
|
|
56
52
|
switch (shape) {
|
|
57
53
|
case 'object-row-table':
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tcx-loader.js","names":["VERSION","TCX_HEADER","TCXLoader","name","id","module","version","extensions","mimeTypes","text","tests","parse","arrayBuffer","options","parseTextSync","TextDecoder","decode","tcx","gis","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 {tcx} from '@tmcw/togeojson';\nimport type {GeoJSONRowTable, FeatureCollection, ObjectRowTable} from '@loaders.gl/schema';\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;AACA;AAKA,
|
|
1
|
+
{"version":3,"file":"tcx-loader.js","names":["_gis","require","_togeojson","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 {tcx} from '@tmcw/togeojson';\nimport type {GeoJSONRowTable, FeatureCollection, ObjectRowTable} from '@loaders.gl/schema';\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;AACA,IAAAC,UAAA,GAAAD,OAAA;AAKA,IAAME,OAAO,GAAG,sBAAkB,KAAK,WAAW,qBAAiB,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,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,C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1BI,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"}
|
package/dist/esm/bundle.js
CHANGED
package/dist/esm/bundle.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundle.js","names":["moduleExports","require","globalThis","loaders","module","exports","Object","assign"],"sources":["../../src/bundle.ts"],"sourcesContent":["// @ts-nocheck\nconst moduleExports = require('./index');\nglobalThis.loaders = globalThis.loaders || {};\nmodule.exports = Object.assign(globalThis.loaders, moduleExports);\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"bundle.js","names":["moduleExports","require","globalThis","loaders","module","exports","Object","assign"],"sources":["../../src/bundle.ts"],"sourcesContent":["// @ts-nocheck\nconst moduleExports = require('./index');\nglobalThis.loaders = globalThis.loaders || {};\nmodule.exports = Object.assign(globalThis.loaders, moduleExports);\n"],"mappings":"AACA,MAAMA,aAAa,GAAGC,OAAO,CAAC,SAAS,CAAC;AACxCC,UAAU,CAACC,OAAO,GAAGD,UAAU,CAACC,OAAO,IAAI,CAAC,CAAC;AAC7CC,MAAM,CAACC,OAAO,GAAGC,MAAM,CAACC,MAAM,CAACL,UAAU,CAACC,OAAO,EAAEH,aAAa,CAAC"}
|
package/dist/esm/gpx-loader.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { geojsonToBinary } from '@loaders.gl/gis';
|
|
2
2
|
import { gpx } from '@tmcw/togeojson';
|
|
3
|
-
const VERSION = typeof "3.4.0-alpha.
|
|
3
|
+
const VERSION = typeof "3.4.0-alpha.4" !== 'undefined' ? "3.4.0-alpha.4" : 'latest';
|
|
4
4
|
const GPX_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<gpx";
|
|
5
|
-
|
|
6
5
|
export const GPXLoader = {
|
|
7
6
|
name: 'GPX (GPS exchange format)',
|
|
8
7
|
id: 'gpx',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gpx-loader.js","names":["geojsonToBinary","gpx","VERSION","GPX_HEADER","GPXLoader","name","id","module","version","extensions","mimeTypes","text","tests","parse","arrayBuffer","options","parseTextSync","TextDecoder","decode","gis","doc","DOMParser","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 {gpx} from '@tmcw/togeojson';\nimport type {GeoJSONRowTable, FeatureCollection, ObjectRowTable} from '@loaders.gl/schema';\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;AAC/C,SAAQC,GAAG,QAAO,iBAAiB;AAKnC,MAAMC,OAAO,GAAG,sBAAkB,KAAK,WAAW,qBAAiB,QAAQ;AAc3E,MAAMC,UAAU,qDAEX
|
|
1
|
+
{"version":3,"file":"gpx-loader.js","names":["geojsonToBinary","gpx","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","DOMParser","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 {gpx} from '@tmcw/togeojson';\nimport type {GeoJSONRowTable, FeatureCollection, ObjectRowTable} from '@loaders.gl/schema';\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;AAC/C,SAAQC,GAAG,QAAO,iB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AQA,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,OAAOT,GAAG;IACZ;MAEE,OAAOG,OAAO;EAClB;AACF;AAEA,OAAO,MAAMO,mBAAqC,GAAG7B,SAAS"}
|
package/dist/esm/kml-loader.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { geojsonToBinary } from '@loaders.gl/gis';
|
|
2
2
|
import { kml } from '@tmcw/togeojson';
|
|
3
|
-
const VERSION = typeof "3.4.0-alpha.
|
|
3
|
+
const VERSION = typeof "3.4.0-alpha.4" !== 'undefined' ? "3.4.0-alpha.4" : 'latest';
|
|
4
4
|
const KML_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<kml xmlns=\"http://www.opengis.net/kml/2.2\">";
|
|
5
|
-
|
|
6
5
|
export const KMLLoader = {
|
|
7
6
|
name: 'KML (Keyhole Markup Language)',
|
|
8
7
|
id: 'kml',
|
|
@@ -23,7 +22,6 @@ function parseTextSync(text, options) {
|
|
|
23
22
|
var _options$gis, _options$kml, _options$kml2;
|
|
24
23
|
const doc = new DOMParser().parseFromString(text, 'text/xml');
|
|
25
24
|
const geojson = kml(doc);
|
|
26
|
-
|
|
27
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);
|
|
28
26
|
switch (shape) {
|
|
29
27
|
case 'object-row-table':
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kml-loader.js","names":["geojsonToBinary","kml","VERSION","KML_HEADER","KMLLoader","name","id","module","version","extensions","mimeTypes","text","tests","parse","arrayBuffer","options","parseTextSync","TextDecoder","decode","gis","doc","DOMParser","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 {kml} from '@tmcw/togeojson';\nimport {GeoJSONRowTable, FeatureCollection, ObjectRowTable} from '@loaders.gl/schema';\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;AAC/C,SAAQC,GAAG,QAAO,iBAAiB;AAKnC,MAAMC,OAAO,GAAG,sBAAkB,KAAK,WAAW,qBAAiB,QAAQ;AAc3E,MAAMC,UAAU,+FAE6B
|
|
1
|
+
{"version":3,"file":"kml-loader.js","names":["geojsonToBinary","kml","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","DOMParser","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 {kml} from '@tmcw/togeojson';\nimport {GeoJSONRowTable, FeatureCollection, ObjectRowTable} from '@loaders.gl/schema';\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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AA,uBAAZA,aAAA,CAAcK,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,OAAOT,GAAG;IACZ;MAEE,OAAOG,OAAO;EAClB;AACF;AAEA,OAAO,MAAMO,mBAAqC,GAAG7B,SAAS"}
|
package/dist/esm/tcx-loader.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { geojsonToBinary } from '@loaders.gl/gis';
|
|
2
2
|
import { tcx } from '@tmcw/togeojson';
|
|
3
|
-
const VERSION = typeof "3.4.0-alpha.
|
|
3
|
+
const VERSION = typeof "3.4.0-alpha.4" !== 'undefined' ? "3.4.0-alpha.4" : 'latest';
|
|
4
4
|
const TCX_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<TrainingCenterDatabase";
|
|
5
|
-
|
|
6
5
|
export const TCXLoader = {
|
|
7
6
|
name: 'TCX (Training Center XML)',
|
|
8
7
|
id: 'tcx',
|
|
@@ -23,7 +22,6 @@ function parseTextSync(text, options) {
|
|
|
23
22
|
var _options$gis, _options$tcx, _options$tcx2;
|
|
24
23
|
const doc = new DOMParser().parseFromString(text, 'text/xml');
|
|
25
24
|
const geojson = tcx(doc);
|
|
26
|
-
|
|
27
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$tcx = options.tcx) === null || _options$tcx === void 0 ? void 0 : _options$tcx.type) || (options === null || options === void 0 ? void 0 : (_options$tcx2 = options.tcx) === null || _options$tcx2 === void 0 ? void 0 : _options$tcx2.shape);
|
|
28
26
|
switch (shape) {
|
|
29
27
|
case 'object-row-table':
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tcx-loader.js","names":["geojsonToBinary","tcx","VERSION","TCX_HEADER","TCXLoader","name","id","module","version","extensions","mimeTypes","text","tests","parse","arrayBuffer","options","parseTextSync","TextDecoder","decode","gis","doc","DOMParser","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 {tcx} from '@tmcw/togeojson';\nimport type {GeoJSONRowTable, FeatureCollection, ObjectRowTable} from '@loaders.gl/schema';\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;AAC/C,SAAQC,GAAG,QAAO,iBAAiB;AAKnC,MAAMC,OAAO,GAAG,sBAAkB,KAAK,WAAW,qBAAiB,QAAQ;AAc3E,MAAMC,UAAU,wEAEQ
|
|
1
|
+
{"version":3,"file":"tcx-loader.js","names":["geojsonToBinary","tcx","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","DOMParser","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 {tcx} from '@tmcw/togeojson';\nimport type {GeoJSONRowTable, FeatureCollection, ObjectRowTable} from '@loaders.gl/schema';\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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AAO,wBAAAO,aAAA,GAAPP,OAAO,CAAEd,GAAG,cAAAqB,aAAA,uBAAZA,aAAA,CAAcK,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,OAAOT,GAAG;IACZ;MAEE,OAAOG,OAAO;EAClB;AACF;AAEA,OAAO,MAAMO,mBAAqC,GAAG7B,SAAS"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/kml",
|
|
3
|
-
"version": "3.4.0-alpha.
|
|
3
|
+
"version": "3.4.0-alpha.4",
|
|
4
4
|
"description": "Framework-independent loader for the KML format",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -32,10 +32,10 @@
|
|
|
32
32
|
"build-bundle": "esbuild src/bundle.ts --bundle --outfile=dist/dist.min.js"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@loaders.gl/gis": "3.4.0-alpha.
|
|
36
|
-
"@loaders.gl/loader-utils": "3.4.0-alpha.
|
|
37
|
-
"@loaders.gl/schema": "3.4.0-alpha.
|
|
35
|
+
"@loaders.gl/gis": "3.4.0-alpha.4",
|
|
36
|
+
"@loaders.gl/loader-utils": "3.4.0-alpha.4",
|
|
37
|
+
"@loaders.gl/schema": "3.4.0-alpha.4",
|
|
38
38
|
"@tmcw/togeojson": "^4.5.0"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "f039a523df8b908a91f26c5ba8c4cfc1924b6140"
|
|
41
41
|
}
|