@loaders.gl/kml 4.0.0-alpha.23 → 4.0.0-alpha.25
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 +9 -7
- package/dist/es5/gpx-loader.js +5 -4
- package/dist/es5/gpx-loader.js.map +1 -1
- package/dist/es5/kml-loader.js +1 -1
- package/dist/es5/kml-loader.js.map +1 -1
- package/dist/es5/tcx-loader.js +5 -4
- package/dist/es5/tcx-loader.js.map +1 -1
- package/dist/esm/gpx-loader.js +5 -4
- package/dist/esm/gpx-loader.js.map +1 -1
- package/dist/esm/kml-loader.js +1 -1
- package/dist/esm/kml-loader.js.map +1 -1
- package/dist/esm/tcx-loader.js +5 -4
- package/dist/esm/tcx-loader.js.map +1 -1
- package/dist/gpx-loader.d.ts +4 -4
- package/dist/gpx-loader.d.ts.map +1 -1
- package/dist/kml-loader.d.ts +3 -3
- package/dist/kml-loader.d.ts.map +1 -1
- package/dist/tcx-loader.d.ts +4 -4
- package/dist/tcx-loader.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/gpx-loader.ts +10 -9
- package/src/kml-loader.ts +7 -7
- package/src/tcx-loader.ts +10 -9
- package/dist/bundle.js +0 -5
- package/dist/gpx-loader.js +0 -61
- package/dist/index.js +0 -12
- package/dist/kml-loader.js +0 -58
- package/dist/tcx-loader.js +0 -62
package/dist/dist.min.js
CHANGED
|
@@ -829,7 +829,7 @@
|
|
|
829
829
|
numericProps: wrapProps(polygons.numericProps, 1)
|
|
830
830
|
}
|
|
831
831
|
};
|
|
832
|
-
if (polygons.triangles) {
|
|
832
|
+
if (binaryFeatures.polygons && polygons.triangles) {
|
|
833
833
|
binaryFeatures.polygons.triangles = { value: new Uint32Array(polygons.triangles), size: 1 };
|
|
834
834
|
}
|
|
835
835
|
return binaryFeatures;
|
|
@@ -5997,10 +5997,11 @@
|
|
|
5997
5997
|
};
|
|
5998
5998
|
return table;
|
|
5999
5999
|
}
|
|
6000
|
-
case "geojson-
|
|
6000
|
+
case "geojson-table": {
|
|
6001
6001
|
const table = {
|
|
6002
|
-
shape: "geojson-
|
|
6003
|
-
|
|
6002
|
+
shape: "geojson-table",
|
|
6003
|
+
type: "FeatureCollection",
|
|
6004
|
+
features: geojson.features
|
|
6004
6005
|
};
|
|
6005
6006
|
return table;
|
|
6006
6007
|
}
|
|
@@ -6097,10 +6098,11 @@
|
|
|
6097
6098
|
};
|
|
6098
6099
|
return table;
|
|
6099
6100
|
}
|
|
6100
|
-
case "geojson-
|
|
6101
|
+
case "geojson-table": {
|
|
6101
6102
|
const table = {
|
|
6102
|
-
shape: "geojson-
|
|
6103
|
-
|
|
6103
|
+
shape: "geojson-table",
|
|
6104
|
+
type: "FeatureCollection",
|
|
6105
|
+
features: geojson.features
|
|
6104
6106
|
};
|
|
6105
6107
|
return table;
|
|
6106
6108
|
}
|
package/dist/es5/gpx-loader.js
CHANGED
|
@@ -10,7 +10,7 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
|
|
|
10
10
|
var _gis = require("@loaders.gl/gis");
|
|
11
11
|
var _togeojson = require("@tmcw/togeojson");
|
|
12
12
|
var _xmldom = require("@xmldom/xmldom");
|
|
13
|
-
var VERSION = typeof "4.0.0-alpha.
|
|
13
|
+
var VERSION = typeof "4.0.0-alpha.25" !== 'undefined' ? "4.0.0-alpha.25" : 'latest';
|
|
14
14
|
var GPX_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<gpx";
|
|
15
15
|
var GPXLoader = {
|
|
16
16
|
name: 'GPX (GPS exchange format)',
|
|
@@ -59,11 +59,12 @@ function parseTextSync(text, options) {
|
|
|
59
59
|
};
|
|
60
60
|
return table;
|
|
61
61
|
}
|
|
62
|
-
case 'geojson-
|
|
62
|
+
case 'geojson-table':
|
|
63
63
|
{
|
|
64
64
|
var _table = {
|
|
65
|
-
shape: 'geojson-
|
|
66
|
-
|
|
65
|
+
shape: 'geojson-table',
|
|
66
|
+
type: 'FeatureCollection',
|
|
67
|
+
features: geojson.features
|
|
67
68
|
};
|
|
68
69
|
return _table;
|
|
69
70
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gpx-loader.js","names":["_gis","require","_togeojson","_xmldom","VERSION","GPX_HEADER","GPXLoader","name","id","module","version","extensions","mimeTypes","text","tests","parse","_parse","_asyncToGenerator2","default","_regenerator","mark","_callee","arrayBuffer","options","wrap","_callee$","_context","prev","next","abrupt","parseTextSync","TextDecoder","decode","stop","_x","_x2","apply","arguments","gpx","gis","exports","_options$gis","_options$gpx","_options$gpx2","doc","DOMParser","parseFromString","geojson","shape","format","type","table","data","features","geojsonToBinary"],"sources":["../../src/gpx-loader.ts"],"sourcesContent":["import type {LoaderOptions, LoaderWithParser} from '@loaders.gl/loader-utils';\nimport {geojsonToBinary} from '@loaders.gl/gis';\nimport type {
|
|
1
|
+
{"version":3,"file":"gpx-loader.js","names":["_gis","require","_togeojson","_xmldom","VERSION","GPX_HEADER","GPXLoader","name","id","module","version","extensions","mimeTypes","text","tests","parse","_parse","_asyncToGenerator2","default","_regenerator","mark","_callee","arrayBuffer","options","wrap","_callee$","_context","prev","next","abrupt","parseTextSync","TextDecoder","decode","stop","_x","_x2","apply","arguments","gpx","gis","exports","_options$gis","_options$gpx","_options$gpx2","doc","DOMParser","parseFromString","geojson","shape","format","type","table","data","features","geojsonToBinary"],"sources":["../../src/gpx-loader.ts"],"sourcesContent":["import type {LoaderOptions, LoaderWithParser} from '@loaders.gl/loader-utils';\nimport {geojsonToBinary} from '@loaders.gl/gis';\nimport type {GeoJSONTable, FeatureCollection, ObjectRowTable} from '@loaders.gl/schema';\nimport {gpx} from '@tmcw/togeojson';\nimport {DOMParser} from '@xmldom/xmldom';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type GPXLoaderOptions = LoaderOptions & {\n gpx?: {\n shape?: 'object-row-table' | 'geojson-table' | 'geojson' | 'binary' | 'raw';\n /** @deprecated. Use options.gpx.shape */\n type?: 'object-row-table' | 'geojson-table' | 'geojson' | 'binary' | 'raw';\n };\n gis?: {\n /** @deprecated. Use options.gpx.shape */\n format?: 'object-row-table' | 'geojson-table' | 'geojson' | 'binary' | 'raw';\n };\n};\n\nconst GPX_HEADER = `\\\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<gpx`;\n\n/**\n * Loader for GPX (GPS exchange format)\n */\nexport const GPXLoader: LoaderWithParser<any, never, GPXLoaderOptions> = {\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-table': {\n const table: GeoJSONTable = {\n shape: 'geojson-table',\n type: 'FeatureCollection',\n features: geojson.features\n };\n return table;\n }\n case 'geojson':\n return geojson;\n case 'binary':\n return geojsonToBinary(geojson.features);\n case 'raw':\n return doc;\n default:\n // Default to geojson for backwards compatibility\n return geojson;\n }\n}\n"],"mappings":";;;;;;;;;AACA,IAAAA,IAAA,GAAAC,OAAA;AAEA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAIA,IAAMG,OAAO,GAAG,uBAAkB,KAAK,WAAW,sBAAiB,QAAQ;AAc3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U,CAAC;EAC7D,IAAMkC,OAA0B,GAAG,IAAAT,cAAG,EAACM,GAAG,CAAC;EAE3C,IAAMI,KAAK,GAAG,CAAAzB,OAAO,aAAPA,OAAO,wBAAAkB,YAAA,GAAPlB,OAAO,CAAEgB,GAAG,cAAAE,YAAA,uBAAZA,YAAA,CAAcQ,MAAM,MAAI1B,OAAO,aAAPA,OAAO,wBAAAmB,YAAA,GAAPnB,OAAO,CAAEe,GAAG,cAAAI,YAAA,uBAAZA,YAAA,CAAcQ,IAAI,MAAI3B,OAAO,aAAPA,OAAO,wBAAAoB,aAAA,GAAPpB,OAAO,CAAEe,GAAG,cAAAK,aAAA,uBAAZA,aAAA,CAAcK,KAAK;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,eAAe;MAAE;QACpB,IAAMA,MAAmB,GAAG;UAC1BH,KAAK,EAAE,eAAe;UACtBE,IAAI,EAAE,mBAAmB;UACzBG,QAAQ,EAAEN,OAAO,CAACM;QACpB,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"}
|
package/dist/es5/kml-loader.js
CHANGED
|
@@ -9,7 +9,7 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"))
|
|
|
9
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
10
|
var _togeojson = require("@tmcw/togeojson");
|
|
11
11
|
var _xmldom = require("@xmldom/xmldom");
|
|
12
|
-
var VERSION = typeof "4.0.0-alpha.
|
|
12
|
+
var VERSION = typeof "4.0.0-alpha.25" !== 'undefined' ? "4.0.0-alpha.25" : 'latest';
|
|
13
13
|
var KML_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<kml xmlns=\"http://www.opengis.net/kml/2.2\">";
|
|
14
14
|
var KMLLoader = {
|
|
15
15
|
name: 'KML (Keyhole Markup Language)',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kml-loader.js","names":["_togeojson","require","_xmldom","VERSION","KML_HEADER","KMLLoader","name","id","module","version","extensions","mimeTypes","text","tests","parse","_parse","_asyncToGenerator2","default","_regenerator","mark","_callee","arrayBuffer","options","wrap","_callee$","_context","prev","next","abrupt","parseTextSync","TextDecoder","decode","stop","_x","_x2","apply","arguments","kml","gis","exports","_options$gis","_options$kml","_options$kml2","doc","DOMParser","parseFromString","geojson","shape","format","type","table","data","features"],"sources":["../../src/kml-loader.ts"],"sourcesContent":["import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\n// import {geojsonToBinary} from '@loaders.gl/gis';\n// import {
|
|
1
|
+
{"version":3,"file":"kml-loader.js","names":["_togeojson","require","_xmldom","VERSION","KML_HEADER","KMLLoader","name","id","module","version","extensions","mimeTypes","text","tests","parse","_parse","_asyncToGenerator2","default","_regenerator","mark","_callee","arrayBuffer","options","wrap","_callee$","_context","prev","next","abrupt","parseTextSync","TextDecoder","decode","stop","_x","_x2","apply","arguments","kml","gis","exports","_options$gis","_options$kml","_options$kml2","doc","DOMParser","parseFromString","geojson","shape","format","type","table","data","features"],"sources":["../../src/kml-loader.ts"],"sourcesContent":["import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\n// import {geojsonToBinary} from '@loaders.gl/gis';\n// import {GeoJSONTable} from '@loaders.gl/schema';\nimport {FeatureCollection, ObjectRowTable} from '@loaders.gl/schema';\nimport {kml} from '@tmcw/togeojson';\nimport {DOMParser} from '@xmldom/xmldom';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type KMLLoaderOptions = LoaderOptions & {\n kml?: {\n shape?: 'object-row-table' | 'geojson-table';\n /** @deprecated. Use options.kml.shape */\n type?: 'object-row-table' | 'geojson-table';\n };\n gis?: {\n /** @deprecated. Use options.kml.shape */\n format?: 'object-row-table' | 'geojson-table' | 'geojson' | 'binary' | 'raw';\n };\n};\n\nconst KML_HEADER = `\\\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<kml xmlns=\"http://www.opengis.net/kml/2.2\">`;\n\n/**\n * Loader for KML (Keyhole Markup Language)\n */\nexport const KMLLoader: LoaderWithParser<ObjectRowTable, never, KMLLoaderOptions> = {\n name: 'KML (Keyhole Markup Language)',\n id: 'kml',\n module: 'kml',\n version: VERSION,\n extensions: ['kml'],\n mimeTypes: ['application/vnd.google-earth.kml+xml'],\n text: true,\n tests: [KML_HEADER],\n parse: async (arrayBuffer, options?: KMLLoaderOptions) =>\n parseTextSync(new TextDecoder().decode(arrayBuffer), options),\n parseTextSync,\n options: {\n kml: {},\n gis: {}\n }\n};\n\nfunction parseTextSync(text: string, options?: KMLLoaderOptions): ObjectRowTable {\n const doc = new DOMParser().parseFromString(text, 'text/xml');\n const geojson: FeatureCollection = kml(doc);\n\n // backwards compatibility\n const shape = options?.gis?.format || options?.kml?.type || options?.kml?.shape;\n switch (shape) {\n // case 'geojson-table': {\n // const table: GeoJSONTable = {\n // shape: 'geojson-table',\n // data: geojson.features\n // };\n // return table;\n // }\n // case 'geojson':\n // return geojson;\n // case 'binary':\n // return geojsonToBinary(geojson.features);\n // case 'raw':\n // return doc;\n case 'object-row-table':\n default:\n const table: ObjectRowTable = {\n shape: 'object-row-table',\n data: geojson.features\n };\n return table;\n }\n}\n"],"mappings":";;;;;;;;;AAIA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,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,GAAG,GAAG,IAAIC,iBAAS,CAAC,CAAC,CAACC,eAAe,CAACjC,IAAI,EAAE,UAAU,CAAC;EAC7D,IAAMkC,OAA0B,GAAG,IAAAT,cAAG,EAACM,GAAG,CAAC;EAG3C,IAAMI,KAAK,GAAG,CAAAzB,OAAO,aAAPA,OAAO,wBAAAkB,YAAA,GAAPlB,OAAO,CAAEgB,GAAG,cAAAE,YAAA,uBAAZA,YAAA,CAAcQ,MAAM,MAAI1B,OAAO,aAAPA,OAAO,wBAAAmB,YAAA,GAAPnB,OAAO,CAAEe,GAAG,cAAAI,YAAA,uBAAZA,YAAA,CAAcQ,IAAI,MAAI3B,OAAO,aAAPA,OAAO,wBAAAoB,aAAA,GAAPpB,OAAO,CAAEe,GAAG,cAAAK,aAAA,uBAAZA,aAAA,CAAcK,KAAK;EAC/E,QAAQA,KAAK;IAcX,KAAK,kBAAkB;IACvB;MACE,IAAMG,KAAqB,GAAG;QAC5BH,KAAK,EAAE,kBAAkB;QACzBI,IAAI,EAAEL,OAAO,CAACM;MAChB,CAAC;MACD,OAAOF,KAAK;EAChB;AACF"}
|
package/dist/es5/tcx-loader.js
CHANGED
|
@@ -10,7 +10,7 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
|
|
|
10
10
|
var _gis = require("@loaders.gl/gis");
|
|
11
11
|
var _togeojson = require("@tmcw/togeojson");
|
|
12
12
|
var _xmldom = require("@xmldom/xmldom");
|
|
13
|
-
var VERSION = typeof "4.0.0-alpha.
|
|
13
|
+
var VERSION = typeof "4.0.0-alpha.25" !== 'undefined' ? "4.0.0-alpha.25" : 'latest';
|
|
14
14
|
var TCX_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<TrainingCenterDatabase";
|
|
15
15
|
var TCXLoader = {
|
|
16
16
|
name: 'TCX (Training Center XML)',
|
|
@@ -59,11 +59,12 @@ function parseTextSync(text, options) {
|
|
|
59
59
|
};
|
|
60
60
|
return table;
|
|
61
61
|
}
|
|
62
|
-
case 'geojson-
|
|
62
|
+
case 'geojson-table':
|
|
63
63
|
{
|
|
64
64
|
var _table = {
|
|
65
|
-
shape: 'geojson-
|
|
66
|
-
|
|
65
|
+
shape: 'geojson-table',
|
|
66
|
+
type: 'FeatureCollection',
|
|
67
|
+
features: geojson.features
|
|
67
68
|
};
|
|
68
69
|
return _table;
|
|
69
70
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tcx-loader.js","names":["_gis","require","_togeojson","_xmldom","VERSION","TCX_HEADER","TCXLoader","name","id","module","version","extensions","mimeTypes","text","tests","parse","_parse","_asyncToGenerator2","default","_regenerator","mark","_callee","arrayBuffer","options","wrap","_callee$","_context","prev","next","abrupt","parseTextSync","TextDecoder","decode","stop","_x","_x2","apply","arguments","tcx","gis","exports","_options$gis","_options$tcx","_options$tcx2","doc","DOMParser","parseFromString","geojson","shape","format","type","table","data","features","geojsonToBinary"],"sources":["../../src/tcx-loader.ts"],"sourcesContent":["import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport {geojsonToBinary} from '@loaders.gl/gis';\nimport type {
|
|
1
|
+
{"version":3,"file":"tcx-loader.js","names":["_gis","require","_togeojson","_xmldom","VERSION","TCX_HEADER","TCXLoader","name","id","module","version","extensions","mimeTypes","text","tests","parse","_parse","_asyncToGenerator2","default","_regenerator","mark","_callee","arrayBuffer","options","wrap","_callee$","_context","prev","next","abrupt","parseTextSync","TextDecoder","decode","stop","_x","_x2","apply","arguments","tcx","gis","exports","_options$gis","_options$tcx","_options$tcx2","doc","DOMParser","parseFromString","geojson","shape","format","type","table","data","features","geojsonToBinary"],"sources":["../../src/tcx-loader.ts"],"sourcesContent":["import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport {geojsonToBinary} from '@loaders.gl/gis';\nimport type {GeoJSONTable, FeatureCollection, ObjectRowTable} from '@loaders.gl/schema';\nimport {tcx} from '@tmcw/togeojson';\nimport {DOMParser} from '@xmldom/xmldom';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type TCXLoaderOptions = LoaderOptions & {\n tcx?: {\n shape?: 'object-row-table' | 'geojson-table' | 'geojson' | 'binary' | 'raw';\n /** @deprecated. Use options.tcx.shape */\n type?: 'object-row-table' | 'geojson-table' | 'geojson' | 'binary' | 'raw';\n };\n gis?: {\n /** @deprecated. Use options.tcx.shape */\n format?: 'object-row-table' | 'geojson-table' | 'geojson' | 'binary' | 'raw';\n };\n};\n\nconst TCX_HEADER = `\\\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<TrainingCenterDatabase`;\n\n/**\n * Loader for TCX (Training Center XML) - Garmin GPS track format\n */\nexport const TCXLoader: LoaderWithParser<any, never, TCXLoaderOptions> = {\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-table': {\n const table: GeoJSONTable = {\n shape: 'geojson-table',\n type: 'FeatureCollection',\n features: 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 ge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sonToBinary } from '@loaders.gl/gis';
|
|
2
2
|
import { gpx } from '@tmcw/togeojson';
|
|
3
3
|
import { DOMParser } from '@xmldom/xmldom';
|
|
4
|
-
const VERSION = typeof "4.0.0-alpha.
|
|
4
|
+
const VERSION = typeof "4.0.0-alpha.25" !== 'undefined' ? "4.0.0-alpha.25" : 'latest';
|
|
5
5
|
const GPX_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<gpx";
|
|
6
6
|
export const GPXLoader = {
|
|
7
7
|
name: 'GPX (GPS exchange format)',
|
|
@@ -33,11 +33,12 @@ function parseTextSync(text, options) {
|
|
|
33
33
|
};
|
|
34
34
|
return table;
|
|
35
35
|
}
|
|
36
|
-
case 'geojson-
|
|
36
|
+
case 'geojson-table':
|
|
37
37
|
{
|
|
38
38
|
const table = {
|
|
39
|
-
shape: 'geojson-
|
|
40
|
-
|
|
39
|
+
shape: 'geojson-table',
|
|
40
|
+
type: 'FeatureCollection',
|
|
41
|
+
features: geojson.features
|
|
41
42
|
};
|
|
42
43
|
return table;
|
|
43
44
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gpx-loader.js","names":["geojsonToBinary","gpx","DOMParser","VERSION","GPX_HEADER","GPXLoader","name","id","module","version","extensions","mimeTypes","text","tests","parse","arrayBuffer","options","parseTextSync","TextDecoder","decode","gis","_options$gis","_options$gpx","_options$gpx2","doc","parseFromString","geojson","shape","format","type","table","data","features"],"sources":["../../src/gpx-loader.ts"],"sourcesContent":["import type {LoaderOptions, LoaderWithParser} from '@loaders.gl/loader-utils';\nimport {geojsonToBinary} from '@loaders.gl/gis';\nimport type {
|
|
1
|
+
{"version":3,"file":"gpx-loader.js","names":["geojsonToBinary","gpx","DOMParser","VERSION","GPX_HEADER","GPXLoader","name","id","module","version","extensions","mimeTypes","text","tests","parse","arrayBuffer","options","parseTextSync","TextDecoder","decode","gis","_options$gis","_options$gpx","_options$gpx2","doc","parseFromString","geojson","shape","format","type","table","data","features"],"sources":["../../src/gpx-loader.ts"],"sourcesContent":["import type {LoaderOptions, LoaderWithParser} from '@loaders.gl/loader-utils';\nimport {geojsonToBinary} from '@loaders.gl/gis';\nimport type {GeoJSONTable, FeatureCollection, ObjectRowTable} from '@loaders.gl/schema';\nimport {gpx} from '@tmcw/togeojson';\nimport {DOMParser} from '@xmldom/xmldom';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type GPXLoaderOptions = LoaderOptions & {\n gpx?: {\n shape?: 'object-row-table' | 'geojson-table' | 'geojson' | 'binary' | 'raw';\n /** @deprecated. Use options.gpx.shape */\n type?: 'object-row-table' | 'geojson-table' | 'geojson' | 'binary' | 'raw';\n };\n gis?: {\n /** @deprecated. Use options.gpx.shape */\n format?: 'object-row-table' | 'geojson-table' | 'geojson' | 'binary' | 'raw';\n };\n};\n\nconst GPX_HEADER = `\\\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<gpx`;\n\n/**\n * Loader for GPX (GPS exchange format)\n */\nexport const GPXLoader: LoaderWithParser<any, never, GPXLoaderOptions> = {\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-table': {\n const table: GeoJSONTable = {\n shape: 'geojson-table',\n type: 'FeatureCollection',\n features: geojson.features\n };\n return table;\n }\n case 'geojson':\n return geojson;\n case 'binary':\n return geojsonToBinary(geojson.features);\n case 'raw':\n return doc;\n default:\n // Default to geojson for backwards compatibility\n return geojson;\n }\n}\n"],"mappings":"AACA,SAAQA,eAAe,QAAO,iBAAiB;AAE/C,SAAQC,GAAG,QAAO,iBAAiB;AACnC,SAAQC,SAAS,QAAO,gBAAgB;AAIxC,MAAMC,OAAO,GAAG,uBAAkB,KAAK,WAAW,sBAAiB,QAAQ;AAc3E,MAAMC,UAAU,qDAEX;AAKL,OAAO,MAAMC,SAAyD,GAAG;EACvEC,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;IACPf,GAAG,EAAE,CAAC,CAAC;IACPmB,GAAG,EAAE,CAAC;EACR;AACF,CAAC;AAED,SAASH,aAAaA,CAACL,IAAY,EAAEI,OAA0B,EAAE;EAAA,IAAAK,YAAA,EAAAC,YAAA,EAAAC,aAAA;EAC/D,MAAMC,GAAG,GAAG,IAAItB,SAAS,CAAC,CAAC,CAACuB,eAAe,CAACb,IAAI,EAAE,UAAU,CAAC;EAC7D,MAAMc,OAA0B,GAAGzB,GAAG,CAACuB,GAAG,CAAC;EAE3C,MAAMG,KAAK,GAAG,CAAAX,OAAO,aAAPA,OAAO,wBAAAK,YAAA,GAAPL,OAAO,CAAEI,GAAG,cAAAC,YAAA,uBAAZA,YAAA,CAAcO,MAAM,MAAIZ,OAAO,aAAPA,OAAO,wBAAAM,YAAA,GAAPN,OAAO,CAAEf,GAAG,cAAAqB,YAAA,uBAAZA,YAAA,CAAcO,IAAI,MAAIb,OAAO,aAAPA,OAAO,wBAAAO,aAAA,GAAPP,OAAO,CAAEf,GAAG,cAAAsB,aAAA,uBAAZA,aAAA,CAAcI,KAAK;EAE/E,QAAQA,KAAK;IACX,KAAK,kBAAkB;MAAE;QACvB,MAAMG,KAAqB,GAAG;UAC5BH,KAAK,EAAE,kBAAkB;UACzBI,IAAI,EAAEL,OAAO,CAACM;QAChB,CAAC;QACD,OAAOF,KAAK;MACd;IACA,KAAK,eAAe;MAAE;QACpB,MAAMA,KAAmB,GAAG;UAC1BH,KAAK,EAAE,eAAe;UACtBE,IAAI,EAAE,mBAAmB;UACzBG,QAAQ,EAAEN,OAAO,CAACM;QACpB,CAAC;QACD,OAAOF,KAAK;MACd;IACA,KAAK,SAAS;MACZ,OAAOJ,OAAO;IAChB,KAAK,QAAQ;MACX,OAAO1B,eAAe,CAAC0B,OAAO,CAACM,QAAQ,CAAC;IAC1C,KAAK,KAAK;MACR,OAAOR,GAAG;IACZ;MAEE,OAAOE,OAAO;EAClB;AACF"}
|
package/dist/esm/kml-loader.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { kml } from '@tmcw/togeojson';
|
|
2
2
|
import { DOMParser } from '@xmldom/xmldom';
|
|
3
|
-
const VERSION = typeof "4.0.0-alpha.
|
|
3
|
+
const VERSION = typeof "4.0.0-alpha.25" !== 'undefined' ? "4.0.0-alpha.25" : 'latest';
|
|
4
4
|
const KML_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<kml xmlns=\"http://www.opengis.net/kml/2.2\">";
|
|
5
5
|
export const KMLLoader = {
|
|
6
6
|
name: 'KML (Keyhole Markup Language)',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kml-loader.js","names":["kml","DOMParser","VERSION","KML_HEADER","KMLLoader","name","id","module","version","extensions","mimeTypes","text","tests","parse","arrayBuffer","options","parseTextSync","TextDecoder","decode","gis","_options$gis","_options$kml","_options$kml2","doc","parseFromString","geojson","shape","format","type","table","data","features"],"sources":["../../src/kml-loader.ts"],"sourcesContent":["import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\n// import {geojsonToBinary} from '@loaders.gl/gis';\n// import {
|
|
1
|
+
{"version":3,"file":"kml-loader.js","names":["kml","DOMParser","VERSION","KML_HEADER","KMLLoader","name","id","module","version","extensions","mimeTypes","text","tests","parse","arrayBuffer","options","parseTextSync","TextDecoder","decode","gis","_options$gis","_options$kml","_options$kml2","doc","parseFromString","geojson","shape","format","type","table","data","features"],"sources":["../../src/kml-loader.ts"],"sourcesContent":["import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\n// import {geojsonToBinary} from '@loaders.gl/gis';\n// import {GeoJSONTable} from '@loaders.gl/schema';\nimport {FeatureCollection, ObjectRowTable} from '@loaders.gl/schema';\nimport {kml} from '@tmcw/togeojson';\nimport {DOMParser} from '@xmldom/xmldom';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type KMLLoaderOptions = LoaderOptions & {\n kml?: {\n shape?: 'object-row-table' | 'geojson-table';\n /** @deprecated. Use options.kml.shape */\n type?: 'object-row-table' | 'geojson-table';\n };\n gis?: {\n /** @deprecated. Use options.kml.shape */\n format?: 'object-row-table' | 'geojson-table' | 'geojson' | 'binary' | 'raw';\n };\n};\n\nconst KML_HEADER = `\\\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<kml xmlns=\"http://www.opengis.net/kml/2.2\">`;\n\n/**\n * Loader for KML (Keyhole Markup Language)\n */\nexport const KMLLoader: LoaderWithParser<ObjectRowTable, never, KMLLoaderOptions> = {\n name: 'KML (Keyhole Markup Language)',\n id: 'kml',\n module: 'kml',\n version: VERSION,\n extensions: ['kml'],\n mimeTypes: ['application/vnd.google-earth.kml+xml'],\n text: true,\n tests: [KML_HEADER],\n parse: async (arrayBuffer, options?: KMLLoaderOptions) =>\n parseTextSync(new TextDecoder().decode(arrayBuffer), options),\n parseTextSync,\n options: {\n kml: {},\n gis: {}\n }\n};\n\nfunction parseTextSync(text: string, options?: KMLLoaderOptions): ObjectRowTable {\n const doc = new DOMParser().parseFromString(text, 'text/xml');\n const geojson: FeatureCollection = kml(doc);\n\n // backwards compatibility\n const shape = options?.gis?.format || options?.kml?.type || options?.kml?.shape;\n switch (shape) {\n // case 'geojson-table': {\n // const table: GeoJSONTable = {\n // shape: 'geojson-table',\n // data: geojson.features\n // };\n // return table;\n // }\n // case 'geojson':\n // return geojson;\n // case 'binary':\n // return geojsonToBinary(geojson.features);\n // case 'raw':\n // return doc;\n case 'object-row-table':\n default:\n const table: ObjectRowTable = {\n shape: 'object-row-table',\n data: geojson.features\n };\n return table;\n }\n}\n"],"mappings":"AAIA,SAAQA,GAAG,QAAO,iBAAiB;AACnC,SAAQC,SAAS,QAAO,gBAAgB;AAIxC,MAAMC,OAAO,GAAG,uBAAkB,KAAK,WAAW,sBAAiB,QAAQ;AAc3E,MAAMC,UAAU,+FAE6B;AAK7C,OAAO,MAAMC,SAAoE,GAAG;EAClFC,IAAI,EAAE,+BAA+B;EACrCC,EAAE,EAAE,KAAK;EACTC,MAAM,EAAE,KAAK;EACbC,OAAO,EAAEN,OAAO;EAChBO,UAAU,EAAE,CAAC,KAAK,CAAC;EACnBC,SAAS,EAAE,CAAC,sCAAsC,CAAC;EACnDC,IAAI,EAAE,IAAI;EACVC,KAAK,EAAE,CAACT,UAAU,CAAC;EACnBU,KAAK,EAAE,MAAAA,CAAOC,WAAW,EAAEC,OAA0B,KACnDC,aAAa,CAAC,IAAIC,WAAW,CAAC,CAAC,CAACC,MAAM,CAACJ,WAAW,CAAC,EAAEC,OAAO,CAAC;EAC/DC,aAAa;EACbD,OAAO,EAAE;IACPf,GAAG,EAAE,CAAC,CAAC;IACPmB,GAAG,EAAE,CAAC;EACR;AACF,CAAC;AAED,SAASH,aAAaA,CAACL,IAAY,EAAEI,OAA0B,EAAkB;EAAA,IAAAK,YAAA,EAAAC,YAAA,EAAAC,aAAA;EAC/E,MAAMC,GAAG,GAAG,IAAItB,SAAS,CAAC,CAAC,CAACuB,eAAe,CAACb,IAAI,EAAE,UAAU,CAAC;EAC7D,MAAMc,OAA0B,GAAGzB,GAAG,CAACuB,GAAG,CAAC;EAG3C,MAAMG,KAAK,GAAG,CAAAX,OAAO,aAAPA,OAAO,wBAAAK,YAAA,GAAPL,OAAO,CAAEI,GAAG,cAAAC,YAAA,uBAAZA,YAAA,CAAcO,MAAM,MAAIZ,OAAO,aAAPA,OAAO,wBAAAM,YAAA,GAAPN,OAAO,CAAEf,GAAG,cAAAqB,YAAA,uBAAZA,YAAA,CAAcO,IAAI,MAAIb,OAAO,aAAPA,OAAO,wBAAAO,aAAA,GAAPP,OAAO,CAAEf,GAAG,cAAAsB,aAAA,uBAAZA,aAAA,CAAcI,KAAK;EAC/E,QAAQA,KAAK;IAcX,KAAK,kBAAkB;IACvB;MACE,MAAMG,KAAqB,GAAG;QAC5BH,KAAK,EAAE,kBAAkB;QACzBI,IAAI,EAAEL,OAAO,CAACM;MAChB,CAAC;MACD,OAAOF,KAAK;EAChB;AACF"}
|
package/dist/esm/tcx-loader.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { geojsonToBinary } from '@loaders.gl/gis';
|
|
2
2
|
import { tcx } from '@tmcw/togeojson';
|
|
3
3
|
import { DOMParser } from '@xmldom/xmldom';
|
|
4
|
-
const VERSION = typeof "4.0.0-alpha.
|
|
4
|
+
const VERSION = typeof "4.0.0-alpha.25" !== 'undefined' ? "4.0.0-alpha.25" : 'latest';
|
|
5
5
|
const TCX_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<TrainingCenterDatabase";
|
|
6
6
|
export const TCXLoader = {
|
|
7
7
|
name: 'TCX (Training Center XML)',
|
|
@@ -33,11 +33,12 @@ function parseTextSync(text, options) {
|
|
|
33
33
|
};
|
|
34
34
|
return table;
|
|
35
35
|
}
|
|
36
|
-
case 'geojson-
|
|
36
|
+
case 'geojson-table':
|
|
37
37
|
{
|
|
38
38
|
const table = {
|
|
39
|
-
shape: 'geojson-
|
|
40
|
-
|
|
39
|
+
shape: 'geojson-table',
|
|
40
|
+
type: 'FeatureCollection',
|
|
41
|
+
features: geojson.features
|
|
41
42
|
};
|
|
42
43
|
return table;
|
|
43
44
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tcx-loader.js","names":["geojsonToBinary","tcx","DOMParser","VERSION","TCX_HEADER","TCXLoader","name","id","module","version","extensions","mimeTypes","text","tests","parse","arrayBuffer","options","parseTextSync","TextDecoder","decode","gis","_options$gis","_options$tcx","_options$tcx2","doc","parseFromString","geojson","shape","format","type","table","data","features"],"sources":["../../src/tcx-loader.ts"],"sourcesContent":["import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport {geojsonToBinary} from '@loaders.gl/gis';\nimport type {
|
|
1
|
+
{"version":3,"file":"tcx-loader.js","names":["geojsonToBinary","tcx","DOMParser","VERSION","TCX_HEADER","TCXLoader","name","id","module","version","extensions","mimeTypes","text","tests","parse","arrayBuffer","options","parseTextSync","TextDecoder","decode","gis","_options$gis","_options$tcx","_options$tcx2","doc","parseFromString","geojson","shape","format","type","table","data","features"],"sources":["../../src/tcx-loader.ts"],"sourcesContent":["import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport {geojsonToBinary} from '@loaders.gl/gis';\nimport type {GeoJSONTable, FeatureCollection, ObjectRowTable} from '@loaders.gl/schema';\nimport {tcx} from '@tmcw/togeojson';\nimport {DOMParser} from '@xmldom/xmldom';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type TCXLoaderOptions = LoaderOptions & {\n tcx?: {\n shape?: 'object-row-table' | 'geojson-table' | 'geojson' | 'binary' | 'raw';\n /** @deprecated. Use options.tcx.shape */\n type?: 'object-row-table' | 'geojson-table' | 'geojson' | 'binary' | 'raw';\n };\n gis?: {\n /** @deprecated. Use options.tcx.shape */\n format?: 'object-row-table' | 'geojson-table' | 'geojson' | 'binary' | 'raw';\n };\n};\n\nconst TCX_HEADER = `\\\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<TrainingCenterDatabase`;\n\n/**\n * Loader for TCX (Training Center XML) - Garmin GPS track format\n */\nexport const TCXLoader: LoaderWithParser<any, never, TCXLoaderOptions> = {\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-table': {\n const table: GeoJSONTable = {\n shape: 'geojson-table',\n type: 'FeatureCollection',\n features: geojson.features\n };\n return table;\n }\n case 'geojson':\n return geojson;\n case 'binary':\n return geojsonToBinary(geojson.features);\n case 'raw':\n return doc;\n default:\n // Default to geojson for backwards compatibility\n return geojson;\n }\n}\n"],"mappings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PA,OAAO,wBAAAO,aAAA,GAAPP,OAAO,CAAEf,GAAG,cAAAsB,aAAA,uBAAZA,aAAA,CAAcI,KAAK;EAE/E,QAAQA,KAAK;IACX,KAAK,kBAAkB;MAAE;QACvB,MAAMG,KAAqB,GAAG;UAC5BH,KAAK,EAAE,kBAAkB;UACzBI,IAAI,EAAEL,OAAO,CAACM;QAChB,CAAC;QACD,OAAOF,KAAK;MACd;IACA,KAAK,eAAe;MAAE;QACpB,MAAMA,KAAmB,GAAG;UAC1BH,KAAK,EAAE,eAAe;UACtBE,IAAI,EAAE,mBAAmB;UACzBG,QAAQ,EAAEN,OAAO,CAACM;QACpB,CAAC;QACD,OAAOF,KAAK;MACd;IACA,KAAK,SAAS;MACZ,OAAOJ,OAAO;IAChB,KAAK,QAAQ;MACX,OAAO1B,eAAe,CAAC0B,OAAO,CAACM,QAAQ,CAAC;IAC1C,KAAK,KAAK;MACR,OAAOR,GAAG;IACZ;MAEE,OAAOE,OAAO;EAClB;AACF"}
|
package/dist/gpx-loader.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import type { LoaderOptions, LoaderWithParser } from '@loaders.gl/loader-utils';
|
|
2
2
|
export type GPXLoaderOptions = LoaderOptions & {
|
|
3
3
|
gpx?: {
|
|
4
|
-
shape?: 'object-row-table' | 'geojson-
|
|
4
|
+
shape?: 'object-row-table' | 'geojson-table' | 'geojson' | 'binary' | 'raw';
|
|
5
5
|
/** @deprecated. Use options.gpx.shape */
|
|
6
|
-
type?: 'object-row-table' | 'geojson-
|
|
6
|
+
type?: 'object-row-table' | 'geojson-table' | 'geojson' | 'binary' | 'raw';
|
|
7
7
|
};
|
|
8
8
|
gis?: {
|
|
9
9
|
/** @deprecated. Use options.gpx.shape */
|
|
10
|
-
format?: 'object-row-table' | 'geojson-
|
|
10
|
+
format?: 'object-row-table' | 'geojson-table' | 'geojson' | 'binary' | 'raw';
|
|
11
11
|
};
|
|
12
12
|
};
|
|
13
13
|
/**
|
|
14
14
|
* Loader for GPX (GPS exchange format)
|
|
15
15
|
*/
|
|
16
|
-
export declare const GPXLoader: LoaderWithParser
|
|
16
|
+
export declare const GPXLoader: LoaderWithParser<any, never, GPXLoaderOptions>;
|
|
17
17
|
//# 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,EAAE,gBAAgB,EAAC,MAAM,0BAA0B,CAAC;AAU9E,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG;IAC7C,GAAG,CAAC,EAAE;QACJ,KAAK,CAAC,EAAE,kBAAkB,GAAG,
|
|
1
|
+
{"version":3,"file":"gpx-loader.d.ts","sourceRoot":"","sources":["../src/gpx-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,EAAE,gBAAgB,EAAC,MAAM,0BAA0B,CAAC;AAU9E,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG;IAC7C,GAAG,CAAC,EAAE;QACJ,KAAK,CAAC,EAAE,kBAAkB,GAAG,eAAe,GAAG,SAAS,GAAG,QAAQ,GAAG,KAAK,CAAC;QAC5E,yCAAyC;QACzC,IAAI,CAAC,EAAE,kBAAkB,GAAG,eAAe,GAAG,SAAS,GAAG,QAAQ,GAAG,KAAK,CAAC;KAC5E,CAAC;IACF,GAAG,CAAC,EAAE;QACJ,yCAAyC;QACzC,MAAM,CAAC,EAAE,kBAAkB,GAAG,eAAe,GAAG,SAAS,GAAG,QAAQ,GAAG,KAAK,CAAC;KAC9E,CAAC;CACH,CAAC;AAMF;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,gBAAgB,CAAC,GAAG,EAAE,KAAK,EAAE,gBAAgB,CAgBpE,CAAC"}
|
package/dist/kml-loader.d.ts
CHANGED
|
@@ -2,13 +2,13 @@ import type { LoaderWithParser, LoaderOptions } from '@loaders.gl/loader-utils';
|
|
|
2
2
|
import { ObjectRowTable } from '@loaders.gl/schema';
|
|
3
3
|
export type KMLLoaderOptions = LoaderOptions & {
|
|
4
4
|
kml?: {
|
|
5
|
-
shape?: 'object-row-table' | 'geojson-
|
|
5
|
+
shape?: 'object-row-table' | 'geojson-table';
|
|
6
6
|
/** @deprecated. Use options.kml.shape */
|
|
7
|
-
type?: 'object-row-table' | 'geojson-
|
|
7
|
+
type?: 'object-row-table' | 'geojson-table';
|
|
8
8
|
};
|
|
9
9
|
gis?: {
|
|
10
10
|
/** @deprecated. Use options.kml.shape */
|
|
11
|
-
format?: 'object-row-table' | 'geojson-
|
|
11
|
+
format?: 'object-row-table' | 'geojson-table' | 'geojson' | 'binary' | 'raw';
|
|
12
12
|
};
|
|
13
13
|
};
|
|
14
14
|
/**
|
package/dist/kml-loader.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kml-loader.d.ts","sourceRoot":"","sources":["../src/kml-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,gBAAgB,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAG9E,OAAO,EAAoB,cAAc,EAAC,MAAM,oBAAoB,CAAC;AAQrE,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG;IAC7C,GAAG,CAAC,EAAE;QACJ,KAAK,CAAC,EAAE,kBAAkB,GAAG,
|
|
1
|
+
{"version":3,"file":"kml-loader.d.ts","sourceRoot":"","sources":["../src/kml-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,gBAAgB,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAG9E,OAAO,EAAoB,cAAc,EAAC,MAAM,oBAAoB,CAAC;AAQrE,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG;IAC7C,GAAG,CAAC,EAAE;QACJ,KAAK,CAAC,EAAE,kBAAkB,GAAG,eAAe,CAAC;QAC7C,yCAAyC;QACzC,IAAI,CAAC,EAAE,kBAAkB,GAAG,eAAe,CAAC;KAC7C,CAAC;IACF,GAAG,CAAC,EAAE;QACJ,yCAAyC;QACzC,MAAM,CAAC,EAAE,kBAAkB,GAAG,eAAe,GAAG,SAAS,GAAG,QAAQ,GAAG,KAAK,CAAC;KAC9E,CAAC;CACH,CAAC;AAMF;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,gBAAgB,CAAC,cAAc,EAAE,KAAK,EAAE,gBAAgB,CAgB/E,CAAC"}
|
package/dist/tcx-loader.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import type { LoaderWithParser, LoaderOptions } from '@loaders.gl/loader-utils';
|
|
2
2
|
export type TCXLoaderOptions = LoaderOptions & {
|
|
3
3
|
tcx?: {
|
|
4
|
-
shape?: 'object-row-table' | 'geojson-
|
|
4
|
+
shape?: 'object-row-table' | 'geojson-table' | 'geojson' | 'binary' | 'raw';
|
|
5
5
|
/** @deprecated. Use options.tcx.shape */
|
|
6
|
-
type?: 'object-row-table' | 'geojson-
|
|
6
|
+
type?: 'object-row-table' | 'geojson-table' | 'geojson' | 'binary' | 'raw';
|
|
7
7
|
};
|
|
8
8
|
gis?: {
|
|
9
9
|
/** @deprecated. Use options.tcx.shape */
|
|
10
|
-
format?: 'object-row-table' | 'geojson-
|
|
10
|
+
format?: 'object-row-table' | 'geojson-table' | 'geojson' | 'binary' | 'raw';
|
|
11
11
|
};
|
|
12
12
|
};
|
|
13
13
|
/**
|
|
14
14
|
* Loader for TCX (Training Center XML) - Garmin GPS track format
|
|
15
15
|
*/
|
|
16
|
-
export declare const TCXLoader: LoaderWithParser
|
|
16
|
+
export declare const TCXLoader: LoaderWithParser<any, never, TCXLoaderOptions>;
|
|
17
17
|
//# sourceMappingURL=tcx-loader.d.ts.map
|
package/dist/tcx-loader.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tcx-loader.d.ts","sourceRoot":"","sources":["../src/tcx-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,gBAAgB,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAU9E,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG;IAC7C,GAAG,CAAC,EAAE;QACJ,KAAK,CAAC,EAAE,kBAAkB,GAAG,
|
|
1
|
+
{"version":3,"file":"tcx-loader.d.ts","sourceRoot":"","sources":["../src/tcx-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,gBAAgB,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAU9E,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG;IAC7C,GAAG,CAAC,EAAE;QACJ,KAAK,CAAC,EAAE,kBAAkB,GAAG,eAAe,GAAG,SAAS,GAAG,QAAQ,GAAG,KAAK,CAAC;QAC5E,yCAAyC;QACzC,IAAI,CAAC,EAAE,kBAAkB,GAAG,eAAe,GAAG,SAAS,GAAG,QAAQ,GAAG,KAAK,CAAC;KAC5E,CAAC;IACF,GAAG,CAAC,EAAE;QACJ,yCAAyC;QACzC,MAAM,CAAC,EAAE,kBAAkB,GAAG,eAAe,GAAG,SAAS,GAAG,QAAQ,GAAG,KAAK,CAAC;KAC9E,CAAC;CACH,CAAC;AAMF;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,gBAAgB,CAAC,GAAG,EAAE,KAAK,EAAE,gBAAgB,CAgBpE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/kml",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.25",
|
|
4
4
|
"description": "Framework-independent loader for the KML format",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
"build-bundle": "esbuild src/bundle.ts --bundle --outfile=dist/dist.min.js"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@loaders.gl/gis": "4.0.0-alpha.
|
|
36
|
-
"@loaders.gl/loader-utils": "4.0.0-alpha.
|
|
37
|
-
"@loaders.gl/schema": "4.0.0-alpha.
|
|
35
|
+
"@loaders.gl/gis": "4.0.0-alpha.25",
|
|
36
|
+
"@loaders.gl/loader-utils": "4.0.0-alpha.25",
|
|
37
|
+
"@loaders.gl/schema": "4.0.0-alpha.25",
|
|
38
38
|
"@tmcw/togeojson": "^4.5.0",
|
|
39
39
|
"@xmldom/xmldom": "^0.7.13"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "40135f391b869388dbbcd615bbe51178d0c370be"
|
|
42
42
|
}
|
package/src/gpx-loader.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type {LoaderOptions, LoaderWithParser} from '@loaders.gl/loader-utils';
|
|
2
2
|
import {geojsonToBinary} from '@loaders.gl/gis';
|
|
3
|
-
import type {
|
|
3
|
+
import type {GeoJSONTable, FeatureCollection, ObjectRowTable} from '@loaders.gl/schema';
|
|
4
4
|
import {gpx} from '@tmcw/togeojson';
|
|
5
5
|
import {DOMParser} from '@xmldom/xmldom';
|
|
6
6
|
|
|
@@ -10,13 +10,13 @@ const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';
|
|
|
10
10
|
|
|
11
11
|
export type GPXLoaderOptions = LoaderOptions & {
|
|
12
12
|
gpx?: {
|
|
13
|
-
shape?: 'object-row-table' | 'geojson-
|
|
13
|
+
shape?: 'object-row-table' | 'geojson-table' | 'geojson' | 'binary' | 'raw';
|
|
14
14
|
/** @deprecated. Use options.gpx.shape */
|
|
15
|
-
type?: 'object-row-table' | 'geojson-
|
|
15
|
+
type?: 'object-row-table' | 'geojson-table' | 'geojson' | 'binary' | 'raw';
|
|
16
16
|
};
|
|
17
17
|
gis?: {
|
|
18
18
|
/** @deprecated. Use options.gpx.shape */
|
|
19
|
-
format?: 'object-row-table' | 'geojson-
|
|
19
|
+
format?: 'object-row-table' | 'geojson-table' | 'geojson' | 'binary' | 'raw';
|
|
20
20
|
};
|
|
21
21
|
};
|
|
22
22
|
|
|
@@ -27,7 +27,7 @@ const GPX_HEADER = `\
|
|
|
27
27
|
/**
|
|
28
28
|
* Loader for GPX (GPS exchange format)
|
|
29
29
|
*/
|
|
30
|
-
export const GPXLoader: LoaderWithParser = {
|
|
30
|
+
export const GPXLoader: LoaderWithParser<any, never, GPXLoaderOptions> = {
|
|
31
31
|
name: 'GPX (GPS exchange format)',
|
|
32
32
|
id: 'gpx',
|
|
33
33
|
module: 'kml',
|
|
@@ -59,10 +59,11 @@ function parseTextSync(text: string, options?: GPXLoaderOptions) {
|
|
|
59
59
|
};
|
|
60
60
|
return table;
|
|
61
61
|
}
|
|
62
|
-
case 'geojson-
|
|
63
|
-
const table:
|
|
64
|
-
shape: 'geojson-
|
|
65
|
-
|
|
62
|
+
case 'geojson-table': {
|
|
63
|
+
const table: GeoJSONTable = {
|
|
64
|
+
shape: 'geojson-table',
|
|
65
|
+
type: 'FeatureCollection',
|
|
66
|
+
features: geojson.features
|
|
66
67
|
};
|
|
67
68
|
return table;
|
|
68
69
|
}
|
package/src/kml-loader.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';
|
|
2
2
|
// import {geojsonToBinary} from '@loaders.gl/gis';
|
|
3
|
-
// import {
|
|
3
|
+
// import {GeoJSONTable} from '@loaders.gl/schema';
|
|
4
4
|
import {FeatureCollection, ObjectRowTable} from '@loaders.gl/schema';
|
|
5
5
|
import {kml} from '@tmcw/togeojson';
|
|
6
6
|
import {DOMParser} from '@xmldom/xmldom';
|
|
@@ -11,13 +11,13 @@ const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';
|
|
|
11
11
|
|
|
12
12
|
export type KMLLoaderOptions = LoaderOptions & {
|
|
13
13
|
kml?: {
|
|
14
|
-
shape?: 'object-row-table' | 'geojson-
|
|
14
|
+
shape?: 'object-row-table' | 'geojson-table';
|
|
15
15
|
/** @deprecated. Use options.kml.shape */
|
|
16
|
-
type?: 'object-row-table' | 'geojson-
|
|
16
|
+
type?: 'object-row-table' | 'geojson-table';
|
|
17
17
|
};
|
|
18
18
|
gis?: {
|
|
19
19
|
/** @deprecated. Use options.kml.shape */
|
|
20
|
-
format?: 'object-row-table' | 'geojson-
|
|
20
|
+
format?: 'object-row-table' | 'geojson-table' | 'geojson' | 'binary' | 'raw';
|
|
21
21
|
};
|
|
22
22
|
};
|
|
23
23
|
|
|
@@ -53,9 +53,9 @@ function parseTextSync(text: string, options?: KMLLoaderOptions): ObjectRowTable
|
|
|
53
53
|
// backwards compatibility
|
|
54
54
|
const shape = options?.gis?.format || options?.kml?.type || options?.kml?.shape;
|
|
55
55
|
switch (shape) {
|
|
56
|
-
// case 'geojson-
|
|
57
|
-
// const table:
|
|
58
|
-
// shape: 'geojson-
|
|
56
|
+
// case 'geojson-table': {
|
|
57
|
+
// const table: GeoJSONTable = {
|
|
58
|
+
// shape: 'geojson-table',
|
|
59
59
|
// data: geojson.features
|
|
60
60
|
// };
|
|
61
61
|
// return table;
|
package/src/tcx-loader.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';
|
|
2
2
|
import {geojsonToBinary} from '@loaders.gl/gis';
|
|
3
|
-
import type {
|
|
3
|
+
import type {GeoJSONTable, FeatureCollection, ObjectRowTable} from '@loaders.gl/schema';
|
|
4
4
|
import {tcx} from '@tmcw/togeojson';
|
|
5
5
|
import {DOMParser} from '@xmldom/xmldom';
|
|
6
6
|
|
|
@@ -10,13 +10,13 @@ const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';
|
|
|
10
10
|
|
|
11
11
|
export type TCXLoaderOptions = LoaderOptions & {
|
|
12
12
|
tcx?: {
|
|
13
|
-
shape?: 'object-row-table' | 'geojson-
|
|
13
|
+
shape?: 'object-row-table' | 'geojson-table' | 'geojson' | 'binary' | 'raw';
|
|
14
14
|
/** @deprecated. Use options.tcx.shape */
|
|
15
|
-
type?: 'object-row-table' | 'geojson-
|
|
15
|
+
type?: 'object-row-table' | 'geojson-table' | 'geojson' | 'binary' | 'raw';
|
|
16
16
|
};
|
|
17
17
|
gis?: {
|
|
18
18
|
/** @deprecated. Use options.tcx.shape */
|
|
19
|
-
format?: 'object-row-table' | 'geojson-
|
|
19
|
+
format?: 'object-row-table' | 'geojson-table' | 'geojson' | 'binary' | 'raw';
|
|
20
20
|
};
|
|
21
21
|
};
|
|
22
22
|
|
|
@@ -27,7 +27,7 @@ const TCX_HEADER = `\
|
|
|
27
27
|
/**
|
|
28
28
|
* Loader for TCX (Training Center XML) - Garmin GPS track format
|
|
29
29
|
*/
|
|
30
|
-
export const TCXLoader: LoaderWithParser = {
|
|
30
|
+
export const TCXLoader: LoaderWithParser<any, never, TCXLoaderOptions> = {
|
|
31
31
|
name: 'TCX (Training Center XML)',
|
|
32
32
|
id: 'tcx',
|
|
33
33
|
module: 'kml',
|
|
@@ -60,10 +60,11 @@ function parseTextSync(text: string, options?: TCXLoaderOptions) {
|
|
|
60
60
|
};
|
|
61
61
|
return table;
|
|
62
62
|
}
|
|
63
|
-
case 'geojson-
|
|
64
|
-
const table:
|
|
65
|
-
shape: 'geojson-
|
|
66
|
-
|
|
63
|
+
case 'geojson-table': {
|
|
64
|
+
const table: GeoJSONTable = {
|
|
65
|
+
shape: 'geojson-table',
|
|
66
|
+
type: 'FeatureCollection',
|
|
67
|
+
features: geojson.features
|
|
67
68
|
};
|
|
68
69
|
return table;
|
|
69
70
|
}
|
package/dist/bundle.js
DELETED
package/dist/gpx-loader.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GPXLoader = void 0;
|
|
4
|
-
const gis_1 = require("@loaders.gl/gis");
|
|
5
|
-
const togeojson_1 = require("@tmcw/togeojson");
|
|
6
|
-
const xmldom_1 = require("@xmldom/xmldom");
|
|
7
|
-
// __VERSION__ is injected by babel-plugin-version-inline
|
|
8
|
-
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
9
|
-
const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';
|
|
10
|
-
const GPX_HEADER = `\
|
|
11
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
12
|
-
<gpx`;
|
|
13
|
-
/**
|
|
14
|
-
* Loader for GPX (GPS exchange format)
|
|
15
|
-
*/
|
|
16
|
-
exports.GPXLoader = {
|
|
17
|
-
name: 'GPX (GPS exchange format)',
|
|
18
|
-
id: 'gpx',
|
|
19
|
-
module: 'kml',
|
|
20
|
-
version: VERSION,
|
|
21
|
-
extensions: ['gpx'],
|
|
22
|
-
mimeTypes: ['application/gpx+xml'],
|
|
23
|
-
text: true,
|
|
24
|
-
tests: [GPX_HEADER],
|
|
25
|
-
parse: async (arrayBuffer, options) => parseTextSync(new TextDecoder().decode(arrayBuffer), options),
|
|
26
|
-
parseTextSync,
|
|
27
|
-
options: {
|
|
28
|
-
gpx: {},
|
|
29
|
-
gis: {}
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
function parseTextSync(text, options) {
|
|
33
|
-
const doc = new xmldom_1.DOMParser().parseFromString(text, 'text/xml');
|
|
34
|
-
const geojson = (0, togeojson_1.gpx)(doc);
|
|
35
|
-
const shape = options?.gis?.format || options?.gpx?.type || options?.gpx?.shape;
|
|
36
|
-
switch (shape) {
|
|
37
|
-
case 'object-row-table': {
|
|
38
|
-
const table = {
|
|
39
|
-
shape: 'object-row-table',
|
|
40
|
-
data: geojson.features
|
|
41
|
-
};
|
|
42
|
-
return table;
|
|
43
|
-
}
|
|
44
|
-
case 'geojson-row-table': {
|
|
45
|
-
const table = {
|
|
46
|
-
shape: 'geojson-row-table',
|
|
47
|
-
data: geojson.features
|
|
48
|
-
};
|
|
49
|
-
return table;
|
|
50
|
-
}
|
|
51
|
-
case 'geojson':
|
|
52
|
-
return geojson;
|
|
53
|
-
case 'binary':
|
|
54
|
-
return (0, gis_1.geojsonToBinary)(geojson.features);
|
|
55
|
-
case 'raw':
|
|
56
|
-
return doc;
|
|
57
|
-
default:
|
|
58
|
-
// Default to geojson for backwards compatibility
|
|
59
|
-
return geojson;
|
|
60
|
-
}
|
|
61
|
-
}
|
package/dist/index.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// POLYFILL: DOMParser
|
|
3
|
-
// - Node: Yes
|
|
4
|
-
// - Browser: No
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.TCXLoader = exports.KMLLoader = exports.GPXLoader = void 0;
|
|
7
|
-
var gpx_loader_1 = require("./gpx-loader");
|
|
8
|
-
Object.defineProperty(exports, "GPXLoader", { enumerable: true, get: function () { return gpx_loader_1.GPXLoader; } });
|
|
9
|
-
var kml_loader_1 = require("./kml-loader");
|
|
10
|
-
Object.defineProperty(exports, "KMLLoader", { enumerable: true, get: function () { return kml_loader_1.KMLLoader; } });
|
|
11
|
-
var tcx_loader_1 = require("./tcx-loader");
|
|
12
|
-
Object.defineProperty(exports, "TCXLoader", { enumerable: true, get: function () { return tcx_loader_1.TCXLoader; } });
|
package/dist/kml-loader.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.KMLLoader = void 0;
|
|
4
|
-
const togeojson_1 = require("@tmcw/togeojson");
|
|
5
|
-
const xmldom_1 = require("@xmldom/xmldom");
|
|
6
|
-
// __VERSION__ is injected by babel-plugin-version-inline
|
|
7
|
-
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
8
|
-
const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';
|
|
9
|
-
const KML_HEADER = `\
|
|
10
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
11
|
-
<kml xmlns="http://www.opengis.net/kml/2.2">`;
|
|
12
|
-
/**
|
|
13
|
-
* Loader for KML (Keyhole Markup Language)
|
|
14
|
-
*/
|
|
15
|
-
exports.KMLLoader = {
|
|
16
|
-
name: 'KML (Keyhole Markup Language)',
|
|
17
|
-
id: 'kml',
|
|
18
|
-
module: 'kml',
|
|
19
|
-
version: VERSION,
|
|
20
|
-
extensions: ['kml'],
|
|
21
|
-
mimeTypes: ['application/vnd.google-earth.kml+xml'],
|
|
22
|
-
text: true,
|
|
23
|
-
tests: [KML_HEADER],
|
|
24
|
-
parse: async (arrayBuffer, options) => parseTextSync(new TextDecoder().decode(arrayBuffer), options),
|
|
25
|
-
parseTextSync,
|
|
26
|
-
options: {
|
|
27
|
-
kml: {},
|
|
28
|
-
gis: {}
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
function parseTextSync(text, options) {
|
|
32
|
-
const doc = new xmldom_1.DOMParser().parseFromString(text, 'text/xml');
|
|
33
|
-
const geojson = (0, togeojson_1.kml)(doc);
|
|
34
|
-
// backwards compatibility
|
|
35
|
-
const shape = options?.gis?.format || options?.kml?.type || options?.kml?.shape;
|
|
36
|
-
switch (shape) {
|
|
37
|
-
// case 'geojson-row-table': {
|
|
38
|
-
// const table: GeoJSONRowTable = {
|
|
39
|
-
// shape: 'geojson-row-table',
|
|
40
|
-
// data: geojson.features
|
|
41
|
-
// };
|
|
42
|
-
// return table;
|
|
43
|
-
// }
|
|
44
|
-
// case 'geojson':
|
|
45
|
-
// return geojson;
|
|
46
|
-
// case 'binary':
|
|
47
|
-
// return geojsonToBinary(geojson.features);
|
|
48
|
-
// case 'raw':
|
|
49
|
-
// return doc;
|
|
50
|
-
case 'object-row-table':
|
|
51
|
-
default:
|
|
52
|
-
const table = {
|
|
53
|
-
shape: 'object-row-table',
|
|
54
|
-
data: geojson.features
|
|
55
|
-
};
|
|
56
|
-
return table;
|
|
57
|
-
}
|
|
58
|
-
}
|
package/dist/tcx-loader.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TCXLoader = void 0;
|
|
4
|
-
const gis_1 = require("@loaders.gl/gis");
|
|
5
|
-
const togeojson_1 = require("@tmcw/togeojson");
|
|
6
|
-
const xmldom_1 = require("@xmldom/xmldom");
|
|
7
|
-
// __VERSION__ is injected by babel-plugin-version-inline
|
|
8
|
-
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
9
|
-
const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';
|
|
10
|
-
const TCX_HEADER = `\
|
|
11
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
12
|
-
<TrainingCenterDatabase`;
|
|
13
|
-
/**
|
|
14
|
-
* Loader for TCX (Training Center XML) - Garmin GPS track format
|
|
15
|
-
*/
|
|
16
|
-
exports.TCXLoader = {
|
|
17
|
-
name: 'TCX (Training Center XML)',
|
|
18
|
-
id: 'tcx',
|
|
19
|
-
module: 'kml',
|
|
20
|
-
version: VERSION,
|
|
21
|
-
extensions: ['tcx'],
|
|
22
|
-
mimeTypes: ['application/vnd.garmin.tcx+xml'],
|
|
23
|
-
text: true,
|
|
24
|
-
tests: [TCX_HEADER],
|
|
25
|
-
parse: async (arrayBuffer, options) => parseTextSync(new TextDecoder().decode(arrayBuffer), options),
|
|
26
|
-
parseTextSync,
|
|
27
|
-
options: {
|
|
28
|
-
tcx: {},
|
|
29
|
-
gis: {}
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
function parseTextSync(text, options) {
|
|
33
|
-
const doc = new xmldom_1.DOMParser().parseFromString(text, 'text/xml');
|
|
34
|
-
const geojson = (0, togeojson_1.tcx)(doc);
|
|
35
|
-
// backwards compatibility
|
|
36
|
-
const shape = options?.gis?.format || options?.tcx?.type || options?.tcx?.shape;
|
|
37
|
-
switch (shape) {
|
|
38
|
-
case 'object-row-table': {
|
|
39
|
-
const table = {
|
|
40
|
-
shape: 'object-row-table',
|
|
41
|
-
data: geojson.features
|
|
42
|
-
};
|
|
43
|
-
return table;
|
|
44
|
-
}
|
|
45
|
-
case 'geojson-row-table': {
|
|
46
|
-
const table = {
|
|
47
|
-
shape: 'geojson-row-table',
|
|
48
|
-
data: geojson.features
|
|
49
|
-
};
|
|
50
|
-
return table;
|
|
51
|
-
}
|
|
52
|
-
case 'geojson':
|
|
53
|
-
return geojson;
|
|
54
|
-
case 'binary':
|
|
55
|
-
return (0, gis_1.geojsonToBinary)(geojson.features);
|
|
56
|
-
case 'raw':
|
|
57
|
-
return doc;
|
|
58
|
-
default:
|
|
59
|
-
// Default to geojson for backwards compatibility
|
|
60
|
-
return geojson;
|
|
61
|
-
}
|
|
62
|
-
}
|