@loaders.gl/arrow 4.2.0-alpha.4 → 4.2.0-alpha.6

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.
Files changed (91) hide show
  1. package/dist/arrow-loader.d.ts +1 -1
  2. package/dist/arrow-loader.d.ts.map +1 -1
  3. package/dist/arrow-loader.js +30 -19
  4. package/dist/arrow-worker.js +4 -2
  5. package/dist/arrow-writer.d.ts +1 -1
  6. package/dist/arrow-writer.d.ts.map +1 -1
  7. package/dist/arrow-writer.js +23 -16
  8. package/dist/dist.dev.js +361 -333
  9. package/dist/dist.min.js +23 -0
  10. package/dist/geoarrow/convert-geoarrow-to-binary-geometry.js +345 -288
  11. package/dist/geoarrow/convert-geoarrow-to-geojson-geometry.js +151 -124
  12. package/dist/geoarrow/get-arrow-bounds.js +32 -22
  13. package/dist/geoarrow-loader.d.ts +1 -1
  14. package/dist/geoarrow-loader.d.ts.map +1 -1
  15. package/dist/geoarrow-loader.js +22 -15
  16. package/dist/geoarrow-writer.js +25 -16
  17. package/dist/index.cjs +55 -71
  18. package/dist/index.cjs.map +7 -0
  19. package/dist/index.d.ts +16 -16
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js +8 -1
  22. package/dist/lib/arrow-table-batch.d.ts +1 -1
  23. package/dist/lib/arrow-table-batch.d.ts.map +1 -1
  24. package/dist/lib/arrow-table-batch.js +55 -51
  25. package/dist/lib/arrow-table.js +3 -1
  26. package/dist/lib/encode-arrow.d.ts +1 -1
  27. package/dist/lib/encode-arrow.d.ts.map +1 -1
  28. package/dist/lib/encode-arrow.js +31 -16
  29. package/dist/lib/encode-geoarrow.d.ts +1 -1
  30. package/dist/lib/encode-geoarrow.d.ts.map +1 -1
  31. package/dist/lib/encode-geoarrow.js +31 -16
  32. package/dist/parsers/parse-arrow-in-batches.d.ts +2 -2
  33. package/dist/parsers/parse-arrow-in-batches.d.ts.map +1 -1
  34. package/dist/parsers/parse-arrow-in-batches.js +49 -21
  35. package/dist/parsers/parse-arrow-sync.d.ts +1 -1
  36. package/dist/parsers/parse-arrow-sync.d.ts.map +1 -1
  37. package/dist/parsers/parse-arrow-sync.js +26 -22
  38. package/dist/parsers/parse-geoarrow-in-batches.d.ts +1 -1
  39. package/dist/parsers/parse-geoarrow-in-batches.d.ts.map +1 -1
  40. package/dist/parsers/parse-geoarrow-in-batches.js +7 -2
  41. package/dist/parsers/parse-geoarrow-sync.d.ts +1 -1
  42. package/dist/parsers/parse-geoarrow-sync.d.ts.map +1 -1
  43. package/dist/parsers/parse-geoarrow-sync.js +12 -10
  44. package/dist/schema/arrow-type-utils.js +36 -9
  45. package/dist/schema/convert-arrow-schema.js +253 -240
  46. package/dist/tables/convert-arrow-to-columnar-table.d.ts +1 -1
  47. package/dist/tables/convert-arrow-to-columnar-table.d.ts.map +1 -1
  48. package/dist/tables/convert-arrow-to-columnar-table.js +22 -13
  49. package/dist/tables/convert-arrow-to-geojson-table.d.ts +1 -1
  50. package/dist/tables/convert-arrow-to-geojson-table.d.ts.map +1 -1
  51. package/dist/tables/convert-arrow-to-geojson-table.js +47 -32
  52. package/dist/tables/convert-columnar-to-row-table.js +22 -16
  53. package/dist/tables/convert-table-to-arrow.js +58 -1
  54. package/dist/triangulate-on-worker.js +24 -19
  55. package/dist/triangulation-worker.js +6 -1
  56. package/dist/types.js +8 -6
  57. package/dist/workers/arrow-worker.js +3 -1
  58. package/dist/workers/hard-clone.js +93 -49
  59. package/dist/workers/triangulation-worker-node.d.ts +1 -1
  60. package/dist/workers/triangulation-worker-node.d.ts.map +1 -1
  61. package/dist/workers/triangulation-worker-node.js +3 -1
  62. package/dist/workers/triangulation-worker.js +48 -48
  63. package/package.json +13 -8
  64. package/dist/arrow-loader.js.map +0 -1
  65. package/dist/arrow-writer.js.map +0 -1
  66. package/dist/geoarrow/convert-geoarrow-to-binary-geometry.js.map +0 -1
  67. package/dist/geoarrow/convert-geoarrow-to-geojson-geometry.js.map +0 -1
  68. package/dist/geoarrow/get-arrow-bounds.js.map +0 -1
  69. package/dist/geoarrow-loader.js.map +0 -1
  70. package/dist/geoarrow-writer.js.map +0 -1
  71. package/dist/index.js.map +0 -1
  72. package/dist/lib/arrow-table-batch.js.map +0 -1
  73. package/dist/lib/arrow-table.js.map +0 -1
  74. package/dist/lib/encode-arrow.js.map +0 -1
  75. package/dist/lib/encode-geoarrow.js.map +0 -1
  76. package/dist/parsers/parse-arrow-in-batches.js.map +0 -1
  77. package/dist/parsers/parse-arrow-sync.js.map +0 -1
  78. package/dist/parsers/parse-geoarrow-in-batches.js.map +0 -1
  79. package/dist/parsers/parse-geoarrow-sync.js.map +0 -1
  80. package/dist/schema/arrow-type-utils.js.map +0 -1
  81. package/dist/schema/convert-arrow-schema.js.map +0 -1
  82. package/dist/tables/convert-arrow-to-columnar-table.js.map +0 -1
  83. package/dist/tables/convert-arrow-to-geojson-table.js.map +0 -1
  84. package/dist/tables/convert-columnar-to-row-table.js.map +0 -1
  85. package/dist/tables/convert-table-to-arrow.js.map +0 -1
  86. package/dist/triangulate-on-worker.js.map +0 -1
  87. package/dist/types.js.map +0 -1
  88. package/dist/workers/arrow-worker.js.map +0 -1
  89. package/dist/workers/hard-clone.js.map +0 -1
  90. package/dist/workers/triangulation-worker-node.js.map +0 -1
  91. package/dist/workers/triangulation-worker.js.map +0 -1
