@loaders.gl/kml 3.1.0-beta.5 → 3.1.0-beta.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bundle.js CHANGED
@@ -49,7 +49,7 @@
49
49
  let polygonRingsCount = 0;
50
50
  let polygonFeaturesCount = 0;
51
51
  const coordLengths = new Set();
52
- const numericPropKeys = {};
52
+ const propArrayTypes = {};
53
53
  for (const feature of features) {
54
54
  const geometry = feature.geometry;
55
55
  switch (geometry.type) {
@@ -109,7 +109,7 @@
109
109
  if (feature.properties) {
110
110
  for (const key in feature.properties) {
111
111
  const val = feature.properties[key];
112
- numericPropKeys[key] = numericPropKeys[key] || numericPropKeys[key] === void 0 ? isNumeric(val) : numericPropKeys[key];
112
+ propArrayTypes[key] = deduceArrayType(val, propArrayTypes[key]);
113
113
  }
114
114
  }
115
115
  }
@@ -124,7 +124,8 @@
124
124
  polygonObjectsCount,
125
125
  polygonRingsCount,
126
126
  polygonFeaturesCount,
127
- numericPropKeys: Object.keys(numericPropKeys).filter((k) => numericPropKeys[k])
127
+ numericPropKeys: Object.keys(propArrayTypes).filter((k) => propArrayTypes[k] !== Array),
128
+ propArrayTypes
128
129
  };
129
130
  }
130
131
  function secondPass(features, firstPassData, options) {
@@ -137,6 +138,7 @@
137
138
  polygonPositionsCount,
138
139
  polygonObjectsCount,
139
140
  polygonRingsCount,
141
+ propArrayTypes,
140
142
  polygonFeaturesCount
141
143
  } = firstPassData;
142
144
  const { coordLength, numericPropKeys, PositionDataType = Float32Array } = options;
@@ -170,7 +172,8 @@
170
172
  };
171
173
  for (const object of [points, lines, polygons]) {
172
174
  for (const propName of numericPropKeys || []) {
173
- object.numericProps[propName] = new Float32Array(object.positions.length / coordLength);
175
+ const TypedArray = propArrayTypes[propName];
176
+ object.numericProps[propName] = new TypedArray(object.positions.length / coordLength);
174
177
  }
175
178
  }
176
179
  lines.pathIndices[linePathsCount] = linePositionsCount;
@@ -338,8 +341,11 @@
338
341
  function flatten(arrays) {
339
342
  return [].concat(...arrays);
340
343
  }
341
- function isNumeric(x) {
342
- return Number.isFinite(x);
344
+ function deduceArrayType(x, constructor) {
345
+ if (constructor === Array || !Number.isFinite(x)) {
346
+ return Array;
347
+ }
348
+ return constructor === Float64Array || Math.fround(x) !== x ? Float64Array : Float32Array;
343
349
  }
344
350
  var init_geojson_to_binary = __esm({
345
351
  "../gis/src/lib/geojson-to-binary.ts"() {
@@ -9,7 +9,7 @@ var _gis = require("@loaders.gl/gis");
9
9
 
10
10
  var _togeojson = require("@tmcw/togeojson");
11
11
 
12
- const VERSION = typeof "3.1.0-beta.5" !== 'undefined' ? "3.1.0-beta.5" : 'latest';
12
+ const VERSION = typeof "3.1.0-beta.7" !== 'undefined' ? "3.1.0-beta.7" : 'latest';
13
13
  const GPX_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<gpx";
14
14
  const GPXLoader = {
15
15
  name: 'GPX (GPS exchange format)',
@@ -9,7 +9,7 @@ var _gis = require("@loaders.gl/gis");
9
9
 
10
10
  var _togeojson = require("@tmcw/togeojson");
11
11
 
12
- const VERSION = typeof "3.1.0-beta.5" !== 'undefined' ? "3.1.0-beta.5" : 'latest';
12
+ const VERSION = typeof "3.1.0-beta.7" !== 'undefined' ? "3.1.0-beta.7" : 'latest';
13
13
  const KML_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<kml xmlns=\"http://www.opengis.net/kml/2.2\">";
14
14
  const KMLLoader = {
15
15
  name: 'KML (Keyhole Markup Language)',
@@ -9,7 +9,7 @@ var _gis = require("@loaders.gl/gis");
9
9
 
10
10
  var _togeojson = require("@tmcw/togeojson");
11
11
 
12
- const VERSION = typeof "3.1.0-beta.5" !== 'undefined' ? "3.1.0-beta.5" : 'latest';
12
+ const VERSION = typeof "3.1.0-beta.7" !== 'undefined' ? "3.1.0-beta.7" : 'latest';
13
13
  const TCX_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<TrainingCenterDatabase";
14
14
  const TCXLoader = {
15
15
  name: 'TCX (Training Center XML)',
@@ -1,6 +1,6 @@
1
1
  import { geojsonToBinary } from '@loaders.gl/gis';
2
2
  import { gpx } from '@tmcw/togeojson';
3
- const VERSION = typeof "3.1.0-beta.5" !== 'undefined' ? "3.1.0-beta.5" : 'latest';
3
+ const VERSION = typeof "3.1.0-beta.7" !== 'undefined' ? "3.1.0-beta.7" : '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,6 +1,6 @@
1
1
  import { geojsonToBinary } from '@loaders.gl/gis';
2
2
  import { kml } from '@tmcw/togeojson';
3
- const VERSION = typeof "3.1.0-beta.5" !== 'undefined' ? "3.1.0-beta.5" : 'latest';
3
+ const VERSION = typeof "3.1.0-beta.7" !== 'undefined' ? "3.1.0-beta.7" : '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,6 +1,6 @@
1
1
  import { geojsonToBinary } from '@loaders.gl/gis';
2
2
  import { tcx } from '@tmcw/togeojson';
3
- const VERSION = typeof "3.1.0-beta.5" !== 'undefined' ? "3.1.0-beta.5" : 'latest';
3
+ const VERSION = typeof "3.1.0-beta.7" !== 'undefined' ? "3.1.0-beta.7" : '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)',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loaders.gl/kml",
3
- "version": "3.1.0-beta.5",
3
+ "version": "3.1.0-beta.7",
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/bundle.js"
33
33
  },
34
34
  "dependencies": {
35
- "@loaders.gl/gis": "3.1.0-beta.5",
36
- "@loaders.gl/loader-utils": "3.1.0-beta.5",
37
- "@loaders.gl/schema": "3.1.0-beta.5",
35
+ "@loaders.gl/gis": "3.1.0-beta.7",
36
+ "@loaders.gl/loader-utils": "3.1.0-beta.7",
37
+ "@loaders.gl/schema": "3.1.0-beta.7",
38
38
  "@tmcw/togeojson": "^4.5.0"
39
39
  },
40
- "gitHead": "5d66468457cc878d2dbff3d7807d737ceb181c9a"
40
+ "gitHead": "f3b4d81ac02758398c4e4eef5e556b206ef2dfbe"
41
41
  }