@loaders.gl/kml 4.0.0-alpha.5 → 4.0.0-alpha.6
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/bundle.js +2 -2
- package/dist/dist.min.js +782 -385
- package/dist/es5/bundle.js +6 -0
- package/dist/es5/bundle.js.map +1 -0
- package/dist/es5/gpx-loader.js +81 -0
- package/dist/es5/gpx-loader.js.map +1 -0
- package/dist/es5/index.js +27 -0
- package/dist/es5/index.js.map +1 -0
- package/dist/es5/kml-loader.js +81 -0
- package/dist/es5/kml-loader.js.map +1 -0
- package/dist/es5/tcx-loader.js +81 -0
- package/dist/es5/tcx-loader.js.map +1 -0
- package/dist/esm/bundle.js +4 -0
- package/dist/esm/bundle.js.map +1 -0
- package/dist/esm/gpx-loader.js +54 -0
- package/dist/esm/gpx-loader.js.map +1 -0
- package/dist/esm/index.js +4 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/kml-loader.js +54 -0
- package/dist/esm/kml-loader.js.map +1 -0
- package/dist/esm/tcx-loader.js +54 -0
- package/dist/esm/tcx-loader.js.map +1 -0
- package/dist/gpx-loader.d.ts +16 -26
- package/dist/gpx-loader.d.ts.map +1 -1
- package/dist/gpx-loader.js +57 -49
- package/dist/index.js +9 -4
- package/dist/kml-loader.d.ts +14 -7
- package/dist/kml-loader.d.ts.map +1 -1
- package/dist/kml-loader.js +58 -49
- package/dist/tcx-loader.d.ts +14 -7
- package/dist/tcx-loader.d.ts.map +1 -1
- package/dist/tcx-loader.js +59 -50
- package/package.json +7 -7
- package/src/gpx-loader.ts +34 -14
- package/src/kml-loader.ts +33 -13
- package/src/tcx-loader.ts +33 -12
- package/dist/bundle.js.map +0 -1
- package/dist/gpx-loader.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/kml-loader.js.map +0 -1
- package/dist/tcx-loader.js.map +0 -1
|
@@ -0,0 +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":";;AACA,IAAMA,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"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports._typecheckGPXLoader = exports.GPXLoader = void 0;
|
|
8
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
|
+
var _gis = require("@loaders.gl/gis");
|
|
11
|
+
var _togeojson = require("@tmcw/togeojson");
|
|
12
|
+
var VERSION = typeof "4.0.0-alpha.6" !== 'undefined' ? "4.0.0-alpha.6" : 'latest';
|
|
13
|
+
var GPX_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<gpx";
|
|
14
|
+
var GPXLoader = {
|
|
15
|
+
name: 'GPX (GPS exchange format)',
|
|
16
|
+
id: 'gpx',
|
|
17
|
+
module: 'kml',
|
|
18
|
+
version: VERSION,
|
|
19
|
+
extensions: ['gpx'],
|
|
20
|
+
mimeTypes: ['application/gpx+xml'],
|
|
21
|
+
text: true,
|
|
22
|
+
tests: [GPX_HEADER],
|
|
23
|
+
parse: function () {
|
|
24
|
+
var _parse = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(arrayBuffer, options) {
|
|
25
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
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();
|
|
32
|
+
}
|
|
33
|
+
}, _callee);
|
|
34
|
+
}));
|
|
35
|
+
function parse(_x, _x2) {
|
|
36
|
+
return _parse.apply(this, arguments);
|
|
37
|
+
}
|
|
38
|
+
return parse;
|
|
39
|
+
}(),
|
|
40
|
+
parseTextSync: parseTextSync,
|
|
41
|
+
options: {
|
|
42
|
+
gpx: {},
|
|
43
|
+
gis: {}
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
exports.GPXLoader = GPXLoader;
|
|
47
|
+
function parseTextSync(text, options) {
|
|
48
|
+
var _options$gis, _options$gpx, _options$gpx2;
|
|
49
|
+
var doc = new DOMParser().parseFromString(text, 'text/xml');
|
|
50
|
+
var geojson = (0, _togeojson.gpx)(doc);
|
|
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$gpx = options.gpx) === null || _options$gpx === void 0 ? void 0 : _options$gpx.type) || (options === null || options === void 0 ? void 0 : (_options$gpx2 = options.gpx) === null || _options$gpx2 === void 0 ? void 0 : _options$gpx2.shape);
|
|
52
|
+
switch (shape) {
|
|
53
|
+
case 'object-row-table':
|
|
54
|
+
{
|
|
55
|
+
var table = {
|
|
56
|
+
shape: 'object-row-table',
|
|
57
|
+
data: geojson.features
|
|
58
|
+
};
|
|
59
|
+
return table;
|
|
60
|
+
}
|
|
61
|
+
case 'geojson-row-table':
|
|
62
|
+
{
|
|
63
|
+
var _table = {
|
|
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 (0, _gis.geojsonToBinary)(geojson.features);
|
|
73
|
+
case 'raw':
|
|
74
|
+
return doc;
|
|
75
|
+
default:
|
|
76
|
+
return geojson;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
var _typecheckGPXLoader = GPXLoader;
|
|
80
|
+
exports._typecheckGPXLoader = _typecheckGPXLoader;
|
|
81
|
+
//# sourceMappingURL=gpx-loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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;EACbC,OAAO,EAAEN,OAAO;EAChBO,UAAU,EAAE,CAAC,KAAK,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AZA,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"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "GPXLoader", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _gpxLoader.GPXLoader;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "KMLLoader", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _kmlLoader.KMLLoader;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "TCXLoader", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function get() {
|
|
21
|
+
return _tcxLoader.TCXLoader;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
var _gpxLoader = require("./gpx-loader");
|
|
25
|
+
var _kmlLoader = require("./kml-loader");
|
|
26
|
+
var _tcxLoader = require("./tcx-loader");
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports._typecheckKMLLoader = exports.KMLLoader = void 0;
|
|
8
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
|
+
var _gis = require("@loaders.gl/gis");
|
|
11
|
+
var _togeojson = require("@tmcw/togeojson");
|
|
12
|
+
var VERSION = typeof "4.0.0-alpha.6" !== 'undefined' ? "4.0.0-alpha.6" : 'latest';
|
|
13
|
+
var KML_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<kml xmlns=\"http://www.opengis.net/kml/2.2\">";
|
|
14
|
+
var KMLLoader = {
|
|
15
|
+
name: 'KML (Keyhole Markup Language)',
|
|
16
|
+
id: 'kml',
|
|
17
|
+
module: 'kml',
|
|
18
|
+
version: VERSION,
|
|
19
|
+
extensions: ['kml'],
|
|
20
|
+
mimeTypes: ['application/vnd.google-earth.kml+xml'],
|
|
21
|
+
text: true,
|
|
22
|
+
tests: [KML_HEADER],
|
|
23
|
+
parse: function () {
|
|
24
|
+
var _parse = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(arrayBuffer, options) {
|
|
25
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
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();
|
|
32
|
+
}
|
|
33
|
+
}, _callee);
|
|
34
|
+
}));
|
|
35
|
+
function parse(_x, _x2) {
|
|
36
|
+
return _parse.apply(this, arguments);
|
|
37
|
+
}
|
|
38
|
+
return parse;
|
|
39
|
+
}(),
|
|
40
|
+
parseTextSync: parseTextSync,
|
|
41
|
+
options: {
|
|
42
|
+
kml: {},
|
|
43
|
+
gis: {}
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
exports.KMLLoader = KMLLoader;
|
|
47
|
+
function parseTextSync(text, options) {
|
|
48
|
+
var _options$gis, _options$kml, _options$kml2;
|
|
49
|
+
var doc = new DOMParser().parseFromString(text, 'text/xml');
|
|
50
|
+
var geojson = (0, _togeojson.kml)(doc);
|
|
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);
|
|
52
|
+
switch (shape) {
|
|
53
|
+
case 'object-row-table':
|
|
54
|
+
{
|
|
55
|
+
var table = {
|
|
56
|
+
shape: 'object-row-table',
|
|
57
|
+
data: geojson.features
|
|
58
|
+
};
|
|
59
|
+
return table;
|
|
60
|
+
}
|
|
61
|
+
case 'geojson-row-table':
|
|
62
|
+
{
|
|
63
|
+
var _table = {
|
|
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 (0, _gis.geojsonToBinary)(geojson.features);
|
|
73
|
+
case 'raw':
|
|
74
|
+
return doc;
|
|
75
|
+
default:
|
|
76
|
+
return geojson;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
var _typecheckKMLLoader = KMLLoader;
|
|
80
|
+
exports._typecheckKMLLoader = _typecheckKMLLoader;
|
|
81
|
+
//# sourceMappingURL=kml-loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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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 -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports._typecheckTCXLoader = exports.TCXLoader = void 0;
|
|
8
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
|
+
var _gis = require("@loaders.gl/gis");
|
|
11
|
+
var _togeojson = require("@tmcw/togeojson");
|
|
12
|
+
var VERSION = typeof "4.0.0-alpha.6" !== 'undefined' ? "4.0.0-alpha.6" : 'latest';
|
|
13
|
+
var TCX_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<TrainingCenterDatabase";
|
|
14
|
+
var TCXLoader = {
|
|
15
|
+
name: 'TCX (Training Center XML)',
|
|
16
|
+
id: 'tcx',
|
|
17
|
+
module: 'kml',
|
|
18
|
+
version: VERSION,
|
|
19
|
+
extensions: ['tcx'],
|
|
20
|
+
mimeTypes: ['application/vnd.garmin.tcx+xml'],
|
|
21
|
+
text: true,
|
|
22
|
+
tests: [TCX_HEADER],
|
|
23
|
+
parse: function () {
|
|
24
|
+
var _parse = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(arrayBuffer, options) {
|
|
25
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
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();
|
|
32
|
+
}
|
|
33
|
+
}, _callee);
|
|
34
|
+
}));
|
|
35
|
+
function parse(_x, _x2) {
|
|
36
|
+
return _parse.apply(this, arguments);
|
|
37
|
+
}
|
|
38
|
+
return parse;
|
|
39
|
+
}(),
|
|
40
|
+
parseTextSync: parseTextSync,
|
|
41
|
+
options: {
|
|
42
|
+
tcx: {},
|
|
43
|
+
gis: {}
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
exports.TCXLoader = TCXLoader;
|
|
47
|
+
function parseTextSync(text, options) {
|
|
48
|
+
var _options$gis, _options$tcx, _options$tcx2;
|
|
49
|
+
var doc = new DOMParser().parseFromString(text, 'text/xml');
|
|
50
|
+
var geojson = (0, _togeojson.tcx)(doc);
|
|
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);
|
|
52
|
+
switch (shape) {
|
|
53
|
+
case 'object-row-table':
|
|
54
|
+
{
|
|
55
|
+
var table = {
|
|
56
|
+
shape: 'object-row-table',
|
|
57
|
+
data: geojson.features
|
|
58
|
+
};
|
|
59
|
+
return table;
|
|
60
|
+
}
|
|
61
|
+
case 'geojson-row-table':
|
|
62
|
+
{
|
|
63
|
+
var _table = {
|
|
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 (0, _gis.geojsonToBinary)(geojson.features);
|
|
73
|
+
case 'raw':
|
|
74
|
+
return doc;
|
|
75
|
+
default:
|
|
76
|
+
return geojson;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
var _typecheckTCXLoader = TCXLoader;
|
|
80
|
+
exports._typecheckTCXLoader = _typecheckTCXLoader;
|
|
81
|
+
//# sourceMappingURL=tcx-loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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,kBAAA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BH,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"}
|
|
@@ -0,0 +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":"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"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { geojsonToBinary } from '@loaders.gl/gis';
|
|
2
|
+
import { gpx } from '@tmcw/togeojson';
|
|
3
|
+
const VERSION = typeof "4.0.0-alpha.6" !== 'undefined' ? "4.0.0-alpha.6" : 'latest';
|
|
4
|
+
const GPX_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<gpx";
|
|
5
|
+
export const GPXLoader = {
|
|
6
|
+
name: 'GPX (GPS exchange format)',
|
|
7
|
+
id: 'gpx',
|
|
8
|
+
module: 'kml',
|
|
9
|
+
version: VERSION,
|
|
10
|
+
extensions: ['gpx'],
|
|
11
|
+
mimeTypes: ['application/gpx+xml'],
|
|
12
|
+
text: true,
|
|
13
|
+
tests: [GPX_HEADER],
|
|
14
|
+
parse: async (arrayBuffer, options) => parseTextSync(new TextDecoder().decode(arrayBuffer), options),
|
|
15
|
+
parseTextSync,
|
|
16
|
+
options: {
|
|
17
|
+
gpx: {},
|
|
18
|
+
gis: {}
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
function parseTextSync(text, options) {
|
|
22
|
+
var _options$gis, _options$gpx, _options$gpx2;
|
|
23
|
+
const doc = new DOMParser().parseFromString(text, 'text/xml');
|
|
24
|
+
const geojson = gpx(doc);
|
|
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$gpx = options.gpx) === null || _options$gpx === void 0 ? void 0 : _options$gpx.type) || (options === null || options === void 0 ? void 0 : (_options$gpx2 = options.gpx) === null || _options$gpx2 === void 0 ? void 0 : _options$gpx2.shape);
|
|
26
|
+
switch (shape) {
|
|
27
|
+
case 'object-row-table':
|
|
28
|
+
{
|
|
29
|
+
const table = {
|
|
30
|
+
shape: 'object-row-table',
|
|
31
|
+
data: geojson.features
|
|
32
|
+
};
|
|
33
|
+
return table;
|
|
34
|
+
}
|
|
35
|
+
case 'geojson-row-table':
|
|
36
|
+
{
|
|
37
|
+
const table = {
|
|
38
|
+
shape: 'geojson-row-table',
|
|
39
|
+
data: geojson.features
|
|
40
|
+
};
|
|
41
|
+
return table;
|
|
42
|
+
}
|
|
43
|
+
case 'geojson':
|
|
44
|
+
return geojson;
|
|
45
|
+
case 'binary':
|
|
46
|
+
return geojsonToBinary(geojson.features);
|
|
47
|
+
case 'raw':
|
|
48
|
+
return doc;
|
|
49
|
+
default:
|
|
50
|
+
return geojson;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
export const _typecheckGPXLoader = GPXLoader;
|
|
54
|
+
//# sourceMappingURL=gpx-loader.js.map
|
|
@@ -0,0 +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","_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,iBAAiB;AAKnC,MAAMC,OAAO,GAAG,sBAAkB,KAAK,WAAW,qBAAiB,QAAQ;AAc3E,MAAMC,UAAU,qDAEX;AAKL,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,qBAAqB,CAAC;EAClCC,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;IACPd,GAAG,EAAE,CAAC,CAAC;IACPkB,GAAG,EAAE,CAAC;EACR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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,SAAQA,SAAS,QAAO,cAAc;AAGtC,SAAQC,SAAS,QAAO,cAAc;AAGtC,SAAQC,SAAS,QAAO,cAAc"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { geojsonToBinary } from '@loaders.gl/gis';
|
|
2
|
+
import { kml } from '@tmcw/togeojson';
|
|
3
|
+
const VERSION = typeof "4.0.0-alpha.6" !== 'undefined' ? "4.0.0-alpha.6" : 'latest';
|
|
4
|
+
const KML_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<kml xmlns=\"http://www.opengis.net/kml/2.2\">";
|
|
5
|
+
export const KMLLoader = {
|
|
6
|
+
name: 'KML (Keyhole Markup Language)',
|
|
7
|
+
id: 'kml',
|
|
8
|
+
module: 'kml',
|
|
9
|
+
version: VERSION,
|
|
10
|
+
extensions: ['kml'],
|
|
11
|
+
mimeTypes: ['application/vnd.google-earth.kml+xml'],
|
|
12
|
+
text: true,
|
|
13
|
+
tests: [KML_HEADER],
|
|
14
|
+
parse: async (arrayBuffer, options) => parseTextSync(new TextDecoder().decode(arrayBuffer), options),
|
|
15
|
+
parseTextSync,
|
|
16
|
+
options: {
|
|
17
|
+
kml: {},
|
|
18
|
+
gis: {}
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
function parseTextSync(text, options) {
|
|
22
|
+
var _options$gis, _options$kml, _options$kml2;
|
|
23
|
+
const doc = new DOMParser().parseFromString(text, 'text/xml');
|
|
24
|
+
const geojson = kml(doc);
|
|
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);
|
|
26
|
+
switch (shape) {
|
|
27
|
+
case 'object-row-table':
|
|
28
|
+
{
|
|
29
|
+
const table = {
|
|
30
|
+
shape: 'object-row-table',
|
|
31
|
+
data: geojson.features
|
|
32
|
+
};
|
|
33
|
+
return table;
|
|
34
|
+
}
|
|
35
|
+
case 'geojson-row-table':
|
|
36
|
+
{
|
|
37
|
+
const table = {
|
|
38
|
+
shape: 'geojson-row-table',
|
|
39
|
+
data: geojson.features
|
|
40
|
+
};
|
|
41
|
+
return table;
|
|
42
|
+
}
|
|
43
|
+
case 'geojson':
|
|
44
|
+
return geojson;
|
|
45
|
+
case 'binary':
|
|
46
|
+
return geojsonToBinary(geojson.features);
|
|
47
|
+
case 'raw':
|
|
48
|
+
return doc;
|
|
49
|
+
default:
|
|
50
|
+
return geojson;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
export const _typecheckKMLLoader = KMLLoader;
|
|
54
|
+
//# sourceMappingURL=kml-loader.js.map
|
|
@@ -0,0 +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","_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,iB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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"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { geojsonToBinary } from '@loaders.gl/gis';
|
|
2
|
+
import { tcx } from '@tmcw/togeojson';
|
|
3
|
+
const VERSION = typeof "4.0.0-alpha.6" !== 'undefined' ? "4.0.0-alpha.6" : 'latest';
|
|
4
|
+
const TCX_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<TrainingCenterDatabase";
|
|
5
|
+
export const TCXLoader = {
|
|
6
|
+
name: 'TCX (Training Center XML)',
|
|
7
|
+
id: 'tcx',
|
|
8
|
+
module: 'kml',
|
|
9
|
+
version: VERSION,
|
|
10
|
+
extensions: ['tcx'],
|
|
11
|
+
mimeTypes: ['application/vnd.garmin.tcx+xml'],
|
|
12
|
+
text: true,
|
|
13
|
+
tests: [TCX_HEADER],
|
|
14
|
+
parse: async (arrayBuffer, options) => parseTextSync(new TextDecoder().decode(arrayBuffer), options),
|
|
15
|
+
parseTextSync,
|
|
16
|
+
options: {
|
|
17
|
+
tcx: {},
|
|
18
|
+
gis: {}
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
function parseTextSync(text, options) {
|
|
22
|
+
var _options$gis, _options$tcx, _options$tcx2;
|
|
23
|
+
const doc = new DOMParser().parseFromString(text, 'text/xml');
|
|
24
|
+
const geojson = tcx(doc);
|
|
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);
|
|
26
|
+
switch (shape) {
|
|
27
|
+
case 'object-row-table':
|
|
28
|
+
{
|
|
29
|
+
const table = {
|
|
30
|
+
shape: 'object-row-table',
|
|
31
|
+
data: geojson.features
|
|
32
|
+
};
|
|
33
|
+
return table;
|
|
34
|
+
}
|
|
35
|
+
case 'geojson-row-table':
|
|
36
|
+
{
|
|
37
|
+
const table = {
|
|
38
|
+
shape: 'geojson-row-table',
|
|
39
|
+
data: geojson.features
|
|
40
|
+
};
|
|
41
|
+
return table;
|
|
42
|
+
}
|
|
43
|
+
case 'geojson':
|
|
44
|
+
return geojson;
|
|
45
|
+
case 'binary':
|
|
46
|
+
return geojsonToBinary(geojson.features);
|
|
47
|
+
case 'raw':
|
|
48
|
+
return doc;
|
|
49
|
+
default:
|
|
50
|
+
return geojson;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
export const _typecheckTCXLoader = TCXLoader;
|
|
54
|
+
//# sourceMappingURL=tcx-loader.js.map
|
|
@@ -0,0 +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","_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: 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;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;IACPd,GAAG,EAAE,CAAC,CAAC;IACPkB,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,IAAIC,SAAS,CAAC,CAAC,CAACC,eAAe,CAACd,IAAI,EAAE,UAAU,CAAC;EAC7D,MAAMe,OAA0B,GAAGzB,GAAG,CAACsB,GAAG,CAAC;EAG3C,MAAMI,KAAK,GAAG,CAAAZ,OAAO,aAAPA,OAAO,wBAAAK,YAAA,GAAPL,OAAO,CAAEI,GAAG,cAAAC,YAAA,uBAAZA,YAAA,CAAcQ,MAAM,MAAIb,OAAO,aAAPA,OAAO,wBAAAM,YAAA,GAAPN,OAAO,CAAEd,GAAG,cAAAoB,YAAA,uBAAZA,YAAA,CAAcQ,IAAI,MAAId,OAAO,aAAPA,OAAO,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/dist/gpx-loader.d.ts
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
|
-
import type { LoaderOptions } from '@loaders.gl/loader-utils';
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import type { LoaderOptions, LoaderWithParser } from '@loaders.gl/loader-utils';
|
|
2
|
+
import type { GeoJSONRowTable, FeatureCollection, ObjectRowTable } from '@loaders.gl/schema';
|
|
3
|
+
export type GPXLoaderOptions = LoaderOptions & {
|
|
4
|
+
gpx?: {
|
|
5
|
+
shape?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';
|
|
6
|
+
/** @deprecated. Use options.gpx.shape */
|
|
7
|
+
type?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';
|
|
8
|
+
};
|
|
9
|
+
gis?: {
|
|
10
|
+
/** @deprecated. Use options.gpx.shape */
|
|
11
|
+
format?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';
|
|
12
|
+
};
|
|
4
13
|
};
|
|
5
14
|
/**
|
|
6
15
|
* Loader for GPX (GPS exchange format)
|
|
@@ -14,33 +23,14 @@ export declare const GPXLoader: {
|
|
|
14
23
|
mimeTypes: string[];
|
|
15
24
|
text: boolean;
|
|
16
25
|
tests: string[];
|
|
17
|
-
parse: (arrayBuffer: any, options
|
|
18
|
-
parseTextSync: typeof parseTextSync;
|
|
19
|
-
options: {
|
|
20
|
-
gpx: {};
|
|
21
|
-
gis: {
|
|
22
|
-
format: string;
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
declare function parseTextSync(text: string, options: any): any;
|
|
27
|
-
export declare const _typecheckGPXLoader: {
|
|
28
|
-
name: string;
|
|
29
|
-
id: string;
|
|
30
|
-
module: string;
|
|
31
|
-
version: any;
|
|
32
|
-
extensions: string[];
|
|
33
|
-
mimeTypes: string[];
|
|
34
|
-
text: boolean;
|
|
35
|
-
tests: string[];
|
|
36
|
-
parse: (arrayBuffer: any, options: any) => Promise<any>;
|
|
26
|
+
parse: (arrayBuffer: any, options?: GPXLoaderOptions) => Promise<Document | FeatureCollection<import("geojson").Geometry, import("geojson").GeoJsonProperties> | ObjectRowTable | GeoJSONRowTable | import("@loaders.gl/schema").BinaryFeatures>;
|
|
37
27
|
parseTextSync: typeof parseTextSync;
|
|
38
28
|
options: {
|
|
39
29
|
gpx: {};
|
|
40
|
-
gis: {
|
|
41
|
-
format: string;
|
|
42
|
-
};
|
|
30
|
+
gis: {};
|
|
43
31
|
};
|
|
44
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;
|
|
45
35
|
export {};
|
|
46
36
|
//# sourceMappingURL=gpx-loader.d.ts.map
|
package/dist/gpx-loader.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gpx-loader.d.ts","sourceRoot":"","sources":["../src/gpx-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,0BAA0B,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;AAG9E,OAAO,KAAK,EAAC,eAAe,EAAE,iBAAiB,EAAE,cAAc,EAAC,MAAM,oBAAoB,CAAC;AAM3F,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"}
|