@@ -1,149 +1,176 @@
1
+ // loaders.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
1
4
  import { binaryToGeometry } from '@loaders.gl/gis';
2
5
  import { WKBLoader, WKTLoader } from '@loaders.gl/wkt';
6
+ /**
7
+ * parse geometry from arrow data that is returned from processArrowData()
8
+ * NOTE: this function could be deduplicated with the binaryToFeature() in deck.gl,
9
+ * it is currently used for deck.gl picking because currently deck.gl returns only the index of the feature
10
+ *
11
+ * @param data data extraced from arrow vector representing a geometry
12
+ * @param encoding the geoarrow encoding of the geometry column
13
+ * @returns Feature or null
14
+ */
3
15
  export function parseGeometryFromArrow(arrowCellValue, encoding) {
4
- var _encoding;
5
- encoding = (_encoding = encoding) === null || _encoding === void 0 ? void 0 : _encoding.toLowerCase();
6
- if (!encoding || !arrowCellValue) {
7
- return null;
8
- }
9
- let geometry;
10
- switch (encoding) {
11
- case 'geoarrow.multipolygon':
12
- geometry = arrowMultiPolygonToFeature(arrowCellValue);
13
- break;
14
- case 'geoarrow.polygon':
15
- geometry = arrowPolygonToFeature(arrowCellValue);
16
- break;
17
- case 'geoarrow.multipoint':
18
- geometry = arrowMultiPointToFeature(arrowCellValue);
19
- break;
20
- case 'geoarrow.point':
21
- geometry = arrowPointToFeature(arrowCellValue);
22
- break;
23
- case 'geoarrow.multilinestring':
24
- geometry = arrowMultiLineStringToFeature(arrowCellValue);
25
- break;
26
- case 'geoarrow.linestring':
27
- geometry = arrowLineStringToFeature(arrowCellValue);
28
- break;
29
- case 'geoarrow.wkb':
30
- geometry = arrowWKBToFeature(arrowCellValue);
31
- break;
32
- case 'geoarrow.wkt':
33
- geometry = arrowWKTToFeature(arrowCellValue);
34
- break;
35
- default:
36
- {
37
- throw Error(`GeoArrow encoding not supported ${encoding}`);
38
- }
39
- }
40
- return geometry;
16
+ // sanity
17
+ encoding = encoding?.toLowerCase();
18
+ if (!encoding || !arrowCellValue) {
19
+ return null;
20
+ }
21
+ let geometry;
22
+ switch (encoding) {
23
+ case 'geoarrow.multipolygon':
24
+ geometry = arrowMultiPolygonToFeature(arrowCellValue);
25
+ break;
26
+ case 'geoarrow.polygon':
27
+ geometry = arrowPolygonToFeature(arrowCellValue);
28
+ break;
29
+ case 'geoarrow.multipoint':
30
+ geometry = arrowMultiPointToFeature(arrowCellValue);
31
+ break;
32
+ case 'geoarrow.point':
33
+ geometry = arrowPointToFeature(arrowCellValue);
34
+ break;
35
+ case 'geoarrow.multilinestring':
36
+ geometry = arrowMultiLineStringToFeature(arrowCellValue);
37
+ break;
38
+ case 'geoarrow.linestring':
39
+ geometry = arrowLineStringToFeature(arrowCellValue);
40
+ break;
41
+ case 'geoarrow.wkb':
42
+ geometry = arrowWKBToFeature(arrowCellValue);
43
+ break;
44
+ case 'geoarrow.wkt':
45
+ geometry = arrowWKTToFeature(arrowCellValue);
46
+ break;
47
+ default: {
48
+ throw Error(`GeoArrow encoding not supported ${encoding}`);
49
+ }
50
+ }
51
+ return geometry;
41
52
  }
