@loaders.gl/gis 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 (34) hide show
  1. package/dist/index.cjs +35 -92
  2. package/dist/index.cjs.map +7 -0
  3. package/dist/index.d.ts +12 -12
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +6 -1
  6. package/dist/lib/binary-features/binary-to-geojson.js +175 -171
  7. package/dist/lib/binary-features/extract-geometry-info.js +88 -80
  8. package/dist/lib/binary-features/flat-geojson-to-binary-types.js +0 -1
  9. package/dist/lib/binary-features/flat-geojson-to-binary.d.ts +1 -1
  10. package/dist/lib/binary-features/flat-geojson-to-binary.d.ts.map +1 -1
  11. package/dist/lib/binary-features/flat-geojson-to-binary.js +346 -281
  12. package/dist/lib/binary-features/geojson-to-binary.js +17 -20
  13. package/dist/lib/binary-features/geojson-to-flat-geojson.js +111 -84
  14. package/dist/lib/binary-features/transform.js +44 -30
  15. package/dist/lib/geo/geoarrow-metadata.js +61 -34
  16. package/dist/lib/geo/geoparquet-metadata-schema.js +64 -71
  17. package/dist/lib/geo/geoparquet-metadata.d.ts.map +1 -1
  18. package/dist/lib/geo/geoparquet-metadata.js +97 -77
  19. package/dist/lib/tables/convert-table-to-geojson.js +38 -42
  20. package/package.json +7 -4
  21. package/src/lib/geo/geoparquet-metadata.ts +2 -1
  22. package/dist/index.js.map +0 -1
  23. package/dist/lib/binary-features/binary-to-geojson.js.map +0 -1
  24. package/dist/lib/binary-features/extract-geometry-info.js.map +0 -1
  25. package/dist/lib/binary-features/flat-geojson-to-binary-types.js.map +0 -1
  26. package/dist/lib/binary-features/flat-geojson-to-binary.js.map +0 -1
  27. package/dist/lib/binary-features/geojson-to-binary.js.map +0 -1
  28. package/dist/lib/binary-features/geojson-to-flat-geojson.js.map +0 -1
  29. package/dist/lib/binary-features/transform.js.map +0 -1
  30. package/dist/lib/geo/geoarrow-metadata.js.map +0 -1
  31. package/dist/lib/geo/geoparquet-metadata-schema.js.map +0 -1
  32. package/dist/lib/geo/geoparquet-metadata-schema.json +0 -60
  33. package/dist/lib/geo/geoparquet-metadata.js.map +0 -1
  34. package/dist/lib/tables/convert-table-to-geojson.js.map +0 -1
