@loaders.gl/kml 3.4.8 → 3.4.10
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 +17 -7
- package/dist/es5/gpx-loader.js +1 -1
- 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 +1 -1
- package/dist/es5/tcx-loader.js.map +1 -1
- package/dist/esm/gpx-loader.js +1 -1
- 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 +1 -1
- package/dist/esm/tcx-loader.js.map +1 -1
- package/package.json +5 -5
package/dist/dist.min.js
CHANGED
|
@@ -596,7 +596,8 @@
|
|
|
596
596
|
...geometryInfo
|
|
597
597
|
}, {
|
|
598
598
|
numericPropKeys: options && options.numericPropKeys || numericPropKeys,
|
|
599
|
-
PositionDataType: options ? options.PositionDataType : Float32Array
|
|
599
|
+
PositionDataType: options ? options.PositionDataType : Float32Array,
|
|
600
|
+
triangulate: options ? options.triangulate : true
|
|
600
601
|
});
|
|
601
602
|
}
|
|
602
603
|
function extractNumericPropTypes(features) {
|
|
@@ -625,7 +626,7 @@
|
|
|
625
626
|
propArrayTypes,
|
|
626
627
|
coordLength
|
|
627
628
|
} = geometryInfo;
|
|
628
|
-
const { numericPropKeys = [], PositionDataType = Float32Array } = options;
|
|
629
|
+
const { numericPropKeys = [], PositionDataType = Float32Array, triangulate = true } = options;
|
|
629
630
|
const hasGlobalId = features[0] && "id" in features[0];
|
|
630
631
|
const GlobalFeatureIdsDataType = features.length > 65535 ? Uint32Array : Uint16Array;
|
|
631
632
|
const points = {
|
|
@@ -652,13 +653,15 @@
|
|
|
652
653
|
polygonIndices: polygonPositionsCount > 65535 ? new Uint32Array(polygonObjectsCount + 1) : new Uint16Array(polygonObjectsCount + 1),
|
|
653
654
|
primitivePolygonIndices: polygonPositionsCount > 65535 ? new Uint32Array(polygonRingsCount + 1) : new Uint16Array(polygonRingsCount + 1),
|
|
654
655
|
positions: new PositionDataType(polygonPositionsCount * coordLength),
|
|
655
|
-
triangles: [],
|
|
656
656
|
globalFeatureIds: new GlobalFeatureIdsDataType(polygonPositionsCount),
|
|
657
657
|
featureIds: polygonFeaturesCount > 65535 ? new Uint32Array(polygonPositionsCount) : new Uint16Array(polygonPositionsCount),
|
|
658
658
|
numericProps: {},
|
|
659
659
|
properties: [],
|
|
660
660
|
fields: []
|
|
661
661
|
};
|
|
662
|
+
if (triangulate) {
|
|
663
|
+
polygons.triangles = [];
|
|
664
|
+
}
|
|
662
665
|
for (const object of [points, lines, polygons]) {
|
|
663
666
|
for (const propName of numericPropKeys) {
|
|
664
667
|
const T = propArrayTypes[propName];
|
|
@@ -763,6 +766,9 @@
|
|
|
763
766
|
endPosition,
|
|
764
767
|
coordLength
|
|
765
768
|
}) {
|
|
769
|
+
if (!polygons.triangles) {
|
|
770
|
+
return;
|
|
771
|
+
}
|
|
766
772
|
const start = startPosition * coordLength;
|
|
767
773
|
const end = endPosition * coordLength;
|
|
768
774
|
const polygonPositions = polygons.positions.subarray(start, end);
|
|
@@ -781,7 +787,7 @@
|
|
|
781
787
|
return returnObj;
|
|
782
788
|
}
|
|
783
789
|
function makeAccessorObjects(points, lines, polygons, coordLength) {
|
|
784
|
-
|
|
790
|
+
const binaryFeatures = {
|
|
785
791
|
points: {
|
|
786
792
|
...points,
|
|
787
793
|
positions: { value: points.positions, size: coordLength },
|
|
@@ -802,12 +808,15 @@
|
|
|
802
808
|
positions: { value: polygons.positions, size: coordLength },
|
|
803
809
|
polygonIndices: { value: polygons.polygonIndices, size: 1 },
|
|
804
810
|
primitivePolygonIndices: { value: polygons.primitivePolygonIndices, size: 1 },
|
|
805
|
-
triangles: { value: new Uint32Array(polygons.triangles), size: 1 },
|
|
806
811
|
globalFeatureIds: { value: polygons.globalFeatureIds, size: 1 },
|
|
807
812
|
featureIds: { value: polygons.featureIds, size: 1 },
|
|
808
813
|
numericProps: wrapProps(polygons.numericProps, 1)
|
|
809
814
|
}
|
|
810
815
|
};
|
|
816
|
+
if (polygons.triangles) {
|
|
817
|
+
binaryFeatures.polygons.triangles = { value: new Uint32Array(polygons.triangles), size: 1 };
|
|
818
|
+
}
|
|
819
|
+
return binaryFeatures;
|
|
811
820
|
}
|
|
812
821
|
function fillNumericProperties(object, properties, index, length) {
|
|
813
822
|
for (const numericPropName in object.numericProps) {
|
|
@@ -1016,14 +1025,15 @@
|
|
|
1016
1025
|
});
|
|
1017
1026
|
|
|
1018
1027
|
// ../gis/src/lib/geojson-to-binary.ts
|
|
1019
|
-
function geojsonToBinary(features, options = { fixRingWinding: true }) {
|
|
1028
|
+
function geojsonToBinary(features, options = { fixRingWinding: true, triangulate: true }) {
|
|
1020
1029
|
const geometryInfo = extractGeometryInfo(features);
|
|
1021
1030
|
const coordLength = geometryInfo.coordLength;
|
|
1022
1031
|
const { fixRingWinding } = options;
|
|
1023
1032
|
const flatFeatures = geojsonToFlatGeojson(features, { coordLength, fixRingWinding });
|
|
1024
1033
|
return flatGeojsonToBinary(flatFeatures, geometryInfo, {
|
|
1025
1034
|
numericPropKeys: options.numericPropKeys,
|
|
1026
|
-
PositionDataType: options.PositionDataType || Float32Array
|
|
1035
|
+
PositionDataType: options.PositionDataType || Float32Array,
|
|
1036
|
+
triangulate: options.triangulate
|
|
1027
1037
|
});
|
|
1028
1038
|
}
|
|
1029
1039
|
var init_geojson_to_binary = __esm({
|
package/dist/es5/gpx-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 _gis = require("@loaders.gl/gis");
|
|
11
11
|
var _togeojson = require("@tmcw/togeojson");
|
|
12
|
-
var VERSION = typeof "3.4.
|
|
12
|
+
var VERSION = typeof "3.4.10" !== 'undefined' ? "3.4.10" : 'latest';
|
|
13
13
|
var GPX_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<gpx";
|
|
14
14
|
var GPXLoader = {
|
|
15
15
|
name: 'GPX (GPS exchange format)',
|
|
@@ -1 +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,
|
|
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,eAAkB,KAAK,WAAW,cAAiB,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,CAAC;EACnBC,SAAS,EAAE,CAAC,qBAAqB,CAAC;EAClCC,IAAI,EAAE,IAAI;EACVC,KAAK,EAAE,CAACT,UAAU,CAAC;EACnBU,KAAK;IAAA,IAAAC,MAAA,OAAAC,kBAAA,CAAAC,OAAA,EAAAC,YAAA,CAAAD,OAAA,CAAAE,IAAA,CAAE,SAAAC,QAAOC,WAAW,EAAEC,OAA0B;MAAA,OAAAJ,YAAA,CAAAD,OAAA,CAAAM,IAAA,UAAAC,SAAAC,QAAA;QAAA,kBAAAA,QAAA,CAAAC,IAAA,GAAAD,QAAA,CAAAE,IAAA;UAAA;YAAA,OAAAF,QAAA,CAAAG,MAAA,WACnDC,aAAa,CAAC,IAAIC,WAAW,CAAC,CAAC,CAACC,MAAM,CAACV,WAAW,CAAC,EAAEC,OAAO,CAAC;UAAA;UAAA;YAAA,OAAAG,QAAA,CAAAO,IAAA;QAAA;MAAA,GAAAZ,OAAA;IAAA;IAAA,SAAAN,MAAAmB,EAAA,EAAAC,GAAA;MAAA,OAAAnB,MAAA,CAAAoB,KAAA,OAAAC,SAAA;IAAA;IAAA,OAAAtB,KAAA;EAAA;EAC/De,aAAa,EAAbA,aAAa;EACbP,OAAO,EAAE;IACPe,GAAG,EAAE,CAAC,CAAC;IACPC,GAAG,EAAE,CAAC;EACR;AACF,CAAC;AAACC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,mBAAA"}
|
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 _gis = require("@loaders.gl/gis");
|
|
11
11
|
var _togeojson = require("@tmcw/togeojson");
|
|
12
|
-
var VERSION = typeof "3.4.
|
|
12
|
+
var VERSION = typeof "3.4.10" !== 'undefined' ? "3.4.10" : '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":["_gis","require","_togeojson","VERSION","KML_HEADER","KMLLoader","name","id","module","version","extensions","mimeTypes","text","tests","parse","_parse","_asyncToGenerator2","default","_regenerator","mark","_callee","arrayBuffer","options","wrap","_callee$","_context","prev","next","abrupt","parseTextSync","TextDecoder","decode","stop","_x","_x2","apply","arguments","kml","gis","exports","_options$gis","_options$kml","_options$kml2","doc","DOMParser","parseFromString","geojson","shape","format","type","table","data","features","geojsonToBinary","_typecheckKMLLoader"],"sources":["../../src/kml-loader.ts"],"sourcesContent":["import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport {geojsonToBinary} from '@loaders.gl/gis';\nimport {kml} from '@tmcw/togeojson';\nimport {GeoJSONRowTable, FeatureCollection, ObjectRowTable} from '@loaders.gl/schema';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type KMLLoaderOptions = LoaderOptions & {\n kml?: {\n shape?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';\n /** @deprecated. Use options.kml.shape */\n type?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';\n };\n gis?: {\n /** @deprecated. Use options.kml.shape */\n format?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';\n };\n};\n\nconst KML_HEADER = `\\\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<kml xmlns=\"http://www.opengis.net/kml/2.2\">`;\n\n/**\n * Loader for KML (Keyhole Markup Language)\n */\nexport const KMLLoader = {\n name: 'KML (Keyhole Markup Language)',\n id: 'kml',\n module: 'kml',\n version: VERSION,\n extensions: ['kml'],\n mimeTypes: ['application/vnd.google-earth.kml+xml'],\n text: true,\n tests: [KML_HEADER],\n parse: async (arrayBuffer, options?: KMLLoaderOptions) =>\n parseTextSync(new TextDecoder().decode(arrayBuffer), options),\n parseTextSync,\n options: {\n kml: {},\n gis: {}\n }\n};\n\nfunction parseTextSync(text: string, options?: KMLLoaderOptions) {\n const doc = new DOMParser().parseFromString(text, 'text/xml');\n const geojson: FeatureCollection = kml(doc);\n\n // backwards compatibility\n const shape = options?.gis?.format || options?.kml?.type || options?.kml?.shape;\n switch (shape) {\n case 'object-row-table': {\n const table: ObjectRowTable = {\n shape: 'object-row-table',\n data: geojson.features\n };\n return table;\n }\n case 'geojson-row-table': {\n const table: GeoJSONRowTable = {\n shape: 'geojson-row-table',\n data: geojson.features\n };\n return table;\n }\n case 'geojson':\n return geojson;\n case 'binary':\n return geojsonToBinary(geojson.features);\n case 'raw':\n return doc;\n default:\n // Default to geojson for backwards compatibility\n return geojson;\n }\n}\n\nexport const _typecheckKMLLoader: LoaderWithParser = KMLLoader;\n"],"mappings":";;;;;;;;;AACA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAKA,IAAME,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"kml-loader.js","names":["_gis","require","_togeojson","VERSION","KML_HEADER","KMLLoader","name","id","module","version","extensions","mimeTypes","text","tests","parse","_parse","_asyncToGenerator2","default","_regenerator","mark","_callee","arrayBuffer","options","wrap","_callee$","_context","prev","next","abrupt","parseTextSync","TextDecoder","decode","stop","_x","_x2","apply","arguments","kml","gis","exports","_options$gis","_options$kml","_options$kml2","doc","DOMParser","parseFromString","geojson","shape","format","type","table","data","features","geojsonToBinary","_typecheckKMLLoader"],"sources":["../../src/kml-loader.ts"],"sourcesContent":["import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport {geojsonToBinary} from '@loaders.gl/gis';\nimport {kml} from '@tmcw/togeojson';\nimport {GeoJSONRowTable, FeatureCollection, ObjectRowTable} from '@loaders.gl/schema';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type KMLLoaderOptions = LoaderOptions & {\n kml?: {\n shape?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';\n /** @deprecated. Use options.kml.shape */\n type?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';\n };\n gis?: {\n /** @deprecated. Use options.kml.shape */\n format?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';\n };\n};\n\nconst KML_HEADER = `\\\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<kml xmlns=\"http://www.opengis.net/kml/2.2\">`;\n\n/**\n * Loader for KML (Keyhole Markup Language)\n */\nexport const KMLLoader = {\n name: 'KML (Keyhole Markup Language)',\n id: 'kml',\n module: 'kml',\n version: VERSION,\n extensions: ['kml'],\n mimeTypes: ['application/vnd.google-earth.kml+xml'],\n text: true,\n tests: [KML_HEADER],\n parse: async (arrayBuffer, options?: KMLLoaderOptions) =>\n parseTextSync(new TextDecoder().decode(arrayBuffer), options),\n parseTextSync,\n options: {\n kml: {},\n gis: {}\n }\n};\n\nfunction parseTextSync(text: string, options?: KMLLoaderOptions) {\n const doc = new DOMParser().parseFromString(text, 'text/xml');\n const geojson: FeatureCollection = kml(doc);\n\n // backwards compatibility\n const shape = options?.gis?.format || options?.kml?.type || options?.kml?.shape;\n switch (shape) {\n case 'object-row-table': {\n const table: ObjectRowTable = {\n shape: 'object-row-table',\n data: geojson.features\n };\n return table;\n }\n case 'geojson-row-table': {\n const table: GeoJSONRowTable = {\n shape: 'geojson-row-table',\n data: geojson.features\n };\n return table;\n }\n case 'geojson':\n return geojson;\n case 'binary':\n return geojsonToBinary(geojson.features);\n case 'raw':\n return doc;\n default:\n // Default to geojson for backwards compatibility\n return geojson;\n }\n}\n\nexport const _typecheckKMLLoader: LoaderWithParser = KMLLoader;\n"],"mappings":";;;;;;;;;AACA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAKA,IAAME,OAAO,GAAG,eAAkB,KAAK,WAAW,cAAiB,QAAQ;AAc3E,IAAMC,UAAU,+FAE6B;AAKtC,IAAMC,SAAS,GAAG;EACvBC,IAAI,EAAE,+BAA+B;EACrCC,EAAE,EAAE,KAAK;EACTC,MAAM,EAAE,KAAK;EACbC,OAAO,EAAEN,OAAO;EAChBO,UAAU,EAAE,CAAC,KAAK,CAAC;EACnBC,SAAS,EAAE,CAAC,sCAAsC,CAAC;EACnDC,IAAI,EAAE,IAAI;EACVC,KAAK,EAAE,CAACT,UAAU,CAAC;EACnBU,KAAK;IAAA,IAAAC,MAAA,OAAAC,kBAAA,CAAAC,OAAA,EAAAC,YAAA,CAAAD,OAAA,CAAAE,IAAA,CAAE,SAAAC,QAAOC,WAAW,EAAEC,OAA0B;MAAA,OAAAJ,YAAA,CAAAD,OAAA,CAAAM,IAAA,UAAAC,SAAAC,QAAA;QAAA,kBAAAA,QAAA,CAAAC,IAAA,GAAAD,QAAA,CAAAE,IAAA;UAAA;YAAA,OAAAF,QAAA,CAAAG,MAAA,WACnDC,aAAa,CAAC,IAAIC,WAAW,CAAC,CAAC,CAAC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B,GAAG;UAC7BH,KAAK,EAAE,mBAAmB;UAC1BI,IAAI,EAAEL,OAAO,CAACM;QAChB,CAAC;QACD,OAAOF,MAAK;MACd;IACA,KAAK,SAAS;MACZ,OAAOJ,OAAO;IAChB,KAAK,QAAQ;MACX,OAAO,IAAAO,oBAAe,EAACP,OAAO,CAACM,QAAQ,CAAC;IAC1C,KAAK,KAAK;MACR,OAAOT,GAAG;IACZ;MAEE,OAAOG,OAAO;EAClB;AACF;AAEO,IAAMQ,mBAAqC,GAAGjD,SAAS;AAACkC,OAAA,CAAAe,mBAAA,GAAAA,mBAAA"}
|
package/dist/es5/tcx-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 _gis = require("@loaders.gl/gis");
|
|
11
11
|
var _togeojson = require("@tmcw/togeojson");
|
|
12
|
-
var VERSION = typeof "3.4.
|
|
12
|
+
var VERSION = typeof "3.4.10" !== 'undefined' ? "3.4.10" : 'latest';
|
|
13
13
|
var TCX_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<TrainingCenterDatabase";
|
|
14
14
|
var TCXLoader = {
|
|
15
15
|
name: 'TCX (Training Center XML)',
|
|
@@ -1 +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,
|
|
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,eAAkB,KAAK,WAAW,cAAiB,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,U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cAAAI,YAAA,uBAAZA,YAAA,CAAcQ,IAAI,MAAI3B,OAAO,aAAPA,OAAO,wBAAAoB,aAAA,GAAPpB,OAAO,CAAEe,GAAG,cAAAK,aAAA,uBAAZA,aAAA,CAAcK,KAAK;EAE/E,QAAQA,KAAK;IACX,KAAK,kBAAkB;MAAE;QACvB,IAAMG,KAAqB,GAAG;UAC5BH,KAAK,EAAE,kBAAkB;UACzBI,IAAI,EAAEL,OAAO,CAACM;QAChB,CAAC;QACD,OAAOF,KAAK;MACd;IACA,KAAK,mBAAmB;MAAE;QACxB,IAAMA,MAAsB,GAAG;UAC7BH,KAAK,EAAE,mBAAmB;UAC1BI,IAAI,EAAEL,OAAO,CAACM;QAChB,CAAC;QACD,OAAOF,MAAK;MACd;IACA,KAAK,SAAS;MACZ,OAAOJ,OAAO;IAChB,KAAK,QAAQ;MACX,OAAO,IAAAO,oBAAe,EAACP,OAAO,CAACM,QAAQ,CAAC;IAC1C,KAAK,KAAK;MACR,OAAOT,GAAG;IACZ;MAEE,OAAOG,OAAO;EAClB;AACF;AAEO,IAAMQ,mBAAqC,GAAGjD,SAAS;AAACkC,OAAA,CAAAe,mBAAA,GAAAA,mBAAA"}
|
package/dist/esm/gpx-loader.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { geojsonToBinary } from '@loaders.gl/gis';
|
|
2
2
|
import { gpx } from '@tmcw/togeojson';
|
|
3
|
-
const VERSION = typeof "3.4.
|
|
3
|
+
const VERSION = typeof "3.4.10" !== 'undefined' ? "3.4.10" : 'latest';
|
|
4
4
|
const GPX_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<gpx";
|
|
5
5
|
export const GPXLoader = {
|
|
6
6
|
name: 'GPX (GPS exchange format)',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gpx-loader.js","names":["geojsonToBinary","gpx","VERSION","GPX_HEADER","GPXLoader","name","id","module","version","extensions","mimeTypes","text","tests","parse","arrayBuffer","options","parseTextSync","TextDecoder","decode","gis","_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,
|
|
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,eAAkB,KAAK,WAAW,cAAiB,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,MA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B,OAAO,CAACM,QAAQ,CAAC;IAC1C,KAAK,KAAK;MACR,OAAOT,GAAG;IACZ;MAEE,OAAOG,OAAO;EAClB;AACF;AAEA,OAAO,MAAMO,mBAAqC,GAAG7B,SAAS"}
|
package/dist/esm/kml-loader.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { geojsonToBinary } from '@loaders.gl/gis';
|
|
2
2
|
import { kml } from '@tmcw/togeojson';
|
|
3
|
-
const VERSION = typeof "3.4.
|
|
3
|
+
const VERSION = typeof "3.4.10" !== 'undefined' ? "3.4.10" : '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":["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,iBAAiB;AAC/C,SAAQC,GAAG,QAAO,iBAAiB;AAKnC,MAAMC,OAAO,GAAG,
|
|
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,iBAAiB;AAC/C,SAAQC,GAAG,QAAO,iBAAiB;AAKnC,MAAMC,OAAO,GAAG,eAAkB,KAAK,WAAW,cAAiB,QAAQ;AAc3E,MAAMC,UAAU,+FAE6B;AAK7C,OAAO,MAAMC,SAAS,GAAG;EACvBC,IAAI,EAAE,+BAA+B;EACrCC,EAAE,EAAE,KAAK;EACTC,MAAM,EAAE,KAAK;EACbC,OAAO,EAAEN,OAAO;EAChBO,UAAU,EAAE,CAAC,KAAK,CAAC;EACnBC,SAAS,EAAE,CAAC,sCAAsC,CAAC;EACnDC,IAAI,EAAE,IAAI;EACVC,KAAK,EAAE,CAACT,UAAU,CAAC;EACnBU,KAAK,EAAE,MAAAA,CAAOC,WAAW,EAAEC,OAA0B,KACnDC,aAAa,CAAC,IAAIC,WAAW,CAAC,CAAC,CAACC,MAAM,CAACJ,WAAW,CAAC,EAAEC,OAAO,CAAC;EAC/DC,aAAa;EACbD,OAAO,EAAE;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;EAC/E,QAAQA,KAAK;IACX,KAAK,kBAAkB;MAAE;QACvB,MAAMG,KAAqB,GAAG;UAC5BH,KAAK,EAAE,kBAAkB;UACzBI,IAAI,EAAEL,OAAO,CAACM;QAChB,CAAC;QACD,OAAOF,KAAK;MACd;IACA,KAAK,mBAAmB;MAAE;QACxB,MAAMA,KAAsB,GAAG;UAC7BH,KAAK,EAAE,mBAAmB;UAC1BI,IAAI,EAAEL,OAAO,CAACM;QAChB,CAAC;QACD,OAAOF,KAAK;MACd;IACA,KAAK,SAAS;MACZ,OAAOJ,OAAO;IAChB,KAAK,QAAQ;MACX,OAAO1B,eAAe,CAAC0B,OAAO,CAACM,QAAQ,CAAC;IAC1C,KAAK,KAAK;MACR,OAAOT,GAAG;IACZ;MAEE,OAAOG,OAAO;EAClB;AACF;AAEA,OAAO,MAAMO,mBAAqC,GAAG7B,SAAS"}
|
package/dist/esm/tcx-loader.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { geojsonToBinary } from '@loaders.gl/gis';
|
|
2
2
|
import { tcx } from '@tmcw/togeojson';
|
|
3
|
-
const VERSION = typeof "3.4.
|
|
3
|
+
const VERSION = typeof "3.4.10" !== 'undefined' ? "3.4.10" : 'latest';
|
|
4
4
|
const TCX_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<TrainingCenterDatabase";
|
|
5
5
|
export const TCXLoader = {
|
|
6
6
|
name: 'TCX (Training Center XML)',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tcx-loader.js","names":["geojsonToBinary","tcx","VERSION","TCX_HEADER","TCXLoader","name","id","module","version","extensions","mimeTypes","text","tests","parse","arrayBuffer","options","parseTextSync","TextDecoder","decode","gis","_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,
|
|
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,eAAkB,KAAK,WAAW,cAAiB,QAAQ;AAc3E,MAAMC,UAAU,wEAEQ;AAKxB,OAAO,MAAMC,SAAS,GAAG;EACvBC,IAAI,EAAE,2BAA2B;EACjCC,E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,KAAK,mBAAmB;MAAE;QACxB,MAAMA,KAAsB,GAAG;UAC7BH,KAAK,EAAE,mBAAmB;UAC1BI,IAAI,EAAEL,OAAO,CAACM;QAChB,CAAC;QACD,OAAOF,KAAK;MACd;IACA,KAAK,SAAS;MACZ,OAAOJ,OAAO;IAChB,KAAK,QAAQ;MACX,OAAO1B,eAAe,CAAC0B,OAAO,CAACM,QAAQ,CAAC;IAC1C,KAAK,KAAK;MACR,OAAOT,GAAG;IACZ;MAEE,OAAOG,OAAO;EAClB;AACF;AAEA,OAAO,MAAMO,mBAAqC,GAAG7B,SAAS"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/kml",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.10",
|
|
4
4
|
"description": "Framework-independent loader for the KML format",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -32,10 +32,10 @@
|
|
|
32
32
|
"build-bundle": "esbuild src/bundle.ts --bundle --outfile=dist/dist.min.js"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@loaders.gl/gis": "3.4.
|
|
36
|
-
"@loaders.gl/loader-utils": "3.4.
|
|
37
|
-
"@loaders.gl/schema": "3.4.
|
|
35
|
+
"@loaders.gl/gis": "3.4.10",
|
|
36
|
+
"@loaders.gl/loader-utils": "3.4.10",
|
|
37
|
+
"@loaders.gl/schema": "3.4.10",
|
|
38
38
|
"@tmcw/togeojson": "^4.5.0"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "4568459c96eaf0480a50ab77cace355307f61f04"
|
|
41
41
|
}
|