42
53
  function arrowWKBToFeature(arrowCellValue) {
43
- var _WKBLoader$parseSync;
44
- const arrayBuffer = arrowCellValue.buffer.slice(arrowCellValue.byteOffset, arrowCellValue.byteOffset + arrowCellValue.byteLength);
45
- const binaryGeometry = (_WKBLoader$parseSync = WKBLoader.parseSync) === null || _WKBLoader$parseSync === void 0 ? void 0 : _WKBLoader$parseSync.call(WKBLoader, arrayBuffer);
46
- const geometry = binaryToGeometry(binaryGeometry);
47
- return geometry;
54
+ // The actual WKB array buffer starts from byteOffset and ends at byteOffset + byteLength
55
+ const arrayBuffer = arrowCellValue.buffer.slice(arrowCellValue.byteOffset, arrowCellValue.byteOffset + arrowCellValue.byteLength);
56
+ const binaryGeometry = WKBLoader.parseSync?.(arrayBuffer);
57
+ const geometry = binaryToGeometry(binaryGeometry);
58
+ return geometry;
48
59
  }
49
60
  function arrowWKTToFeature(arrowCellValue) {
50
- var _WKTLoader$parseTextS;
51
- const string = arrowCellValue;
52
- return (_WKTLoader$parseTextS = WKTLoader.parseTextSync) === null || _WKTLoader$parseTextS === void 0 ? void 0 : _WKTLoader$parseTextS.call(WKTLoader, string);
61
+ const string = arrowCellValue;
62
+ return WKTLoader.parseTextSync?.(string);
53
63
  }