package/dist/index.cjs CHANGED
@@ -17,9 +17,9 @@ var __copyProps = (to, from, except, desc) => {
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
- // src/index.ts
21
- var src_exports = {};
22
- __export(src_exports, {
20
+ // dist/index.js
21
+ var dist_exports = {};
22
+ __export(dist_exports, {
23
23
  GEOPARQUET_METADATA_JSON_SCHEMA: () => GEOPARQUET_METADATA_JSON_SCHEMA,
24
24
  binaryToGeojson: () => binaryToGeojson,
25
25
  binaryToGeometry: () => binaryToGeometry,
@@ -35,9 +35,9 @@ __export(src_exports, {
35
35
  unpackGeoMetadata: () => unpackGeoMetadata,
36
36
  unpackJSONStringMetadata: () => unpackJSONStringMetadata
37
37
  });
38
- module.exports = __toCommonJS(src_exports);
38
+ module.exports = __toCommonJS(dist_exports);
39
39
 
40
- // src/lib/geo/geoparquet-metadata-schema.ts
40
+ // dist/lib/geo/geoparquet-metadata-schema.js
41
41
  var GEOPARQUET_METADATA_JSON_SCHEMA = {
42
42
  $schema: "http://json-schema.org/draft-07/schema#",
43
43
  title: "GeoParquet",
@@ -99,7 +99,7 @@ var GEOPARQUET_METADATA_JSON_SCHEMA = {
99
99
  }
100
100
  };
101
101
 
102
- // src/lib/geo/geoparquet-metadata.ts
102
+ // dist/lib/geo/geoparquet-metadata.js
103
103
  function getGeoMetadata(schema) {
104
104
  const geoMetadata = parseJSONStringMetadata(schema, "geo");
105
105
  if (!geoMetadata) {
@@ -159,22 +159,14 @@ function unpackGeoFieldMetadata(field, columnMetadata) {
159
159
  setFieldMetadata(field, `geo.crs.${crsKey}`, crsId);
160
160
  break;
161
161
  default:
162
- setFieldMetadata(
163
- field,
164
- `geo.crs.${crsKey}`,
165
- typeof crsValue === "string" ? crsValue : JSON.stringify(crsValue)
166
- );
162
+ setFieldMetadata(field, `geo.crs.${crsKey}`, typeof crsValue === "string" ? crsValue : JSON.stringify(crsValue));
167
163
  break;
168
164
  }
169
165
  }
170
166
  break;
171
167
  case "edges":
172
168
  default:
173
- setFieldMetadata(
174
- field,
175
- `geo.${key}`,
176
- typeof value === "string" ? value : JSON.stringify(value)
177
- );
169
+ setFieldMetadata(field, `geo.${key}`, typeof value === "string" ? value : JSON.stringify(value));
178
170
  }
179
171
  }
180
172
  }
@@ -204,7 +196,7 @@ function unpackJSONStringMetadata(schema, metadataKey) {
204
196
  }
205
197
  }
206
198
 
207
- // src/lib/geo/geoarrow-metadata.ts
199
+ // dist/lib/geo/geoarrow-metadata.js
208
200
  var GEOARROW_ENCODINGS = [
209
201
  "geoarrow.multipolygon",
210
202
  "geoarrow.polygon",
@@ -257,7 +249,7 @@ function getGeometryMetadataForField(field) {
257
249
  return metadata || null;
258
250
  }
259
251
 
260
- // src/lib/tables/convert-table-to-geojson.ts
252
+ // dist/lib/tables/convert-table-to-geojson.js
261
253
  var import_schema = require("@loaders.gl/schema");
262
254
  function convertWKBTableToGeoJSON(table, schema, loaders) {
263
255
  const geoMetadata = getGeoMetadata(schema);
@@ -294,23 +286,19 @@ function parseGeometry(geometry, columnMetadata, loaders) {
294
286
  }
295
287
  }
296
288
 
297
- // src/lib/binary-features/flat-geojson-to-binary.ts
289
+ // dist/lib/binary-features/flat-geojson-to-binary.js
298
290
  var import_polygon = require("@math.gl/polygon");
299
291
  function flatGeojsonToBinary(features, geometryInfo, options) {
300
292
  const propArrayTypes = extractNumericPropTypes(features);
301
293
  const numericPropKeys = Object.keys(propArrayTypes).filter((k) => propArrayTypes[k] !== Array);
302
- return fillArrays(
303
- features,
304
- {
305
- propArrayTypes,
306
- ...geometryInfo
307
- },
308
- {
309
- numericPropKeys: options && options.numericPropKeys || numericPropKeys,
310
- PositionDataType: options ? options.PositionDataType : Float32Array,
311
- triangulate: options ? options.triangulate : true
312
- }
313
- );
294
+ return fillArrays(features, {
295
+ propArrayTypes,
296
+ ...geometryInfo
297
+ }, {
298
+ numericPropKeys: options && options.numericPropKeys || numericPropKeys,
299
+ PositionDataType: options ? options.PositionDataType : Float32Array,
300
+ triangulate: options ? options.triangulate : true
301
+ });
314
302
  }
315
303
  function extractNumericPropTypes(features) {
316
304
  const propArrayTypes = {};
@@ -325,19 +313,7 @@ function extractNumericPropTypes(features) {
325
313
  return propArrayTypes;
326
314
  }
327
315
  function fillArrays(features, geometryInfo, options) {
328
- const {
329
- pointPositionsCount,
330
- pointFeaturesCount,
331
- linePositionsCount,
332
- linePathsCount,
333
- lineFeaturesCount,
334
- polygonPositionsCount,
335
- polygonObjectsCount,
336
- polygonRingsCount,
337
- polygonFeaturesCount,
338
- propArrayTypes,
339
- coordLength
340
- } = geometryInfo;
316
+ const { pointPositionsCount, pointFeaturesCount, linePositionsCount, linePathsCount, lineFeaturesCount, polygonPositionsCount, polygonObjectsCount, polygonRingsCount, polygonFeaturesCount, propArrayTypes, coordLength } = geometryInfo;
341
317
  const { numericPropKeys = [], PositionDataType = Float32Array, triangulate = true } = options;
342
318
  const hasGlobalId = features[0] && "id" in features[0];
343
319
  const GlobalFeatureIdsDataType = features.length > 65535 ? Uint32Array : Uint16Array;
@@ -434,32 +410,16 @@ function handlePoint(geometry, points, indexMap, coordLength, properties) {
434
410
  points.positions.set(geometry.data, indexMap.pointPosition * coordLength);
435
411
  const nPositions = geometry.data.length / coordLength;
436
412
  fillNumericProperties(points, properties, indexMap.pointPosition, nPositions);
437
- points.globalFeatureIds.fill(
438
- indexMap.feature,
439
- indexMap.pointPosition,
440
- indexMap.pointPosition + nPositions
441
- );
442
- points.featureIds.fill(
443
- indexMap.pointFeature,
444
- indexMap.pointPosition,
445
- indexMap.pointPosition + nPositions
446
- );
413
+ points.globalFeatureIds.fill(indexMap.feature, indexMap.pointPosition, indexMap.pointPosition + nPositions);
414
+ points.featureIds.fill(indexMap.pointFeature, indexMap.pointPosition, indexMap.pointPosition + nPositions);
447
415
  indexMap.pointPosition += nPositions;
448
416
  }
449
417
  function handleLineString(geometry, lines, indexMap, coordLength, properties) {
450
418
  lines.positions.set(geometry.data, indexMap.linePosition * coordLength);
451
419
  const nPositions = geometry.data.length / coordLength;
452
420
  fillNumericProperties(lines, properties, indexMap.linePosition, nPositions);
453
- lines.globalFeatureIds.fill(
454
- indexMap.feature,
455
- indexMap.linePosition,
456
- indexMap.linePosition + nPositions
457
- );
458
- lines.featureIds.fill(
459
- indexMap.lineFeature,
460
- indexMap.linePosition,
461
- indexMap.linePosition + nPositions
462
- );
421
+ lines.globalFeatureIds.fill(indexMap.feature, indexMap.linePosition, indexMap.linePosition + nPositions);
422
+ lines.featureIds.fill(indexMap.lineFeature, indexMap.linePosition, indexMap.linePosition + nPositions);
463
423
  for (let i = 0, il = geometry.indices.length; i < il; ++i) {
464
424
  const start = geometry.indices[i];
465
425
  const end = i === il - 1 ? geometry.data.length : geometry.indices[i + 1];
@@ -471,16 +431,8 @@ function handlePolygon(geometry, polygons, indexMap, coordLength, properties) {
471
431
  polygons.positions.set(geometry.data, indexMap.polygonPosition * coordLength);
472
432
  const nPositions = geometry.data.length / coordLength;
473
433
  fillNumericProperties(polygons, properties, indexMap.polygonPosition, nPositions);
474
- polygons.globalFeatureIds.fill(
475
- indexMap.feature,
476
- indexMap.polygonPosition,
477
- indexMap.polygonPosition + nPositions
478
- );
479
- polygons.featureIds.fill(
480
- indexMap.polygonFeature,
481
- indexMap.polygonPosition,
482
- indexMap.polygonPosition + nPositions
483
- );
434
+ polygons.globalFeatureIds.fill(indexMap.feature, indexMap.polygonPosition, indexMap.polygonPosition + nPositions);
435
+ polygons.featureIds.fill(indexMap.polygonFeature, indexMap.polygonPosition, indexMap.polygonPosition + nPositions);
484
436
  for (let l = 0, ll = geometry.indices.length; l < ll; ++l) {
485
437
  const startPosition = indexMap.polygonPosition;
486
438
  polygons.polygonIndices[indexMap.polygonObject++] = startPosition;
@@ -500,11 +452,7 @@ function handlePolygon(geometry, polygons, indexMap, coordLength, properties) {
500
452
  triangulatePolygon(polygons, areas, indices, { startPosition, endPosition, coordLength });
501
453
  }
502
454
  }
503
- function triangulatePolygon(polygons, areas, indices, {
504
- startPosition,
505
- endPosition,
506
- coordLength
507
- }) {
455
+ function triangulatePolygon(polygons, areas, indices, { startPosition, endPosition, coordLength }) {
508
456
  if (!polygons.triangles) {
509
457
  return;
510
458
  }
@@ -583,7 +531,7 @@ function deduceArrayType(x, constructor) {
583
531
  return constructor === Float64Array || Math.fround(x) !== x ? Float64Array : Float32Array;
584
532
  }
585
533
 
586
- // src/lib/binary-features/extract-geometry-info.ts
534
+ // dist/lib/binary-features/extract-geometry-info.js
587
535
  function extractGeometryInfo(features) {
588
536
  let pointPositionsCount = 0;
589
537
  let pointFeaturesCount = 0;
@@ -668,7 +616,7 @@ function extractGeometryInfo(features) {
668
616
  };
669
617
  }
670
618
 
671
- // src/lib/binary-features/geojson-to-flat-geojson.ts
619
+ // dist/lib/binary-features/geojson-to-flat-geojson.js
672
620
  var import_polygon2 = require("@math.gl/polygon");
673
621
  function geojsonToFlatGeojson(features, options = { coordLength: 2, fixRingWinding: true }) {
674
622
  return features.map((feature) => flattenFeature(feature, options));
@@ -752,7 +700,7 @@ function flattenFeature(feature, options) {
752
700
  return { ...feature, geometry: { type, indices, data, areas } };
753
701
  }
754
702
 
755
- // src/lib/binary-features/geojson-to-binary.ts
703
+ // dist/lib/binary-features/geojson-to-binary.js
756
704
  function geojsonToBinary(features, options = { fixRingWinding: true, triangulate: true }) {
757
705
  const geometryInfo = extractGeometryInfo(features);
758
706
  const coordLength = geometryInfo.coordLength;
@@ -765,7 +713,7 @@ function geojsonToBinary(features, options = { fixRingWinding: true, triangulate
765
713
  });
766
714
  }
767
715
 
768
- // src/lib/binary-features/binary-to-geojson.ts
716
+ // dist/lib/binary-features/binary-to-geojson.js
769
717
  function binaryToGeojson(data, options) {
770
718
  const globalFeatureId = options == null ? void 0 : options.globalFeatureId;
771
719
  if (globalFeatureId !== void 0) {
@@ -868,9 +816,7 @@ function parseProperties(data, startIndex = 0, endIndex) {
868
816
  function polygonToGeoJson(data, startIndex = -Infinity, endIndex = Infinity) {
869
817
  const { positions } = data;
870
818
  const polygonIndices = data.polygonIndices.value.filter((x) => x >= startIndex && x <= endIndex);
871
- const primitivePolygonIndices = data.primitivePolygonIndices.value.filter(
872
- (x) => x >= startIndex && x <= endIndex
873
- );
819
+ const primitivePolygonIndices = data.primitivePolygonIndices.value.filter((x) => x >= startIndex && x <= endIndex);
874
820
  const multi = polygonIndices.length > 2;
875
821
  if (!multi) {
876
822
  const coordinates2 = [];
@@ -886,11 +832,7 @@ function polygonToGeoJson(data, startIndex = -Infinity, endIndex = Infinity) {
886
832
  for (let i = 0; i < polygonIndices.length - 1; i++) {
887
833
  const startPolygonIndex = polygonIndices[i];
888
834
  const endPolygonIndex = polygonIndices[i + 1];
889
- const polygonCoordinates = polygonToGeoJson(
890
- data,
891
- startPolygonIndex,
892
- endPolygonIndex
893
- ).coordinates;
835
+ const polygonCoordinates = polygonToGeoJson(data, startPolygonIndex, endPolygonIndex).coordinates;
894
836
  coordinates.push(polygonCoordinates);
895
837
  }
896
838
  return { type: "MultiPolygon", coordinates };
@@ -933,7 +875,7 @@ function ringToGeoJson(positions, startIndex, endIndex) {
933
875
  return ringCoordinates;
934
876
  }
935
877
 
936
- // src/lib/binary-features/transform.ts
878
+ // dist/lib/binary-features/transform.js
937
879
  function transformBinaryCoords(binaryFeatures, transformCoordinate) {
938
880
  if (binaryFeatures.points) {
939
881
  transformBinaryGeometryPositions(binaryFeatures.points, transformCoordinate);
@@ -971,3 +913,4 @@ function coordMap(array, fn) {
971
913
  function isCoord(array) {
972
914
  return Array.isArray(array) && Number.isFinite(array[0]) && Number.isFinite(array[1]);
973
915
  }
916
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["index.js", "lib/geo/geoparquet-metadata-schema.js", "lib/geo/geoparquet-metadata.js", "lib/geo/geoarrow-metadata.js", "lib/tables/convert-table-to-geojson.js", "lib/binary-features/flat-geojson-to-binary.js", "lib/binary-features/extract-geometry-info.js", "lib/binary-features/geojson-to-flat-geojson.js", "lib/binary-features/geojson-to-binary.js", "lib/binary-features/binary-to-geojson.js", "lib/binary-features/transform.js"],
4
+ "sourcesContent": ["// Types from `@loaders.gl/schema`\n// Geo Metadata\n// import {default as GEOPARQUET_METADATA_SCHEMA} from './lib/geo/geoparquet-metadata-schema.json';\n// export {GEOPARQUET_METADATA_SCHEMA};\nexport { GEOPARQUET_METADATA_JSON_SCHEMA } from \"./lib/geo/geoparquet-metadata-schema.js\";\nexport { getGeoMetadata, setGeoMetadata, unpackGeoMetadata } from \"./lib/geo/geoparquet-metadata.js\";\nexport { unpackJSONStringMetadata } from \"./lib/geo/geoparquet-metadata.js\";\nexport { getGeometryColumnsFromSchema } from \"./lib/geo/geoarrow-metadata.js\";\n// Table conversion\nexport { convertWKBTableToGeoJSON } from \"./lib/tables/convert-table-to-geojson.js\";\n// Binary Geometries\nexport { flatGeojsonToBinary } from \"./lib/binary-features/flat-geojson-to-binary.js\";\nexport { geojsonToBinary } from \"./lib/binary-features/geojson-to-binary.js\";\nexport { geojsonToFlatGeojson } from \"./lib/binary-features/geojson-to-flat-geojson.js\";\nexport { binaryToGeojson, binaryToGeometry } from \"./lib/binary-features/binary-to-geojson.js\";\nexport { transformBinaryCoords, transformGeoJsonCoords } from \"./lib/binary-features/transform.js\";\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n/* eslint-disable camelcase */\n/**\n * Geoparquet JSON schema for geo metadata\n * @see https://github.com/geoarrow/geoarrow/blob/main/metadata.md\n * @see https://github.com/opengeospatial/geoparquet/blob/main/format-specs/geoparquet.md\n */\nexport const GEOPARQUET_METADATA_JSON_SCHEMA = {\n $schema: 'http://json-schema.org/draft-07/schema#',\n title: 'GeoParquet',\n description: 'Parquet metadata included in the geo field.',\n type: 'object',\n required: ['version', 'primary_column', 'columns'],\n properties: {\n version: { type: 'string', const: '1.0.0-beta.1' },\n primary_column: { type: 'string', minLength: 1 },\n columns: {\n type: 'object',\n minProperties: 1,\n patternProperties: {\n '.+': {\n type: 'object',\n required: ['encoding', 'geometry_types'],\n properties: {\n encoding: { type: 'string', const: 'WKB' },\n geometry_types: {\n type: 'array',\n uniqueItems: true,\n items: {\n type: 'string',\n pattern: '^(GeometryCollection|(Multi)?(Point|LineString|Polygon))( Z)?$'\n }\n },\n crs: {\n oneOf: [\n {\n $ref: 'https://proj.org/schemas/v0.5/projjson.schema.json'\n },\n { type: 'null' }\n ]\n },\n edges: { type: 'string', enum: ['planar', 'spherical'] },\n orientation: { type: 'string', const: 'counterclockwise' },\n bbox: {\n type: 'array',\n items: { type: 'number' },\n oneOf: [\n {\n description: '2D bbox consisting of (xmin, ymin, xmax, ymax)',\n minItems: 4,\n maxItems: 4\n },\n {\n description: '3D bbox consisting of (xmin, ymin, zmin, xmax, ymax, zmax)',\n minItems: 6,\n maxItems: 6\n }\n ]\n },\n epoch: { type: 'number' }\n }\n }\n },\n additionalProperties: false\n }\n }\n};\n", "// GEO METADATA\n/**\n * Reads the GeoMetadata object from the metadata\n * @note geoarrow / parquet schema is stringified into a single key-value pair in the parquet metadata\n */\nexport function getGeoMetadata(schema) {\n const geoMetadata = parseJSONStringMetadata(schema, 'geo');\n if (!geoMetadata) {\n return null;\n }\n for (const column of Object.values(geoMetadata.columns || {})) {\n if (column.encoding) {\n column.encoding = column.encoding.toLowerCase();\n }\n }\n return geoMetadata;\n}\n/**\n * Stores a geoarrow / geoparquet geo metadata object in the schema\n * @note geoarrow / geoparquet geo metadata is a single stringified JSON field\n */\nexport function setGeoMetadata(schema, geoMetadata) {\n const stringifiedGeoMetadata = JSON.stringify(geoMetadata);\n schema.metadata.geo = stringifiedGeoMetadata;\n}\n/**\n * Unpacks geo metadata into separate metadata fields (parses the long JSON string)\n * @note geoarrow / parquet schema is stringified into a single key-value pair in the parquet metadata\n */\nexport function unpackGeoMetadata(schema) {\n const geoMetadata = getGeoMetadata(schema);\n if (!geoMetadata) {\n return;\n }\n // Store Parquet Schema Level Metadata\n const { version, primary_column, columns } = geoMetadata;\n if (version) {\n schema.metadata['geo.version'] = version;\n }\n if (primary_column) {\n schema.metadata['geo.primary_column'] = primary_column;\n }\n // store column names as comma separated list\n schema.metadata['geo.columns'] = Object.keys(columns || {}).join('');\n for (const [columnName, columnMetadata] of Object.entries(columns || {})) {\n const field = schema.fields.find((field) => field.name === columnName);\n if (field) {\n if (field.name === primary_column) {\n setFieldMetadata(field, 'geo.primary_field', 'true');\n }\n unpackGeoFieldMetadata(field, columnMetadata);\n }\n }\n}\n// eslint-disable-next-line complexity\nfunction unpackGeoFieldMetadata(field, columnMetadata) {\n for (const [key, value] of Object.entries(columnMetadata || {})) {\n switch (key) {\n case 'geometry_types':\n setFieldMetadata(field, `geo.${key}`, value.join(','));\n break;\n case 'bbox':\n setFieldMetadata(field, `geo.crs.${key}`, JSON.stringify(value));\n break;\n case 'crs':\n // @ts-ignore\n for (const [crsKey, crsValue] of Object.entries(value || {})) {\n switch (crsKey) {\n case 'id':\n // prettier-ignore\n const crsId = typeof crsValue === 'object'\n ? // @ts-ignore\n `${crsValue?.authority}:${crsValue?.code}`\n : JSON.stringify(crsValue);\n setFieldMetadata(field, `geo.crs.${crsKey}`, crsId);\n break;\n default:\n setFieldMetadata(field, `geo.crs.${crsKey}`, typeof crsValue === 'string' ? crsValue : JSON.stringify(crsValue));\n break;\n }\n }\n break;\n case 'edges':\n default:\n setFieldMetadata(field, `geo.${key}`, typeof value === 'string' ? value : JSON.stringify(value));\n }\n }\n}\nfunction setFieldMetadata(field, key, value) {\n field.metadata = field.metadata || {};\n field.metadata[key] = value;\n}\n// HELPERS\n/** Parse a key with stringified arrow metadata */\nexport function parseJSONStringMetadata(schema, metadataKey) {\n const stringifiedMetadata = schema.metadata[metadataKey];\n if (!stringifiedMetadata) {\n return null;\n }\n try {\n const metadata = JSON.parse(stringifiedMetadata);\n if (!metadata || typeof metadata !== 'object') {\n return null;\n }\n return metadata;\n }\n catch {\n return null;\n }\n}\nexport function unpackJSONStringMetadata(schema, metadataKey) {\n const json = parseJSONStringMetadata(schema, metadataKey);\n for (const [key, value] of Object.entries(json || {})) {\n schema.metadata[`${metadataKey}.${key}`] =\n typeof value === 'string' ? value : JSON.stringify(value);\n }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n/** Array containing all encodings */\nconst GEOARROW_ENCODINGS = [\n 'geoarrow.multipolygon',\n 'geoarrow.polygon',\n 'geoarrow.multilinestring',\n 'geoarrow.linestring',\n 'geoarrow.multipoint',\n 'geoarrow.point',\n 'geoarrow.wkb',\n 'geoarrow.wkt'\n];\nconst GEOARROW_COLUMN_METADATA_ENCODING = 'ARROW:extension:name';\nconst GEOARROW_COLUMN_METADATA_METADATA = 'ARROW:extension:metadata';\n/**\n * get geometry columns from arrow table\n */\nexport function getGeometryColumnsFromSchema(schema) {\n const geometryColumns = {};\n for (const field of schema.fields) {\n const metadata = getGeometryMetadataForField(field);\n if (metadata) {\n geometryColumns[field.name] = metadata;\n }\n }\n return geometryColumns;\n}\n/**\n * Extracts GeoArrow metadata from a field\n * @param field\n * @returns\n * @see https://github.com/geoarrow/geoarrow/blob/d2f56704414d9ae71e8a5170a8671343ed15eefe/extension-types.md\n */\nexport function getGeometryMetadataForField(field) {\n let metadata = null;\n // Check for GeoArrow column encoding\n let geoEncoding = field.metadata?.[GEOARROW_COLUMN_METADATA_ENCODING];\n if (geoEncoding) {\n geoEncoding = geoEncoding.toLowerCase();\n // at time of testing, ogr2ogr uses WKB/WKT for encoding.\n if (geoEncoding === 'wkb') {\n geoEncoding = 'geoarrow.wkb';\n }\n if (geoEncoding === 'wkt') {\n geoEncoding = 'geoarrow.wkt';\n }\n if (!GEOARROW_ENCODINGS.includes(geoEncoding)) {\n // eslint-disable-next-line no-console\n console.warn(`Invalid GeoArrow encoding: ${geoEncoding}`);\n }\n else {\n metadata = metadata || {};\n metadata.encoding = geoEncoding;\n }\n }\n // Check for GeoArrow metadata\n const columnMetadata = field.metadata?.[GEOARROW_COLUMN_METADATA_METADATA];\n if (columnMetadata) {\n try {\n metadata = JSON.parse(columnMetadata);\n }\n catch (error) {\n // eslint-disable-next-line no-console\n console.warn('Failed to parse GeoArrow metadata', error);\n }\n }\n return metadata || null;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { getTableLength, getTableRowAsObject } from '@loaders.gl/schema';\nimport { getGeoMetadata } from \"../geo/geoparquet-metadata.js\";\n/** TODO - move to loaders.gl/gis? */\nexport function convertWKBTableToGeoJSON(table, schema, loaders) {\n const geoMetadata = getGeoMetadata(schema);\n const primaryColumn = geoMetadata?.primary_column;\n if (!primaryColumn) {\n throw new Error('no geometry column');\n }\n const columnMetadata = geoMetadata.columns[primaryColumn];\n const features = [];\n const length = getTableLength(table);\n for (let rowIndex = 0; rowIndex < length; rowIndex++) {\n const row = getTableRowAsObject(table, rowIndex);\n const geometry = parseGeometry(row[primaryColumn], columnMetadata, loaders);\n delete row[primaryColumn];\n const feature = { type: 'Feature', geometry: geometry, properties: row };\n features.push(feature);\n }\n return { shape: 'geojson-table', schema, type: 'FeatureCollection', features };\n}\nfunction parseGeometry(geometry, columnMetadata, loaders) {\n switch (columnMetadata.encoding) {\n case 'wkt':\n const wktLoader = loaders.find((loader) => loader.id === 'wkt');\n return wktLoader?.parseTextSync?.(geometry) || null;\n case 'wkb':\n default:\n const wkbLoader = loaders.find((loader) => loader.id === 'wkb');\n const arrayBuffer = ArrayBuffer.isView(geometry)\n ? geometry.buffer.slice(geometry.byteOffset, geometry.byteOffset + geometry.byteLength)\n : geometry;\n const geojson = wkbLoader?.parseSync?.(arrayBuffer, {\n wkb: { shape: 'geojson-geometry' }\n });\n return geojson; // binaryGeometry ? binaryToGeometry(binaryGeometry) : null;\n // const binaryGeometry = WKBLoader.parseSync?.(geometry);\n // ts-ignore\n // return binaryGeometry ? binaryToGeometry(binaryGeometry) : null;\n }\n}\n", "/* eslint-disable indent */\nimport { earcut } from '@math.gl/polygon';\n/**\n * Convert binary features to flat binary arrays. Similar to\n * `geojsonToBinary` helper function, except that it expects\n * a binary representation of the feature data, which enables\n * 2X-3X speed increase in parse speed, compared to using\n * geoJSON. See `binary-vector-tile/VectorTileFeature` for\n * data format detais\n *\n * @param features\n * @param geometryInfo\n * @param options\n * @returns filled arrays\n */\nexport function flatGeojsonToBinary(features, geometryInfo, options) {\n const propArrayTypes = extractNumericPropTypes(features);\n const numericPropKeys = Object.keys(propArrayTypes).filter((k) => propArrayTypes[k] !== Array);\n return fillArrays(features, {\n propArrayTypes,\n ...geometryInfo\n }, {\n numericPropKeys: (options && options.numericPropKeys) || numericPropKeys,\n PositionDataType: options ? options.PositionDataType : Float32Array,\n triangulate: options ? options.triangulate : true\n });\n}\nexport const TEST_EXPORTS = {\n extractNumericPropTypes\n};\n/**\n * Extracts properties that are always numeric\n *\n * @param features\n * @returns object with numeric types\n */\nfunction extractNumericPropTypes(features) {\n const propArrayTypes = {};\n for (const feature of features) {\n if (feature.properties) {\n for (const key in feature.properties) {\n // If property has not been seen before, or if property has been numeric\n // in all previous features, check if numeric in this feature\n // If not numeric, Array is stored to prevent rechecking in the future\n // Additionally, detects if 64 bit precision is required\n const val = feature.properties[key];\n propArrayTypes[key] = deduceArrayType(val, propArrayTypes[key]);\n }\n }\n }\n return propArrayTypes;\n}\n/**\n * Fills coordinates into pre-allocated typed arrays\n *\n * @param features\n * @param geometryInfo\n * @param options\n * @returns an accessor object with value and size keys\n */\n// eslint-disable-next-line complexity, max-statements\nfunction fillArrays(features, geometryInfo, options) {\n const { pointPositionsCount, pointFeaturesCount, linePositionsCount, linePathsCount, lineFeaturesCount, polygonPositionsCount, polygonObjectsCount, polygonRingsCount, polygonFeaturesCount, propArrayTypes, coordLength } = geometryInfo;\n const { numericPropKeys = [], PositionDataType = Float32Array, triangulate = true } = options;\n const hasGlobalId = features[0] && 'id' in features[0];\n const GlobalFeatureIdsDataType = features.length > 65535 ? Uint32Array : Uint16Array;\n const points = {\n type: 'Point',\n positions: new PositionDataType(pointPositionsCount * coordLength),\n globalFeatureIds: new GlobalFeatureIdsDataType(pointPositionsCount),\n featureIds: pointFeaturesCount > 65535\n ? new Uint32Array(pointPositionsCount)\n : new Uint16Array(pointPositionsCount),\n numericProps: {},\n properties: [],\n fields: []\n };\n const lines = {\n type: 'LineString',\n pathIndices: linePositionsCount > 65535\n ? new Uint32Array(linePathsCount + 1)\n : new Uint16Array(linePathsCount + 1),\n positions: new PositionDataType(linePositionsCount * coordLength),\n globalFeatureIds: new GlobalFeatureIdsDataType(linePositionsCount),\n featureIds: lineFeaturesCount > 65535\n ? new Uint32Array(linePositionsCount)\n : new Uint16Array(linePositionsCount),\n numericProps: {},\n properties: [],\n fields: []\n };\n const polygons = {\n type: 'Polygon',\n polygonIndices: polygonPositionsCount > 65535\n ? new Uint32Array(polygonObjectsCount + 1)\n : new Uint16Array(polygonObjectsCount + 1),\n primitivePolygonIndices: polygonPositionsCount > 65535\n ? new Uint32Array(polygonRingsCount + 1)\n : new Uint16Array(polygonRingsCount + 1),\n positions: new PositionDataType(polygonPositionsCount * coordLength),\n globalFeatureIds: new GlobalFeatureIdsDataType(polygonPositionsCount),\n featureIds: polygonFeaturesCount > 65535\n ? new Uint32Array(polygonPositionsCount)\n : new Uint16Array(polygonPositionsCount),\n numericProps: {},\n properties: [],\n fields: []\n };\n if (triangulate) {\n polygons.triangles = [];\n }\n // Instantiate numeric properties arrays; one value per vertex\n for (const object of [points, lines, polygons]) {\n for (const propName of numericPropKeys) {\n // If property has been numeric in all previous features in which the property existed, check\n // if numeric in this feature\n const T = propArrayTypes[propName];\n object.numericProps[propName] = new T(object.positions.length / coordLength);\n }\n }\n // Set last element of path/polygon indices as positions length\n lines.pathIndices[linePathsCount] = linePositionsCount;\n polygons.polygonIndices[polygonObjectsCount] = polygonPositionsCount;\n polygons.primitivePolygonIndices[polygonRingsCount] = polygonPositionsCount;\n const indexMap = {\n pointPosition: 0,\n pointFeature: 0,\n linePosition: 0,\n linePath: 0,\n lineFeature: 0,\n polygonPosition: 0,\n polygonObject: 0,\n polygonRing: 0,\n polygonFeature: 0,\n feature: 0\n };\n for (const feature of features) {\n const geometry = feature.geometry;\n const properties = feature.properties || {};\n switch (geometry.type) {\n case 'Point':\n handlePoint(geometry, points, indexMap, coordLength, properties);\n points.properties.push(keepStringProperties(properties, numericPropKeys));\n if (hasGlobalId) {\n points.fields.push({ id: feature.id });\n }\n indexMap.pointFeature++;\n break;\n case 'LineString':\n handleLineString(geometry, lines, indexMap, coordLength, properties);\n lines.properties.push(keepStringProperties(properties, numericPropKeys));\n if (hasGlobalId) {\n lines.fields.push({ id: feature.id });\n }\n indexMap.lineFeature++;\n break;\n case 'Polygon':\n handlePolygon(geometry, polygons, indexMap, coordLength, properties);\n polygons.properties.push(keepStringProperties(properties, numericPropKeys));\n if (hasGlobalId) {\n polygons.fields.push({ id: feature.id });\n }\n indexMap.polygonFeature++;\n break;\n default:\n throw new Error('Invalid geometry type');\n }\n indexMap.feature++;\n }\n // Wrap each array in an accessor object with value and size keys\n return makeAccessorObjects(points, lines, polygons, coordLength);\n}\n/**\n * Fills (Multi)Point coordinates into points object of arrays\n *\n * @param geometry\n * @param points\n * @param indexMap\n * @param coordLength\n * @param properties\n */\nfunction handlePoint(geometry, points, indexMap, coordLength, properties) {\n points.positions.set(geometry.data, indexMap.pointPosition * coordLength);\n const nPositions = geometry.data.length / coordLength;\n fillNumericProperties(points, properties, indexMap.pointPosition, nPositions);\n points.globalFeatureIds.fill(indexMap.feature, indexMap.pointPosition, indexMap.pointPosition + nPositions);\n points.featureIds.fill(indexMap.pointFeature, indexMap.pointPosition, indexMap.pointPosition + nPositions);\n indexMap.pointPosition += nPositions;\n}\n/**\n * Fills (Multi)LineString coordinates into lines object of arrays\n *\n * @param geometry\n * @param lines\n * @param indexMap\n * @param coordLength\n * @param properties\n */\nfunction handleLineString(geometry, lines, indexMap, coordLength, properties) {\n lines.positions.set(geometry.data, indexMap.linePosition * coordLength);\n const nPositions = geometry.data.length / coordLength;\n fillNumericProperties(lines, properties, indexMap.linePosition, nPositions);\n lines.globalFeatureIds.fill(indexMap.feature, indexMap.linePosition, indexMap.linePosition + nPositions);\n lines.featureIds.fill(indexMap.lineFeature, indexMap.linePosition, indexMap.linePosition + nPositions);\n for (let i = 0, il = geometry.indices.length; i < il; ++i) {\n // Extract range of data we are working with, defined by start\n // and end indices (these index into the geometry.data array)\n const start = geometry.indices[i];\n const end = i === il - 1\n ? geometry.data.length // last line, so read to end of data\n : geometry.indices[i + 1]; // start index for next line\n lines.pathIndices[indexMap.linePath++] = indexMap.linePosition;\n indexMap.linePosition += (end - start) / coordLength;\n }\n}\n/**\n * Fills (Multi)Polygon coordinates into polygons object of arrays\n *\n * @param geometry\n * @param polygons\n * @param indexMap\n * @param coordLength\n * @param properties\n */\nfunction handlePolygon(geometry, polygons, indexMap, coordLength, properties) {\n polygons.positions.set(geometry.data, indexMap.polygonPosition * coordLength);\n const nPositions = geometry.data.length / coordLength;\n fillNumericProperties(polygons, properties, indexMap.polygonPosition, nPositions);\n polygons.globalFeatureIds.fill(indexMap.feature, indexMap.polygonPosition, indexMap.polygonPosition + nPositions);\n polygons.featureIds.fill(indexMap.polygonFeature, indexMap.polygonPosition, indexMap.polygonPosition + nPositions);\n // Unlike Point & LineString geometry.indices is a 2D array\n for (let l = 0, ll = geometry.indices.length; l < ll; ++l) {\n const startPosition = indexMap.polygonPosition;\n polygons.polygonIndices[indexMap.polygonObject++] = startPosition;\n const areas = geometry.areas[l];\n const indices = geometry.indices[l];\n const nextIndices = geometry.indices[l + 1];\n for (let i = 0, il = indices.length; i < il; ++i) {\n const start = indices[i];\n const end = i === il - 1\n ? // last line, so either read to:\n nextIndices === undefined\n ? geometry.data.length // end of data (no next indices)\n : nextIndices[0] // start of first line in nextIndices\n : indices[i + 1]; // start index for next line\n polygons.primitivePolygonIndices[indexMap.polygonRing++] = indexMap.polygonPosition;\n indexMap.polygonPosition += (end - start) / coordLength;\n }\n const endPosition = indexMap.polygonPosition;\n triangulatePolygon(polygons, areas, indices, { startPosition, endPosition, coordLength });\n }\n}\n/**\n * Triangulate polygon using earcut\n *\n * @param polygons\n * @param areas\n * @param indices\n * @param param3\n */\nfunction triangulatePolygon(polygons, areas, indices, { startPosition, endPosition, coordLength }) {\n if (!polygons.triangles) {\n return;\n }\n const start = startPosition * coordLength;\n const end = endPosition * coordLength;\n // Extract positions and holes for just this polygon\n const polygonPositions = polygons.positions.subarray(start, end);\n // Holes are referenced relative to outer polygon\n const offset = indices[0];\n const holes = indices.slice(1).map((n) => (n - offset) / coordLength);\n // Compute triangulation\n const triangles = earcut(polygonPositions, holes, coordLength, areas);\n // Indices returned by triangulation are relative to start\n // of polygon, so we need to offset\n for (let t = 0, tl = triangles.length; t < tl; ++t) {\n polygons.triangles.push(startPosition + triangles[t]);\n }\n}\n/**\n * Wraps an object containing array into accessors\n *\n * @param obj\n * @param size\n */\nfunction wrapProps(obj, size) {\n const returnObj = {};\n for (const key in obj) {\n returnObj[key] = { value: obj[key], size };\n }\n return returnObj;\n}\n/**\n * Wrap each array in an accessor object with value and size keys\n *\n * @param points\n * @param lines\n * @param polygons\n * @param coordLength\n * @returns object\n */\nfunction makeAccessorObjects(points, lines, polygons, coordLength) {\n const binaryFeatures = {\n shape: 'binary-feature-collection',\n points: {\n ...points,\n positions: { value: points.positions, size: coordLength },\n globalFeatureIds: { value: points.globalFeatureIds, size: 1 },\n featureIds: { value: points.featureIds, size: 1 },\n numericProps: wrapProps(points.numericProps, 1)\n },\n lines: {\n ...lines,\n positions: { value: lines.positions, size: coordLength },\n pathIndices: { value: lines.pathIndices, size: 1 },\n globalFeatureIds: { value: lines.globalFeatureIds, size: 1 },\n featureIds: { value: lines.featureIds, size: 1 },\n numericProps: wrapProps(lines.numericProps, 1)\n },\n polygons: {\n ...polygons,\n positions: { value: polygons.positions, size: coordLength },\n polygonIndices: { value: polygons.polygonIndices, size: 1 },\n primitivePolygonIndices: { value: polygons.primitivePolygonIndices, size: 1 },\n globalFeatureIds: { value: polygons.globalFeatureIds, size: 1 },\n featureIds: { value: polygons.featureIds, size: 1 },\n numericProps: wrapProps(polygons.numericProps, 1)\n } // triangles not expected\n };\n if (binaryFeatures.polygons && polygons.triangles) {\n binaryFeatures.polygons.triangles = { value: new Uint32Array(polygons.triangles), size: 1 };\n }\n return binaryFeatures;\n}\n/**\n * Add numeric properties to object\n *\n * @param object\n * @param properties\n * @param index\n * @param length\n */\nfunction fillNumericProperties(object, properties, index, length) {\n for (const numericPropName in object.numericProps) {\n if (numericPropName in properties) {\n const value = properties[numericPropName];\n object.numericProps[numericPropName].fill(value, index, index + length);\n }\n }\n}\n/**\n * Keep string properties in object\n *\n * @param properties\n * @param numericKeys\n * @returns object\n */\nfunction keepStringProperties(properties, numericKeys) {\n const props = {};\n for (const key in properties) {\n if (!numericKeys.includes(key)) {\n props[key] = properties[key];\n }\n }\n return props;\n}\n/**\n *\n * Deduce correct array constructor to use for a given value\n *\n * @param x value to test\n * @param constructor previous constructor deduced\n * @returns PropArrayConstructor\n */\nfunction deduceArrayType(x, constructor) {\n if (constructor === Array || !Number.isFinite(x)) {\n return Array;\n }\n // If this or previous value required 64bits use Float64Array\n return constructor === Float64Array || Math.fround(x) !== x ? Float64Array : Float32Array;\n}\n", "/**\n * Initial scan over GeoJSON features\n * Counts number of coordinates of each geometry type and\n * keeps track of the max coordinate dimensions\n */\n// eslint-disable-next-line complexity, max-statements\nexport function extractGeometryInfo(features) {\n // Counts the number of _positions_, so [x, y, z] counts as one\n let pointPositionsCount = 0;\n let pointFeaturesCount = 0;\n let linePositionsCount = 0;\n let linePathsCount = 0;\n let lineFeaturesCount = 0;\n let polygonPositionsCount = 0;\n let polygonObjectsCount = 0;\n let polygonRingsCount = 0;\n let polygonFeaturesCount = 0;\n const coordLengths = new Set();\n for (const feature of features) {\n const geometry = feature.geometry;\n switch (geometry.type) {\n case 'Point':\n pointFeaturesCount++;\n pointPositionsCount++;\n coordLengths.add(geometry.coordinates.length);\n break;\n case 'MultiPoint':\n pointFeaturesCount++;\n pointPositionsCount += geometry.coordinates.length;\n for (const point of geometry.coordinates) {\n coordLengths.add(point.length);\n }\n break;\n case 'LineString':\n lineFeaturesCount++;\n linePositionsCount += geometry.coordinates.length;\n linePathsCount++;\n for (const coord of geometry.coordinates) {\n coordLengths.add(coord.length);\n }\n break;\n case 'MultiLineString':\n lineFeaturesCount++;\n for (const line of geometry.coordinates) {\n linePositionsCount += line.length;\n linePathsCount++;\n // eslint-disable-next-line max-depth\n for (const coord of line) {\n coordLengths.add(coord.length);\n }\n }\n break;\n case 'Polygon':\n polygonFeaturesCount++;\n polygonObjectsCount++;\n polygonRingsCount += geometry.coordinates.length;\n const flattened = geometry.coordinates.flat();\n polygonPositionsCount += flattened.length;\n for (const coord of flattened) {\n coordLengths.add(coord.length);\n }\n break;\n case 'MultiPolygon':\n polygonFeaturesCount++;\n for (const polygon of geometry.coordinates) {\n polygonObjectsCount++;\n polygonRingsCount += polygon.length;\n const flattened = polygon.flat();\n polygonPositionsCount += flattened.length;\n // eslint-disable-next-line max-depth\n for (const coord of flattened) {\n coordLengths.add(coord.length);\n }\n }\n break;\n default:\n throw new Error(`Unsupported geometry type: ${geometry.type}`);\n }\n }\n return {\n coordLength: coordLengths.size > 0 ? Math.max(...coordLengths) : 2,\n pointPositionsCount,\n pointFeaturesCount,\n linePositionsCount,\n linePathsCount,\n lineFeaturesCount,\n polygonPositionsCount,\n polygonObjectsCount,\n polygonRingsCount,\n polygonFeaturesCount\n };\n}\n", "import { getPolygonSignedArea } from '@math.gl/polygon';\n/**\n * Convert GeoJSON features to Flat GeoJSON features\n *\n * @param features\n * @param options\n * @returns an Array of Flat GeoJSON features\n */\nexport function geojsonToFlatGeojson(features, options = { coordLength: 2, fixRingWinding: true }) {\n return features.map((feature) => flattenFeature(feature, options));\n}\n/**\n * Helper function to copy Point values from `coordinates` into `data` & `indices`\n *\n * @param coordinates\n * @param data\n * @param indices\n * @param options\n */\nfunction flattenPoint(coordinates, data, indices, options) {\n indices.push(data.length);\n data.push(...coordinates);\n // Pad up to coordLength\n for (let i = coordinates.length; i < options.coordLength; i++) {\n data.push(0);\n }\n}\n/**\n * Helper function to copy LineString values from `coordinates` into `data` & `indices`\n *\n * @param coordinates\n * @param data\n * @param indices\n * @param options\n */\nfunction flattenLineString(coordinates, data, indices, options) {\n indices.push(data.length);\n for (const c of coordinates) {\n data.push(...c);\n // Pad up to coordLength\n for (let i = c.length; i < options.coordLength; i++) {\n data.push(0);\n }\n }\n}\n/**\n * Helper function to copy Polygon values from `coordinates` into `data` & `indices` & `areas`\n *\n * @param coordinates\n * @param data\n * @param indices\n * @param areas\n * @param options\n */\nfunction flattenPolygon(coordinates, data, indices, areas, options) {\n let count = 0;\n const ringAreas = [];\n const polygons = [];\n for (const lineString of coordinates) {\n const lineString2d = lineString.map((p) => p.slice(0, 2));\n let area = getPolygonSignedArea(lineString2d.flat());\n const ccw = area < 0;\n // Exterior ring must be CCW and interior rings CW\n if (options.fixRingWinding && ((count === 0 && !ccw) || (count > 0 && ccw))) {\n lineString.reverse();\n area = -area;\n }\n ringAreas.push(area);\n flattenLineString(lineString, data, polygons, options);\n count++;\n }\n if (count > 0) {\n areas.push(ringAreas);\n indices.push(polygons);\n }\n}\n/**\n * Flatten single GeoJSON feature into Flat GeoJSON\n *\n * @param feature\n * @param options\n * @returns A Flat GeoJSON feature\n */\nfunction flattenFeature(feature, options) {\n const { geometry } = feature;\n if (geometry.type === 'GeometryCollection') {\n throw new Error('GeometryCollection type not supported');\n }\n const data = [];\n const indices = [];\n let areas;\n let type;\n switch (geometry.type) {\n case 'Point':\n type = 'Point';\n flattenPoint(geometry.coordinates, data, indices, options);\n break;\n case 'MultiPoint':\n type = 'Point';\n geometry.coordinates.map((c) => flattenPoint(c, data, indices, options));\n break;\n case 'LineString':\n type = 'LineString';\n flattenLineString(geometry.coordinates, data, indices, options);\n break;\n case 'MultiLineString':\n type = 'LineString';\n geometry.coordinates.map((c) => flattenLineString(c, data, indices, options));\n break;\n case 'Polygon':\n type = 'Polygon';\n areas = [];\n flattenPolygon(geometry.coordinates, data, indices, areas, options);\n break;\n case 'MultiPolygon':\n type = 'Polygon';\n areas = [];\n geometry.coordinates.map((c) => flattenPolygon(c, data, indices, areas, options));\n break;\n default:\n throw new Error(`Unknown type: ${type}`);\n }\n return { ...feature, geometry: { type, indices, data, areas } };\n}\n", "import { extractGeometryInfo } from \"./extract-geometry-info.js\";\nimport { geojsonToFlatGeojson } from \"./geojson-to-flat-geojson.js\";\nimport { flatGeojsonToBinary } from \"./flat-geojson-to-binary.js\";\n/**\n * Convert GeoJSON features to flat binary arrays\n *\n * @param features\n * @param options\n * @returns features in binary format, grouped by geometry type\n */\nexport function geojsonToBinary(features, options = { fixRingWinding: true, triangulate: true }) {\n const geometryInfo = extractGeometryInfo(features);\n const coordLength = geometryInfo.coordLength;\n const { fixRingWinding } = options;\n const flatFeatures = geojsonToFlatGeojson(features, { coordLength, fixRingWinding });\n return flatGeojsonToBinary(flatFeatures, geometryInfo, {\n numericPropKeys: options.numericPropKeys,\n PositionDataType: options.PositionDataType || Float32Array,\n triangulate: options.triangulate\n });\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n/**\n * Convert binary geometry representation to GeoJSON\n * @param data geometry data in binary representation\n * @param options\n * @param options.type Input data type: Point, LineString, or Polygon\n * @param options.featureId Global feature id. If specified, only a single feature is extracted\n * @return GeoJSON objects\n */\nexport function binaryToGeojson(data, options) {\n const globalFeatureId = options?.globalFeatureId;\n if (globalFeatureId !== undefined) {\n return getSingleFeature(data, globalFeatureId);\n }\n return parseFeatures(data, options?.type);\n}\n/**\n * Return a single feature from a binary geometry representation as GeoJSON\n * @param data geometry data in binary representation\n * @return GeoJSON feature\n */\nfunction getSingleFeature(data, globalFeatureId) {\n const dataArray = normalizeInput(data);\n for (const data of dataArray) {\n let lastIndex = 0;\n let lastValue = data.featureIds.value[0];\n // Scan through data until we find matching feature\n for (let i = 0; i < data.featureIds.value.length; i++) {\n const currValue = data.featureIds.value[i];\n if (currValue === lastValue) {\n // eslint-disable-next-line no-continue\n continue;\n }\n if (globalFeatureId === data.globalFeatureIds.value[lastIndex]) {\n return parseFeature(data, lastIndex, i);\n }\n lastIndex = i;\n lastValue = currValue;\n }\n if (globalFeatureId === data.globalFeatureIds.value[lastIndex]) {\n return parseFeature(data, lastIndex, data.featureIds.value.length);\n }\n }\n throw new Error(`featureId:${globalFeatureId} not found`);\n}\nfunction parseFeatures(data, type) {\n const dataArray = normalizeInput(data, type);\n return parseFeatureCollection(dataArray);\n}\n/** Parse input binary data and return a valid GeoJSON geometry object */\nexport function binaryToGeometry(data, startIndex, endIndex) {\n switch (data.type) {\n case 'Point':\n return pointToGeoJson(data, startIndex, endIndex);\n case 'LineString':\n return lineStringToGeoJson(data, startIndex, endIndex);\n case 'Polygon':\n return polygonToGeoJson(data, startIndex, endIndex);\n default:\n const unexpectedInput = data;\n throw new Error(`Unsupported geometry type: ${unexpectedInput?.type}`);\n }\n}\n// Normalize features\n// Return an array of data objects, each of which have a type key\nfunction normalizeInput(data, type) {\n const features = [];\n if (data.points) {\n data.points.type = 'Point';\n features.push(data.points);\n }\n if (data.lines) {\n data.lines.type = 'LineString';\n features.push(data.lines);\n }\n if (data.polygons) {\n data.polygons.type = 'Polygon';\n features.push(data.polygons);\n }\n return features;\n}\n/** Parse input binary data and return an array of GeoJSON Features */\nfunction parseFeatureCollection(dataArray) {\n const features = [];\n for (const data of dataArray) {\n if (data.featureIds.value.length === 0) {\n // eslint-disable-next-line no-continue\n continue;\n }\n let lastIndex = 0;\n let lastValue = data.featureIds.value[0];\n // Need to deduce start, end indices of each feature\n for (let i = 0; i < data.featureIds.value.length; i++) {\n const currValue = data.featureIds.value[i];\n if (currValue === lastValue) {\n // eslint-disable-next-line no-continue\n continue;\n }\n features.push(parseFeature(data, lastIndex, i));\n lastIndex = i;\n lastValue = currValue;\n }\n // Last feature\n features.push(parseFeature(data, lastIndex, data.featureIds.value.length));\n }\n return features;\n}\n/** Parse input binary data and return a single GeoJSON Feature */\nfunction parseFeature(data, startIndex, endIndex) {\n const geometry = binaryToGeometry(data, startIndex, endIndex);\n const properties = parseProperties(data, startIndex, endIndex);\n const fields = parseFields(data, startIndex, endIndex);\n return { type: 'Feature', geometry, properties, ...fields };\n}\n/** Parse input binary data and return an object of fields */\nfunction parseFields(data, startIndex = 0, endIndex) {\n return data.fields && data.fields[data.featureIds.value[startIndex]];\n}\n/** Parse input binary data and return an object of properties */\nfunction parseProperties(data, startIndex = 0, endIndex) {\n const properties = Object.assign({}, data.properties[data.featureIds.value[startIndex]]);\n for (const key in data.numericProps) {\n properties[key] = data.numericProps[key].value[startIndex];\n }\n return properties;\n}\n/** Parse binary data of type Polygon */\nfunction polygonToGeoJson(data, startIndex = -Infinity, endIndex = Infinity) {\n const { positions } = data;\n const polygonIndices = data.polygonIndices.value.filter((x) => x >= startIndex && x <= endIndex);\n const primitivePolygonIndices = data.primitivePolygonIndices.value.filter((x) => x >= startIndex && x <= endIndex);\n const multi = polygonIndices.length > 2;\n // Polygon\n if (!multi) {\n const coordinates = [];\n for (let i = 0; i < primitivePolygonIndices.length - 1; i++) {\n const startRingIndex = primitivePolygonIndices[i];\n const endRingIndex = primitivePolygonIndices[i + 1];\n const ringCoordinates = ringToGeoJson(positions, startRingIndex, endRingIndex);\n coordinates.push(ringCoordinates);\n }\n return { type: 'Polygon', coordinates };\n }\n // MultiPolygon\n const coordinates = [];\n for (let i = 0; i < polygonIndices.length - 1; i++) {\n const startPolygonIndex = polygonIndices[i];\n const endPolygonIndex = polygonIndices[i + 1];\n const polygonCoordinates = polygonToGeoJson(data, startPolygonIndex, endPolygonIndex).coordinates;\n coordinates.push(polygonCoordinates);\n }\n return { type: 'MultiPolygon', coordinates };\n}\n/** Parse binary data of type LineString */\nfunction lineStringToGeoJson(data, startIndex = -Infinity, endIndex = Infinity) {\n const { positions } = data;\n const pathIndices = data.pathIndices.value.filter((x) => x >= startIndex && x <= endIndex);\n const multi = pathIndices.length > 2;\n if (!multi) {\n const coordinates = ringToGeoJson(positions, pathIndices[0], pathIndices[1]);\n return { type: 'LineString', coordinates };\n }\n const coordinates = [];\n for (let i = 0; i < pathIndices.length - 1; i++) {\n const ringCoordinates = ringToGeoJson(positions, pathIndices[i], pathIndices[i + 1]);\n coordinates.push(ringCoordinates);\n }\n return { type: 'MultiLineString', coordinates };\n}\n/** Parse binary data of type Point */\nfunction pointToGeoJson(data, startIndex, endIndex) {\n const { positions } = data;\n const coordinates = ringToGeoJson(positions, startIndex, endIndex);\n const multi = coordinates.length > 1;\n if (multi) {\n return { type: 'MultiPoint', coordinates };\n }\n return { type: 'Point', coordinates: coordinates[0] };\n}\n/**\n * Parse a linear ring of positions to a GeoJSON linear ring\n *\n * @param positions Positions TypedArray\n * @param startIndex Start index to include in ring\n * @param endIndex End index to include in ring\n * @returns GeoJSON ring\n */\nfunction ringToGeoJson(positions, startIndex, endIndex) {\n startIndex = startIndex || 0;\n endIndex = endIndex || positions.value.length / positions.size;\n const ringCoordinates = [];\n for (let j = startIndex; j < endIndex; j++) {\n const coord = Array();\n for (let k = j * positions.size; k < (j + 1) * positions.size; k++) {\n coord.push(Number(positions.value[k]));\n }\n ringCoordinates.push(coord);\n }\n return ringCoordinates;\n}\n", "/**\n * Apply transformation to every coordinate of binary features\n * @param binaryFeatures binary features\n * @param transformCoordinate Function to call on each coordinate\n * @return Transformed binary features\n */\nexport function transformBinaryCoords(binaryFeatures, transformCoordinate) {\n if (binaryFeatures.points) {\n transformBinaryGeometryPositions(binaryFeatures.points, transformCoordinate);\n }\n if (binaryFeatures.lines) {\n transformBinaryGeometryPositions(binaryFeatures.lines, transformCoordinate);\n }\n if (binaryFeatures.polygons) {\n transformBinaryGeometryPositions(binaryFeatures.polygons, transformCoordinate);\n }\n return binaryFeatures;\n}\n/** Transform one binary geometry */\nfunction transformBinaryGeometryPositions(binaryGeometry, fn) {\n const { positions } = binaryGeometry;\n for (let i = 0; i < positions.value.length; i += positions.size) {\n // @ts-ignore inclusion of bigint causes problems\n const coord = Array.from(positions.value.subarray(i, i + positions.size));\n const transformedCoord = fn(coord);\n // @ts-ignore typescript typing for .set seems to require bigint?\n positions.value.set(transformedCoord, i);\n }\n}\n/**\n * Apply transformation to every coordinate of GeoJSON features\n *\n * @param features Array of GeoJSON features\n * @param fn Function to call on each coordinate\n * @return Transformed GeoJSON features\n */\nexport function transformGeoJsonCoords(features, fn) {\n for (const feature of features) {\n // @ts-ignore\n feature.geometry.coordinates = coordMap(feature.geometry.coordinates, fn);\n }\n return features;\n}\nfunction coordMap(array, fn) {\n if (isCoord(array)) {\n return fn(array);\n }\n return array.map((item) => {\n return coordMap(item, fn);\n });\n}\nfunction isCoord(array) {\n return Array.isArray(array) && Number.isFinite(array[0]) && Number.isFinite(array[1]);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACSO,IAAM,kCAAkC;AAAA,EAC3C,SAAS;AAAA,EACT,OAAO;AAAA,EACP,aAAa;AAAA,EACb,MAAM;AAAA,EACN,UAAU,CAAC,WAAW,kBAAkB,SAAS;AAAA,EACjD,YAAY;AAAA,IACR,SAAS,EAAE,MAAM,UAAU,OAAO,eAAe;AAAA,IACjD,gBAAgB,EAAE,MAAM,UAAU,WAAW,EAAE;AAAA,IAC/C,SAAS;AAAA,MACL,MAAM;AAAA,MACN,eAAe;AAAA,MACf,mBAAmB;AAAA,QACf,MAAM;AAAA,UACF,MAAM;AAAA,UACN,UAAU,CAAC,YAAY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MAAM,CAAC,CAAC;AACxF;",
6
+ "names": ["field", "flattened", "import_polygon", "data", "coordinates"]
7
+ }
package/dist/index.d.ts CHANGED
@@ -1,13 +1,13 @@
1
- export { GEOPARQUET_METADATA_JSON_SCHEMA } from './lib/geo/geoparquet-metadata-schema';
2
- export type { GeoMetadata } from './lib/geo/geoparquet-metadata';
3
- export { getGeoMetadata, setGeoMetadata, unpackGeoMetadata } from './lib/geo/geoparquet-metadata';
4
- export { unpackJSONStringMetadata } from './lib/geo/geoparquet-metadata';
5
- export type { GeoArrowEncoding, GeoArrowMetadata } from './lib/geo/geoarrow-metadata';
6
- export { getGeometryColumnsFromSchema } from './lib/geo/geoarrow-metadata';
7
- export { convertWKBTableToGeoJSON } from './lib/tables/convert-table-to-geojson';
8
- export { flatGeojsonToBinary } from './lib/binary-features/flat-geojson-to-binary';
9
- export { geojsonToBinary } from './lib/binary-features/geojson-to-binary';
10
- export { geojsonToFlatGeojson } from './lib/binary-features/geojson-to-flat-geojson';
11
- export { binaryToGeojson, binaryToGeometry } from './lib/binary-features/binary-to-geojson';
12
- export { transformBinaryCoords, transformGeoJsonCoords } from './lib/binary-features/transform';
1
+ export { GEOPARQUET_METADATA_JSON_SCHEMA } from "./lib/geo/geoparquet-metadata-schema.js";
2
+ export type { GeoMetadata } from "./lib/geo/geoparquet-metadata.js";
3
+ export { getGeoMetadata, setGeoMetadata, unpackGeoMetadata } from "./lib/geo/geoparquet-metadata.js";
4
+ export { unpackJSONStringMetadata } from "./lib/geo/geoparquet-metadata.js";
5
+ export type { GeoArrowEncoding, GeoArrowMetadata } from "./lib/geo/geoarrow-metadata.js";
6
+ export { getGeometryColumnsFromSchema } from "./lib/geo/geoarrow-metadata.js";
7
+ export { convertWKBTableToGeoJSON } from "./lib/tables/convert-table-to-geojson.js";
8
+ export { flatGeojsonToBinary } from "./lib/binary-features/flat-geojson-to-binary.js";
9
+ export { geojsonToBinary } from "./lib/binary-features/geojson-to-binary.js";
10
+ export { geojsonToFlatGeojson } from "./lib/binary-features/geojson-to-flat-geojson.js";
11
+ export { binaryToGeojson, binaryToGeometry } from "./lib/binary-features/binary-to-geojson.js";
12
+ export { transformBinaryCoords, transformGeoJsonCoords } from "./lib/binary-features/transform.js";
13
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAC,+BAA+B,EAAC,MAAM,sCAAsC,CAAC;AAErF,YAAY,EAAC,WAAW,EAAC,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAC,cAAc,EAAE,cAAc,EAAE,iBAAiB,EAAC,MAAM,+BAA+B,CAAC;AAChG,OAAO,EAAC,wBAAwB,EAAC,MAAM,+BAA+B,CAAC;AAEvE,YAAY,EAAC,gBAAgB,EAAE,gBAAgB,EAAC,MAAM,6BAA6B,CAAC;AACpF,OAAO,EAAC,4BAA4B,EAAC,MAAM,6BAA6B,CAAC;AAGzE,OAAO,EAAC,wBAAwB,EAAC,MAAM,uCAAuC,CAAC;AAG/E,OAAO,EAAC,mBAAmB,EAAC,MAAM,8CAA8C,CAAC;AACjF,OAAO,EAAC,eAAe,EAAC,MAAM,yCAAyC,CAAC;AACxE,OAAO,EAAC,oBAAoB,EAAC,MAAM,+CAA+C,CAAC;AACnF,OAAO,EAAC,eAAe,EAAE,gBAAgB,EAAC,MAAM,yCAAyC,CAAC;AAC1F,OAAO,EAAC,qBAAqB,EAAE,sBAAsB,EAAC,MAAM,iCAAiC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAC,+BAA+B,EAAC,gDAA6C;AAErF,YAAY,EAAC,WAAW,EAAC,yCAAsC;AAC/D,OAAO,EAAC,cAAc,EAAE,cAAc,EAAE,iBAAiB,EAAC,yCAAsC;AAChG,OAAO,EAAC,wBAAwB,EAAC,yCAAsC;AAEvE,YAAY,EAAC,gBAAgB,EAAE,gBAAgB,EAAC,uCAAoC;AACpF,OAAO,EAAC,4BAA4B,EAAC,uCAAoC;AAGzE,OAAO,EAAC,wBAAwB,EAAC,iDAA8C;AAG/E,OAAO,EAAC,mBAAmB,EAAC,wDAAqD;AACjF,OAAO,EAAC,eAAe,EAAC,mDAAgD;AACxE,OAAO,EAAC,oBAAoB,EAAC,yDAAsD;AACnF,OAAO,EAAC,eAAe,EAAE,gBAAgB,EAAC,mDAAgD;AAC1F,OAAO,EAAC,qBAAqB,EAAE,sBAAsB,EAAC,2CAAwC"}
package/dist/index.js CHANGED
@@ -1,11 +1,16 @@
1
+ // Types from `@loaders.gl/schema`
2
+ // Geo Metadata
3
+ // import {default as GEOPARQUET_METADATA_SCHEMA} from './lib/geo/geoparquet-metadata-schema.json';
4
+ // export {GEOPARQUET_METADATA_SCHEMA};
1
5
  export { GEOPARQUET_METADATA_JSON_SCHEMA } from "./lib/geo/geoparquet-metadata-schema.js";
2
6
  export { getGeoMetadata, setGeoMetadata, unpackGeoMetadata } from "./lib/geo/geoparquet-metadata.js";
3
7
  export { unpackJSONStringMetadata } from "./lib/geo/geoparquet-metadata.js";
4
8
  export { getGeometryColumnsFromSchema } from "./lib/geo/geoarrow-metadata.js";
9
+ // Table conversion
5
10
  export { convertWKBTableToGeoJSON } from "./lib/tables/convert-table-to-geojson.js";
11
+ // Binary Geometries
6
12
  export { flatGeojsonToBinary } from "./lib/binary-features/flat-geojson-to-binary.js";
7
13
  export { geojsonToBinary } from "./lib/binary-features/geojson-to-binary.js";
8
14
  export { geojsonToFlatGeojson } from "./lib/binary-features/geojson-to-flat-geojson.js";
9
15
  export { binaryToGeojson, binaryToGeometry } from "./lib/binary-features/binary-to-geojson.js";
10
16
  export { transformBinaryCoords, transformGeoJsonCoords } from "./lib/binary-features/transform.js";
11
- //# sourceMappingURL=index.js.map