@loaders.gl/kml 3.4.7 → 3.4.9

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 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
- return {
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({
@@ -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.7" !== 'undefined' ? "3.4.7" : 'latest';
12
+ var VERSION = typeof "3.4.9" !== 'undefined' ? "3.4.9" : '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)',
@@ -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.7" !== 'undefined' ? "3.4.7" : 'latest';
12
+ var VERSION = typeof "3.4.9" !== 'undefined' ? "3.4.9" : '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)',
@@ -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.7" !== 'undefined' ? "3.4.7" : 'latest';
12
+ var VERSION = typeof "3.4.9" !== 'undefined' ? "3.4.9" : '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,6 +1,6 @@
1
1
  import { geojsonToBinary } from '@loaders.gl/gis';
2
2
  import { gpx } from '@tmcw/togeojson';
3
- const VERSION = typeof "3.4.7" !== 'undefined' ? "3.4.7" : 'latest';
3
+ const VERSION = typeof "3.4.9" !== 'undefined' ? "3.4.9" : '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.4.7" !== 'undefined' ? "3.4.7" : 'latest';
3
+ const VERSION = typeof "3.4.9" !== 'undefined' ? "3.4.9" : '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.4.7" !== 'undefined' ? "3.4.7" : 'latest';
3
+ const VERSION = typeof "3.4.9" !== 'undefined' ? "3.4.9" : '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.4.7",
3
+ "version": "3.4.9",
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.7",
36
- "@loaders.gl/loader-utils": "3.4.7",
37
- "@loaders.gl/schema": "3.4.7",
35
+ "@loaders.gl/gis": "3.4.9",
36
+ "@loaders.gl/loader-utils": "3.4.9",
37
+ "@loaders.gl/schema": "3.4.9",
38
38
  "@tmcw/togeojson": "^4.5.0"
39
39
  },
40
- "gitHead": "b94d4bda9ffc846f26a3094c5a825422a9030149"
40
+ "gitHead": "8df7484834897fa5ac8e065487d99d02f96e9560"
41
41
  }