64
+ /**
65
+ * convert Arrow MultiPolygon to geojson Feature
66
+ */
54
67
  function arrowMultiPolygonToFeature(arrowMultiPolygon) {
55
- const multiPolygon = [];
56
- for (let m = 0; m < arrowMultiPolygon.length; m++) {
57
- const arrowPolygon = arrowMultiPolygon.get(m);
58
- const polygon = [];
59
- for (let i = 0; arrowPolygon && i < (arrowPolygon === null || arrowPolygon === void 0 ? void 0 : arrowPolygon.length); i++) {
60
- const arrowRing = arrowPolygon === null || arrowPolygon === void 0 ? void 0 : arrowPolygon.get(i);
61
- const ring = [];
62
- for (let j = 0; arrowRing && j < arrowRing.length; j++) {
63
- const arrowCoord = arrowRing.get(j);
64
- const coord = Array.from(arrowCoord);
65
- ring.push(coord);
66
- }
67
- polygon.push(ring);
68
+ const multiPolygon = [];
69
+ for (let m = 0; m < arrowMultiPolygon.length; m++) {
70
+ const arrowPolygon = arrowMultiPolygon.get(m);
71
+ const polygon = [];
72
+ for (let i = 0; arrowPolygon && i < arrowPolygon?.length; i++) {
73
+ const arrowRing = arrowPolygon?.get(i);
74
+ const ring = [];
75
+ for (let j = 0; arrowRing && j < arrowRing.length; j++) {
76
+ const arrowCoord = arrowRing.get(j);
77
+ const coord = Array.from(arrowCoord);
78
+ ring.push(coord);
79
+ }
80
+ polygon.push(ring);
81
+ }
82
+ multiPolygon.push(polygon);
68
83
  }
69
- multiPolygon.push(polygon);
70
- }
71
- const geometry = {
72
- type: 'MultiPolygon',
73
- coordinates: multiPolygon
74
- };
75
- return geometry;
84
+ const geometry = {
85
+ type: 'MultiPolygon',
86
+ coordinates: multiPolygon
87
+ };
88
+ return geometry;
76
89
  }
90
+ /**
91
+ * convert Arrow Polygon to geojson Feature
92
+ */
77
93
  function arrowPolygonToFeature(arrowPolygon) {
78
- const polygon = [];
79
- for (let i = 0; arrowPolygon && i < arrowPolygon.length; i++) {
80
- const arrowRing = arrowPolygon.get(i);
81
- const ring = [];
82
- for (let j = 0; arrowRing && j < arrowRing.length; j++) {
83
- const arrowCoord = arrowRing.get(j);
84
- const coords = Array.from(arrowCoord);
85
- ring.push(coords);
94
+ const polygon = [];
95
+ for (let i = 0; arrowPolygon && i < arrowPolygon.length; i++) {
96
+ const arrowRing = arrowPolygon.get(i);
97
+ const ring = [];
98
+ for (let j = 0; arrowRing && j < arrowRing.length; j++) {
99
+ const arrowCoord = arrowRing.get(j);
100
+ const coords = Array.from(arrowCoord);
101
+ ring.push(coords);
102
+ }
103
+ polygon.push(ring);
86
104
  }
87
- polygon.push(ring);
88
- }
89
- const geometry = {
90
- type: 'Polygon',
91
- coordinates: polygon
92
- };
93
- return geometry;
105
+ const geometry = {
106
+ type: 'Polygon',
107
+ coordinates: polygon
108
+ };
109
+ return geometry;
94
110
  }
111
+ /**
112
+ * convert Arrow MultiPoint to geojson MultiPoint
113
+ */
95
114
  function arrowMultiPointToFeature(arrowMultiPoint) {
96
- const multiPoint = [];
97
- for (let i = 0; arrowMultiPoint && i < arrowMultiPoint.length; i++) {
98
- const arrowPoint = arrowMultiPoint.get(i);
99
- if (arrowPoint) {
100
- const coord = Array.from(arrowPoint);
101
- multiPoint.push(coord);
115
+ const multiPoint = [];
116
+ for (let i = 0; arrowMultiPoint && i < arrowMultiPoint.length; i++) {
117
+ const arrowPoint = arrowMultiPoint.get(i);
118
+ if (arrowPoint) {
119
+ const coord = Array.from(arrowPoint);
120
+ multiPoint.push(coord);
121
+ }
102
122
  }
103
- }
104
- return {
105
- type: 'MultiPoint',
106
- coordinates: multiPoint
107
- };
123
+ return {
124
+ type: 'MultiPoint',
125
+ coordinates: multiPoint
126
+ };
108
127
  }
128
+ /**
129
+ * convert Arrow Point to geojson Point
130
+ */
109
131
  function arrowPointToFeature(arrowPoint) {
110
- const point = Array.from(arrowPoint);
111
- return {
112
- type: 'Point',
113
- coordinates: point
114
- };
132
+ const point = Array.from(arrowPoint);
133
+ return {
134
+ type: 'Point',
135
+ coordinates: point
136
+ };
115
137
  }
138
+ /**
139
+ * convert Arrow MultiLineString to geojson MultiLineString
140
+ */
116
141
  function arrowMultiLineStringToFeature(arrowMultiLineString) {
117
- const multiLineString = [];
118
- for (let i = 0; arrowMultiLineString && i < arrowMultiLineString.length; i++) {
119
- const arrowLineString = arrowMultiLineString.get(i);
120
- const lineString = [];
121
- for (let j = 0; arrowLineString && j < arrowLineString.length; j++) {
122
- const arrowCoord = arrowLineString.get(j);
123
- if (arrowCoord) {
124
- const coords = Array.from(arrowCoord);
125
- lineString.push(coords);
126
- }
142
+ const multiLineString = [];
143
+ for (let i = 0; arrowMultiLineString && i < arrowMultiLineString.length; i++) {
144
+ const arrowLineString = arrowMultiLineString.get(i);
145
+ const lineString = [];
146
+ for (let j = 0; arrowLineString && j < arrowLineString.length; j++) {
147
+ const arrowCoord = arrowLineString.get(j);
148
+ if (arrowCoord) {
149
+ const coords = Array.from(arrowCoord);
150
+ lineString.push(coords);
151
+ }
152
+ }
153
+ multiLineString.push(lineString);
127
154
  }
128
- multiLineString.push(lineString);
129
- }
130
- return {
131
- type: 'MultiLineString',
132
- coordinates: multiLineString
133
- };
155
+ return {
156
+ type: 'MultiLineString',
157
+ coordinates: multiLineString
158
+ };
134
159
  }
160
+ /**
161
+ * convert Arrow LineString to geojson LineString
162
+ */
135
163
  function arrowLineStringToFeature(arrowLineString) {
136
- const lineString = [];
137
- for (let i = 0; arrowLineString && i < arrowLineString.length; i++) {
138
- const arrowCoord = arrowLineString.get(i);
139
- if (arrowCoord) {
140
- const coords = Array.from(arrowCoord);
141
- lineString.push(coords);
164
+ const lineString = [];
165
+ for (let i = 0; arrowLineString && i < arrowLineString.length; i++) {
166
+ const arrowCoord = arrowLineString.get(i);
167
+ if (arrowCoord) {
168
+ const coords = Array.from(arrowCoord);
169
+ lineString.push(coords);
170
+ }
142
171
  }
143
- }
144
- return {
145
- type: 'LineString',
146
- coordinates: lineString
147
- };
172
+ return {
173
+ type: 'LineString',
174
+ coordinates: lineString
175
+ };
148
176
  }
149
- //# sourceMappingURL=convert-geoarrow-to-geojson-geometry.js.map
@@ -1,24 +1,34 @@
1
- export function updateBoundsFromGeoArrowSamples(flatCoords, nDim, bounds) {
2
- let sampleSize = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 100;
3
- const numberOfFeatures = flatCoords.length / nDim;
4
- const sampleStep = Math.max(Math.floor(numberOfFeatures / sampleSize), 1);
5
- const newBounds = [...bounds];
6
- for (let i = 0; i < numberOfFeatures; i += sampleStep) {
7
- const lng = flatCoords[i * nDim];
8
- const lat = flatCoords[i * nDim + 1];
9
- if (lng < newBounds[0]) {
10
- newBounds[0] = lng;
1
+ // loaders.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+ /**
5
+ * Update bounds from geoarrow sample data
6
+ *
7
+ * @param flatCoords the flattend coordinates array from one chunk of geoarrow column
8
+ * @param nDim the number of dimensions of the coordinates
9
+ * @param bounds the bounds to be updated
10
+ * @param sampleSize how many samples to be used to update the bounds, default is 1000 per chunk
11
+ * @returns the updated bounds
12
+ */
13
+ export function updateBoundsFromGeoArrowSamples(flatCoords, nDim, bounds, sampleSize = 100) {
14
+ const numberOfFeatures = flatCoords.length / nDim;
15
+ const sampleStep = Math.max(Math.floor(numberOfFeatures / sampleSize), 1);
16
+ const newBounds = [...bounds];
17
+ for (let i = 0; i < numberOfFeatures; i += sampleStep) {
18
+ const lng = flatCoords[i * nDim];
19
+ const lat = flatCoords[i * nDim + 1];
20
+ if (lng < newBounds[0]) {
21
+ newBounds[0] = lng;
22
+ }
23
+ if (lat < newBounds[1]) {
24
+ newBounds[1] = lat;
25
+ }
26
+ if (lng > newBounds[2]) {
27
+ newBounds[2] = lng;
28
+ }
29
+ if (lat > newBounds[3]) {
30
+ newBounds[3] = lat;
31
+ }
11
32
  }
12
- if (lat < newBounds[1]) {
13
- newBounds[1] = lat;
14
- }
15
- if (lng > newBounds[2]) {
16
- newBounds[2] = lng;
17
- }
18
- if (lat > newBounds[3]) {
19
- newBounds[3] = lat;
20
- }
21
- }
22
- return newBounds;
33
+ return newBounds;
23
34
  }
24
- //# sourceMappingURL=get-arrow-bounds.js.map
@@ -1,6 +1,6 @@
1
1
  import type { Loader, LoaderWithParser, LoaderOptions } from '@loaders.gl/loader-utils';
2
2
  import type { GeoJSONTable, GeoJSONTableBatch, BinaryGeometry } from '@loaders.gl/schema';
3
- import type { ArrowTable, ArrowTableBatch } from './lib/arrow-table';
3
+ import type { ArrowTable, ArrowTableBatch } from "./lib/arrow-table.js";
4
4
  export type GeoArrowLoaderOptions = LoaderOptions & {
5
5
  arrow?: {
6
6
  shape: 'arrow-table' | 'binary-geometry';
@@ -1 +1 @@
1
- {"version":3,"file":"geoarrow-loader.d.ts","sourceRoot":"","sources":["../src/geoarrow-loader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAE,gBAAgB,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAEtF,OAAO,KAAK,EAAC,YAAY,EAAE,iBAAiB,EAAE,cAAc,EAAC,MAAM,oBAAoB,CAAC;AACxF,OAAO,KAAK,EAAC,UAAU,EAAE,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAInE,MAAM,MAAM,qBAAqB,GAAG,aAAa,GAAG;IAClD,KAAK,CAAC,EAAE;QACN,KAAK,EAAE,aAAa,GAAG,iBAAiB,CAAC;KAC1C,CAAC;CACH,CAAC;AAEF,2BAA2B;AAC3B,eAAO,MAAM,oBAAoB,EAAE,MAAM,CACvC,UAAU,GAAG,cAAc,EAC3B,KAAK,EACL,qBAAqB,CAQtB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,gBAAgB,CAC3C,UAAU,GAAG,YAAY,EAAE,oBAAoB;AAC/C,AAD2B,oBAAoB;AAC/C,eAAe,GAAG,iBAAiB,EAAE,oBAAoB;AACzD,qBAAqB,CAatB,CAAC"}
1
+ {"version":3,"file":"geoarrow-loader.d.ts","sourceRoot":"","sources":["../src/geoarrow-loader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAE,gBAAgB,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAEtF,OAAO,KAAK,EAAC,YAAY,EAAE,iBAAiB,EAAE,cAAc,EAAC,MAAM,oBAAoB,CAAC;AACxF,OAAO,KAAK,EAAC,UAAU,EAAE,eAAe,EAAC,6BAA0B;AAInE,MAAM,MAAM,qBAAqB,GAAG,aAAa,GAAG;IAClD,KAAK,CAAC,EAAE;QACN,KAAK,EAAE,aAAa,GAAG,iBAAiB,CAAC;KAC1C,CAAC;CACH,CAAC;AAEF,2BAA2B;AAC3B,eAAO,MAAM,oBAAoB,EAAE,MAAM,CACvC,UAAU,GAAG,cAAc,EAC3B,KAAK,EACL,qBAAqB,CAQtB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,gBAAgB,CAC3C,UAAU,GAAG,YAAY,EAAE,oBAAoB;AAC/C,AAD2B,oBAAoB;AAC/C,eAAe,GAAG,iBAAiB,EAAE,oBAAoB;AACzD,qBAAqB,CAatB,CAAC"}
@@ -1,23 +1,30 @@
1
+ // loaders.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
1
4
  import { ArrowWorkerLoader } from "./arrow-loader.js";
2
5
  import { parseGeoArrowSync } from "./parsers/parse-geoarrow-sync.js";
3
6
  import { parseGeoArrowInBatches } from "./parsers/parse-geoarrow-in-batches.js";
7
+ /** ArrowJS table loader */
4
8
  export const GeoArrowWorkerLoader = {
5
- ...ArrowWorkerLoader,
6
- options: {
7
- arrow: {
8
- shape: 'arrow-table'
9
+ ...ArrowWorkerLoader,
10
+ options: {
11
+ arrow: {
12
+ shape: 'arrow-table'
13
+ }
9
14
  }
10
- }
11
15
  };
16
+ /**
17
+ * GeoArrowLoader loads an Apache Arrow table, parses GeoArrow type extension data
18
+ * to convert it to a GeoJSON table or a BinaryGeometry
19
+ */
12
20
  export const GeoArrowLoader = {
13
- ...ArrowWorkerLoader,
14
- options: {
15
- arrow: {
16
- shape: 'arrow-table'
17
- }
18
- },
19
- parse: async (arraybuffer, options) => parseGeoArrowSync(arraybuffer, options === null || options === void 0 ? void 0 : options.arrow),
20
- parseSync: (arraybuffer, options) => parseGeoArrowSync(arraybuffer, options === null || options === void 0 ? void 0 : options.arrow),
21
- parseInBatches: parseGeoArrowInBatches
21
+ ...ArrowWorkerLoader,
22
+ options: {
23
+ arrow: {
24
+ shape: 'arrow-table'
25
+ }
26
+ },
27
+ parse: async (arraybuffer, options) => parseGeoArrowSync(arraybuffer, options?.arrow),
28
+ parseSync: (arraybuffer, options) => parseGeoArrowSync(arraybuffer, options?.arrow),
29
+ parseInBatches: parseGeoArrowInBatches
22
30
  };
23
- //# sourceMappingURL=geoarrow-loader.js.map
@@ -1,19 +1,28 @@
1
+ // import type {} from '@loaders.gl/loader-utils';
1
2
  import { encodeGeoArrowSync } from "./lib/encode-geoarrow.js";
2
- const VERSION = typeof "4.2.0-alpha.4" !== 'undefined' ? "4.2.0-alpha.4" : 'latest';
3
+ // __VERSION__ is injected by babel-plugin-version-inline
4
+ // @ts-ignore TS2304: Cannot find name '__VERSION__'.
5
+ const VERSION = typeof "4.2.0-alpha.5" !== 'undefined' ? "4.2.0-alpha.5" : 'latest';
6
+ /** Apache Arrow writer */
3
7
  export const GeoArrowWriter = {
4
- name: 'Apache Arrow',
5
- id: 'arrow',
6
- module: 'arrow',
7
- version: VERSION,
8
- extensions: ['arrow', 'feather'],
9
- mimeTypes: ['application/vnd.apache.arrow.file', 'application/vnd.apache.arrow.stream', 'application/octet-stream'],
10
- binary: true,
11
- options: {},
12
- encode: async function encodeArrow(data, options) {
13
- return encodeGeoArrowSync(data);
14
- },
15
- encodeSync(data, options) {
16
- return encodeGeoArrowSync(data);
17
- }
8
+ name: 'Apache Arrow',
9
+ id: 'arrow',
10
+ module: 'arrow',
11
+ version: VERSION,
12
+ extensions: ['arrow', 'feather'],
13
+ mimeTypes: [
14
+ 'application/vnd.apache.arrow.file',
15
+ 'application/vnd.apache.arrow.stream',
16
+ 'application/octet-stream'
17
+ ],
18
+ binary: true,
19
+ options: {},
20
+ encode: async function encodeArrow(data, options) {
21
+ // @ts-expect-error
22
+ return encodeGeoArrowSync(data);
23
+ },
24
+ encodeSync(data, options) {
25
+ // @ts-expect-error
26
+ return encodeGeoArrowSync(data);
27
+ }
18
28
  };
19
- //# sourceMappingURL=geoarrow-writer.js.map