@loaders.gl/kml 4.0.4 → 4.1.0-alpha.2
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.dev.js +4 -0
- package/dist/index.cjs +1 -0
- package/dist/tcx-loader.js +4 -0
- package/dist/tcx-loader.js.map +1 -1
- package/package.json +5 -5
- package/src/tcx-loader.ts +1 -0
package/dist/dist.dev.js
CHANGED
package/dist/index.cjs
CHANGED
package/dist/tcx-loader.js
CHANGED
package/dist/tcx-loader.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tcx-loader.js","names":["geojsonToBinary","tcx","DOMParser","VERSION","__VERSION__","TCX_HEADER","TCXLoader","name","id","module","version","extensions","mimeTypes","text","tests","parse","arrayBuffer","options","parseTextSync","TextDecoder","decode","shape","gis","doc","parseFromString","geojson","tcxOptions","table","data","features","type","Error"],"sources":["../src/tcx-loader.ts"],"sourcesContent":["// loaders.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nimport type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport {geojsonToBinary} from '@loaders.gl/gis';\nimport type {\n GeoJSONTable,\n FeatureCollection,\n ObjectRowTable,\n BinaryFeatureCollection\n} 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' | 'binary' | 'raw';\n };\n};\n\nconst TCX_HEADER = `\\\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<TrainingCenterDatabase`;\n\n/**\n * Loader for TCX (Training Center XML) - Garmin GPS track format\n */\nexport const TCXLoader: LoaderWithParser<\n ObjectRowTable | GeoJSONTable | BinaryFeatureCollection,\n never,\n TCXLoaderOptions\n> = {\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: {shape: 'geojson-table'},\n gis: {}\n }\n};\n\nfunction parseTextSync(\n text: string,\n options?: TCXLoaderOptions\n): ObjectRowTable | GeoJSONTable | BinaryFeatureCollection {\n const doc = new DOMParser().parseFromString(text, 'text/xml');\n const geojson: FeatureCollection = tcx(doc);\n\n const tcxOptions = {...TCXLoader.options.tcx, ...options?.tcx};\n\n switch (tcxOptions.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 'binary':\n return geojsonToBinary(geojson.features);\n\n default:\n throw new Error(tcxOptions.shape);\n }\n}\n"],"mappings":"AAIA,SAAQA,eAAe,QAAO,iBAAiB;AAO/C,SAAQC,GAAG,QAAO,iBAAiB;AACnC,SAAQC,SAAS,QAAO,gBAAgB;AAIxC,MAAMC,OAAO,GAAG,OAAOC,WAAW,KAAK,WAAW,GAAGA,WAAW,GAAG,QAAQ;AAQ3E,MAAMC,UAAU,GAAI;AACpB;AACA,wBAAwB;AAKxB,OAAO,MAAMC,SAIZ,GAAG;EACFC,IAAI,EAAE,2BAA2B;EACjCC,EAAE,EAAE,KAAK;EACTC,MAAM,EAAE,KAAK;EACbC,OAAO,EAAEP,OAAO;EAChBQ,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;IACPhB,GAAG,EAAE;MAACoB,KAAK,EAAE;IAAe,CAAC;IAC7BC,GAAG,EAAE,CAAC;EACR;AACF,CAAC;AAED,SAASJ,aAAaA,CACpBL,IAAY,EACZI,OAA0B,EAC+B;EACzD,MAAMM,GAAG,GAAG,IAAIrB,SAAS,CAAC,CAAC,CAACsB,eAAe,CAACX,IAAI,EAAE,UAAU,CAAC;EAC7D,MAAMY,OAA0B,GAAGxB,GAAG,CAACsB,GAAG,CAAC;EAE3C,MAAMG,UAAU,GAAG;IAAC,GAAGpB,SAAS,CAACW,OAAO,CAAChB,GAAG;IAAE,IAAGgB,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEhB,GAAG;EAAA,CAAC;EAE9D,QAAQyB,UAAU,CAACL,KAAK;IACtB,KAAK,kBAAkB;MAAE;QACvB,MAAMM,KAAqB,GAAG;UAC5BN,KAAK,EAAE,kBAAkB;UACzBO,IAAI,EAAEH,OAAO,CAACI;QAChB,CAAC;QACD,OAAOF,KAAK;MACd;IACA,KAAK,eAAe;MAAE;QACpB,MAAMA,KAAmB,GAAG;UAC1BN,KAAK,EAAE,eAAe;UACtBS,IAAI,EAAE,mBAAmB;
|
|
1
|
+
{"version":3,"file":"tcx-loader.js","names":["geojsonToBinary","tcx","DOMParser","VERSION","__VERSION__","TCX_HEADER","TCXLoader","name","id","module","version","extensions","mimeTypes","text","tests","parse","arrayBuffer","options","parseTextSync","TextDecoder","decode","shape","gis","doc","parseFromString","geojson","tcxOptions","table","data","features","type","schema","metadata","fields","Error"],"sources":["../src/tcx-loader.ts"],"sourcesContent":["// loaders.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nimport type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport {geojsonToBinary} from '@loaders.gl/gis';\nimport type {\n GeoJSONTable,\n FeatureCollection,\n ObjectRowTable,\n BinaryFeatureCollection\n} 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' | 'binary' | 'raw';\n };\n};\n\nconst TCX_HEADER = `\\\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<TrainingCenterDatabase`;\n\n/**\n * Loader for TCX (Training Center XML) - Garmin GPS track format\n */\nexport const TCXLoader: LoaderWithParser<\n ObjectRowTable | GeoJSONTable | BinaryFeatureCollection,\n never,\n TCXLoaderOptions\n> = {\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: {shape: 'geojson-table'},\n gis: {}\n }\n};\n\nfunction parseTextSync(\n text: string,\n options?: TCXLoaderOptions\n): ObjectRowTable | GeoJSONTable | BinaryFeatureCollection {\n const doc = new DOMParser().parseFromString(text, 'text/xml');\n const geojson: FeatureCollection = tcx(doc);\n\n const tcxOptions = {...TCXLoader.options.tcx, ...options?.tcx};\n\n switch (tcxOptions.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 schema: {metadata: {}, fields: []},\n features: geojson.features\n };\n return table;\n }\n case 'binary':\n return geojsonToBinary(geojson.features);\n\n default:\n throw new Error(tcxOptions.shape);\n }\n}\n"],"mappings":"AAIA,SAAQA,eAAe,QAAO,iBAAiB;AAO/C,SAAQC,GAAG,QAAO,iBAAiB;AACnC,SAAQC,SAAS,QAAO,gBAAgB;AAIxC,MAAMC,OAAO,GAAG,OAAOC,WAAW,KAAK,WAAW,GAAGA,WAAW,GAAG,QAAQ;AAQ3E,MAAMC,UAAU,GAAI;AACpB;AACA,wBAAwB;AAKxB,OAAO,MAAMC,SAIZ,GAAG;EACFC,IAAI,EAAE,2BAA2B;EACjCC,EAAE,EAAE,KAAK;EACTC,MAAM,EAAE,KAAK;EACbC,OAAO,EAAEP,OAAO;EAChBQ,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;IACPhB,GAAG,EAAE;MAACoB,KAAK,EAAE;IAAe,CAAC;IAC7BC,GAAG,EAAE,CAAC;EACR;AACF,CAAC;AAED,SAASJ,aAAaA,CACpBL,IAAY,EACZI,OAA0B,EAC+B;EACzD,MAAMM,GAAG,GAAG,IAAIrB,SAAS,CAAC,CAAC,CAACsB,eAAe,CAACX,IAAI,EAAE,UAAU,CAAC;EAC7D,MAAMY,OAA0B,GAAGxB,GAAG,CAACsB,GAAG,CAAC;EAE3C,MAAMG,UAAU,GAAG;IAAC,GAAGpB,SAAS,CAACW,OAAO,CAAChB,GAAG;IAAE,IAAGgB,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEhB,GAAG;EAAA,CAAC;EAE9D,QAAQyB,UAAU,CAACL,KAAK;IACtB,KAAK,kBAAkB;MAAE;QACvB,MAAMM,KAAqB,GAAG;UAC5BN,KAAK,EAAE,kBAAkB;UACzBO,IAAI,EAAEH,OAAO,CAACI;QAChB,CAAC;QACD,OAAOF,KAAK;MACd;IACA,KAAK,eAAe;MAAE;QACpB,MAAMA,KAAmB,GAAG;UAC1BN,KAAK,EAAE,eAAe;UACtBS,IAAI,EAAE,mBAAmB;UACzBC,MAAM,EAAE;YAACC,QAAQ,EAAE,CAAC,CAAC;YAAEC,MAAM,EAAE;UAAE,CAAC;UAClCJ,QAAQ,EAAEJ,OAAO,CAACI;QACpB,CAAC;QACD,OAAOF,KAAK;MACd;IACA,KAAK,QAAQ;MACX,OAAO3B,eAAe,CAACyB,OAAO,CAACI,QAAQ,CAAC;IAE1C;MACE,MAAM,IAAIK,KAAK,CAACR,UAAU,CAACL,KAAK,CAAC;EACrC;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/kml",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.1.0-alpha.2",
|
|
4
4
|
"description": "Framework-independent loader for the KML format",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -40,11 +40,11 @@
|
|
|
40
40
|
"build-bundle": "ocular-bundle ./src/index.ts"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@loaders.gl/gis": "4.0.
|
|
44
|
-
"@loaders.gl/loader-utils": "4.0.
|
|
45
|
-
"@loaders.gl/schema": "4.0.
|
|
43
|
+
"@loaders.gl/gis": "4.1.0-alpha.2",
|
|
44
|
+
"@loaders.gl/loader-utils": "4.1.0-alpha.2",
|
|
45
|
+
"@loaders.gl/schema": "4.1.0-alpha.2",
|
|
46
46
|
"@tmcw/togeojson": "^4.5.0",
|
|
47
47
|
"@xmldom/xmldom": "^0.7.13"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "a248382edd20e846c1ccb23c15d089fb9b368dbc"
|
|
50
50
|
}
|