@sqlrooms/deck 0.29.0-rc.2

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 (86) hide show
  1. package/README.md +357 -0
  2. package/dist/ColorScaleLegend.d.ts +8 -0
  3. package/dist/ColorScaleLegend.d.ts.map +1 -0
  4. package/dist/ColorScaleLegend.js +11 -0
  5. package/dist/ColorScaleLegend.js.map +1 -0
  6. package/dist/DeckMap.d.ts +4 -0
  7. package/dist/DeckMap.d.ts.map +1 -0
  8. package/dist/DeckMap.js +157 -0
  9. package/dist/DeckMap.js.map +1 -0
  10. package/dist/datasets/normalizeDatasets.d.ts +5 -0
  11. package/dist/datasets/normalizeDatasets.d.ts.map +1 -0
  12. package/dist/datasets/normalizeDatasets.js +57 -0
  13. package/dist/datasets/normalizeDatasets.js.map +1 -0
  14. package/dist/datasets/usePreparedDeckDatasets.d.ts +3 -0
  15. package/dist/datasets/usePreparedDeckDatasets.d.ts.map +1 -0
  16. package/dist/datasets/usePreparedDeckDatasets.js +61 -0
  17. package/dist/datasets/usePreparedDeckDatasets.js.map +1 -0
  18. package/dist/index.d.ts +11 -0
  19. package/dist/index.d.ts.map +1 -0
  20. package/dist/index.js +9 -0
  21. package/dist/index.js.map +1 -0
  22. package/dist/json/compileColorScale.d.ts +35 -0
  23. package/dist/json/compileColorScale.d.ts.map +1 -0
  24. package/dist/json/compileColorScale.js +527 -0
  25. package/dist/json/compileColorScale.js.map +1 -0
  26. package/dist/json/compileGeoArrowAccessor.d.ts +11 -0
  27. package/dist/json/compileGeoArrowAccessor.d.ts.map +1 -0
  28. package/dist/json/compileGeoArrowAccessor.js +74 -0
  29. package/dist/json/compileGeoArrowAccessor.js.map +1 -0
  30. package/dist/json/createDeckJsonConfiguration.d.ts +9 -0
  31. package/dist/json/createDeckJsonConfiguration.d.ts.map +1 -0
  32. package/dist/json/createDeckJsonConfiguration.js +112 -0
  33. package/dist/json/createDeckJsonConfiguration.js.map +1 -0
  34. package/dist/json/defaultClasses.d.ts +24 -0
  35. package/dist/json/defaultClasses.d.ts.map +1 -0
  36. package/dist/json/defaultClasses.js +21 -0
  37. package/dist/json/defaultClasses.js.map +1 -0
  38. package/dist/json/extractColorScaleLegends.d.ts +8 -0
  39. package/dist/json/extractColorScaleLegends.d.ts.map +1 -0
  40. package/dist/json/extractColorScaleLegends.js +48 -0
  41. package/dist/json/extractColorScaleLegends.js.map +1 -0
  42. package/dist/json/layerCompatibility.d.ts +15 -0
  43. package/dist/json/layerCompatibility.d.ts.map +1 -0
  44. package/dist/json/layerCompatibility.js +38 -0
  45. package/dist/json/layerCompatibility.js.map +1 -0
  46. package/dist/json/layerConfig.d.ts +10 -0
  47. package/dist/json/layerConfig.d.ts.map +1 -0
  48. package/dist/json/layerConfig.js +43 -0
  49. package/dist/json/layerConfig.js.map +1 -0
  50. package/dist/json/rewriteGeoArrowAccessors.d.ts +7 -0
  51. package/dist/json/rewriteGeoArrowAccessors.d.ts.map +1 -0
  52. package/dist/json/rewriteGeoArrowAccessors.js +53 -0
  53. package/dist/json/rewriteGeoArrowAccessors.js.map +1 -0
  54. package/dist/prepare/detectGeometryColumn.d.ts +10 -0
  55. package/dist/prepare/detectGeometryColumn.d.ts.map +1 -0
  56. package/dist/prepare/detectGeometryColumn.js +84 -0
  57. package/dist/prepare/detectGeometryColumn.js.map +1 -0
  58. package/dist/prepare/geoarrow.d.ts +18 -0
  59. package/dist/prepare/geoarrow.d.ts.map +1 -0
  60. package/dist/prepare/geoarrow.js +114 -0
  61. package/dist/prepare/geoarrow.js.map +1 -0
  62. package/dist/prepare/geometryDecoder.d.ts +9 -0
  63. package/dist/prepare/geometryDecoder.d.ts.map +1 -0
  64. package/dist/prepare/geometryDecoder.js +2 -0
  65. package/dist/prepare/geometryDecoder.js.map +1 -0
  66. package/dist/prepare/prepareDeckDataset.d.ts +11 -0
  67. package/dist/prepare/prepareDeckDataset.d.ts.map +1 -0
  68. package/dist/prepare/prepareDeckDataset.js +66 -0
  69. package/dist/prepare/prepareDeckDataset.js.map +1 -0
  70. package/dist/prepare/toGeoJsonBinary.d.ts +9 -0
  71. package/dist/prepare/toGeoJsonBinary.d.ts.map +1 -0
  72. package/dist/prepare/toGeoJsonBinary.js +25 -0
  73. package/dist/prepare/toGeoJsonBinary.js.map +1 -0
  74. package/dist/prepare/types.d.ts +25 -0
  75. package/dist/prepare/types.d.ts.map +1 -0
  76. package/dist/prepare/types.js +2 -0
  77. package/dist/prepare/types.js.map +1 -0
  78. package/dist/prepare/wkbDecoder.d.ts +3 -0
  79. package/dist/prepare/wkbDecoder.d.ts.map +1 -0
  80. package/dist/prepare/wkbDecoder.js +106 -0
  81. package/dist/prepare/wkbDecoder.js.map +1 -0
  82. package/dist/types.d.ts +115 -0
  83. package/dist/types.d.ts.map +1 -0
  84. package/dist/types.js +2 -0
  85. package/dist/types.js.map +1 -0
  86. package/package.json +62 -0
@@ -0,0 +1,7 @@
1
+ import * as arrow from 'apache-arrow';
2
+ export declare function rewriteGeoArrowAccessors(options: {
3
+ props: Record<string, unknown>;
4
+ table: arrow.Table;
5
+ layerName: string;
6
+ }): Record<string, unknown>;
7
+ //# sourceMappingURL=rewriteGeoArrowAccessors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rewriteGeoArrowAccessors.d.ts","sourceRoot":"","sources":["../../src/json/rewriteGeoArrowAccessors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AA2BtC,wBAAgB,wBAAwB,CAAC,OAAO,EAAE;IAChD,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB,2BAsCA"}
@@ -0,0 +1,53 @@
1
+ import * as arrow from 'apache-arrow';
2
+ import { compileGeoArrowAccessor } from './compileGeoArrowAccessor';
3
+ import { getLayerCompatibility } from './layerCompatibility';
4
+ function isSimpleColumnReference(expression) {
5
+ return /^[A-Za-z_$][\w$]*$/.test(expression.trim());
6
+ }
7
+ function canUseDirectVectorAccessor(propName, vector) {
8
+ // TODO(geoarrow-upgrade): This is intentionally conservative for published 0.3.x.
9
+ // Direct numeric vectors (for example `getRadius`) currently end up in deck's
10
+ // binary attribute path and trigger `Float64Array` initialization failures in the
11
+ // GeoArrow scatterplot wrapper. Re-test which direct vector accessors are safe
12
+ // after the next GeoArrow release and widen this gate if the runtime contract
13
+ // improves.
14
+ if (!propName.endsWith('Color')) {
15
+ return false;
16
+ }
17
+ const firstChunk = vector.data[0];
18
+ if (!firstChunk || !arrow.DataType.isFixedSizeList(firstChunk.type)) {
19
+ return false;
20
+ }
21
+ return true;
22
+ }
23
+ export function rewriteGeoArrowAccessors(options) {
24
+ const { props, table, layerName } = options;
25
+ const compatibility = getLayerCompatibility(layerName);
26
+ if (!compatibility || compatibility.representation !== 'geoarrow') {
27
+ return props;
28
+ }
29
+ const nextProps = { ...props };
30
+ for (const [propName, propValue] of Object.entries(nextProps)) {
31
+ if (typeof propValue !== 'string' ||
32
+ !propValue.startsWith('@@=') ||
33
+ !propName.startsWith('get')) {
34
+ continue;
35
+ }
36
+ const expression = propValue.slice(3);
37
+ if (compatibility.vectorAccessorProps.includes(propName) &&
38
+ isSimpleColumnReference(expression)) {
39
+ const vector = table.getChild(expression.trim());
40
+ if (vector && canUseDirectVectorAccessor(propName, vector)) {
41
+ nextProps[propName] = vector;
42
+ continue;
43
+ }
44
+ }
45
+ // TODO(geoarrow-upgrade): This fallback exists because 0.3.x GeoArrow layers do
46
+ // not share `@deck.gl/json`'s normal row accessor contract. If the next version
47
+ // supports standard deck/json accessors, or offers native expression handling,
48
+ // prefer that over our custom compiler.
49
+ nextProps[propName] = compileGeoArrowAccessor(expression, table);
50
+ }
51
+ return nextProps;
52
+ }
53
+ //# sourceMappingURL=rewriteGeoArrowAccessors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rewriteGeoArr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CAAC,EAAE,CAAC;QAC9D,IACE,OAAO,SAAS,KAAK,QAAQ;YAC7B,CAAC,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC;YAC5B,CAAC,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,EAC3B,CAAC;YACD,SAAS;QACX,CAAC;QAED,MAAM,UAAU,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACtC,IACE,aAAa,CAAC,mBAAmB,CAAC,QAAQ,CAAC,QAAQ,CAAC;YACpD,uBAAuB,CAAC,UAAU,CAAC,EACnC,CAAC;YACD,MAAM,MAAM,GAAG,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC;YACjD,IAAI,MAAM,IAAI,0BAA0B,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,CAAC;gBAC3D,SAAS,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC;gBAC7B,SAAS;YACX,CAAC;QACH,CAAC;QAED,gFAAgF;QAChF,gFAAgF;QAChF,+EAA+E;QAC/E,wCAAwC;QACxC,SAAS,CAAC,QAAQ,CAAC,GAAG,uBAAuB,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;IACnE,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["import * as arrow from 'apache-arrow';\nimport {compileGeoArrowAccessor} from './compileGeoArrowAccessor';\nimport {getLayerCompatibility} from './layerCompatibility';\n\nfunction isSimpleColumnReference(expression: string) {\n return /^[A-Za-z_$][\\w$]*$/.test(expression.trim());\n}\n\nfunction canUseDirectVectorAccessor(propName: string, vector: arrow.Vector) {\n // TODO(geoarrow-upgrade): This is intentionally conservative for published 0.3.x.\n // Direct numeric vectors (for example `getRadius`) currently end up in deck's\n // binary attribute path and trigger `Float64Array` initialization failures in the\n // GeoArrow scatterplot wrapper. Re-test which direct vector accessors are safe\n // after the next GeoArrow release and widen this gate if the runtime contract\n // improves.\n if (!propName.endsWith('Color')) {\n return false;\n }\n\n const firstChunk = vector.data[0];\n if (!firstChunk || !arrow.DataType.isFixedSizeList(firstChunk.type)) {\n return false;\n }\n\n return true;\n}\n\nexport function rewriteGeoArrowAccessors(options: {\n props: Record<string, unknown>;\n table: arrow.Table;\n layerName: string;\n}) {\n const {props, table, layerName} = options;\n const compatibility = getLayerCompatibility(layerName);\n if (!compatibility || compatibility.representation !== 'geoarrow') {\n return props;\n }\n\n const nextProps = {...props};\n\n for (const [propName, propValue] of Object.entries(nextProps)) {\n if (\n typeof propValue !== 'string' ||\n !propValue.startsWith('@@=') ||\n !propName.startsWith('get')\n ) {\n continue;\n }\n\n const expression = propValue.slice(3);\n if (\n compatibility.vectorAccessorProps.includes(propName) &&\n isSimpleColumnReference(expression)\n ) {\n const vector = table.getChild(expression.trim());\n if (vector && canUseDirectVectorAccessor(propName, vector)) {\n nextProps[propName] = vector;\n continue;\n }\n }\n\n // TODO(geoarrow-upgrade): This fallback exists because 0.3.x GeoArrow layers do\n // not share `@deck.gl/json`'s normal row accessor contract. If the next version\n // supports standard deck/json accessors, or offers native expression handling,\n // prefer that over our custom compiler.\n nextProps[propName] = compileGeoArrowAccessor(expression, table);\n }\n\n return nextProps;\n}\n"]}
@@ -0,0 +1,10 @@
1
+ import type * as arrow from 'apache-arrow';
2
+ import type { GeometryEncodingHint, ResolvedGeometryColumn } from './types';
3
+ type DetectGeometryColumnOptions = {
4
+ table: arrow.Table;
5
+ geometryColumn?: string;
6
+ geometryEncodingHint?: GeometryEncodingHint;
7
+ };
8
+ export declare function detectGeometryColumn(options: DetectGeometryColumnOptions): ResolvedGeometryColumn;
9
+ export {};
10
+ //# sourceMappingURL=detectGeometryColumn.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detectGeometryColumn.d.ts","sourceRoot":"","sources":["../../src/prepare/detectGeometryColumn.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EACV,oBAAoB,EACpB,sBAAsB,EAEvB,MAAM,SAAS,CAAC;AAGjB,KAAK,2BAA2B,GAAG;IACjC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;CAC7C,CAAC;AA+DF,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,2BAA2B,GACnC,sBAAsB,CA0CxB"}
@@ -0,0 +1,84 @@
1
+ import { getGeoMetadata, getGeometryColumnsFromSchema } from '@loaders.gl/geoarrow';
2
+ import { isDirectGeoArrowEncoding } from './geoarrow';
3
+ function getFieldNames(table) {
4
+ return table.schema.fields.map((field) => field.name);
5
+ }
6
+ function getFieldVector(table, fieldName) {
7
+ const vector = table.getChild(fieldName);
8
+ if (!vector) {
9
+ throw new Error(`Geometry column "${fieldName}" was not found in the Arrow table.`);
10
+ }
11
+ return vector;
12
+ }
13
+ function normalizeEncoding(encoding) {
14
+ if (!encoding) {
15
+ return undefined;
16
+ }
17
+ const normalized = encoding.toLowerCase();
18
+ switch (normalized) {
19
+ case 'geoarrow.point':
20
+ case 'geoarrow.multipoint':
21
+ case 'geoarrow.linestring':
22
+ case 'geoarrow.multilinestring':
23
+ case 'geoarrow.polygon':
24
+ case 'geoarrow.multipolygon':
25
+ case 'geoarrow.wkb':
26
+ case 'geoarrow.wkt':
27
+ case 'wkb':
28
+ case 'wkt':
29
+ return normalized;
30
+ default:
31
+ return undefined;
32
+ }
33
+ }
34
+ function inferEncodingFromHint(hint) {
35
+ switch (hint) {
36
+ case 'wkb':
37
+ return 'wkb';
38
+ case 'wkt':
39
+ return 'wkt';
40
+ default:
41
+ return undefined;
42
+ }
43
+ }
44
+ function inferEncodingFromVector(vector) {
45
+ const typeName = String(vector.type).toLowerCase();
46
+ if (typeName.includes('utf')) {
47
+ return 'wkt';
48
+ }
49
+ if (typeName.includes('binary')) {
50
+ return 'wkb';
51
+ }
52
+ return 'unknown';
53
+ }
54
+ export function detectGeometryColumn(options) {
55
+ const { table, geometryColumn, geometryEncodingHint } = options;
56
+ const fieldNames = getFieldNames(table);
57
+ const fieldMetadata = getGeometryColumnsFromSchema(table.schema);
58
+ const geoMetadata = getGeoMetadata(table.schema);
59
+ const metadataCandidates = new Set([
60
+ ...Object.keys(fieldMetadata),
61
+ ...Object.keys(geoMetadata?.columns ?? {}),
62
+ ]);
63
+ const namedCandidates = fieldNames.filter((fieldName) => /^(geom|geometry)$/i.test(fieldName));
64
+ const explicitGeometryColumn = geometryColumn;
65
+ const detectedGeometryColumn = explicitGeometryColumn ??
66
+ (metadataCandidates.size === 1 ? [...metadataCandidates][0] : undefined) ??
67
+ (namedCandidates.length === 1 ? namedCandidates[0] : undefined);
68
+ if (!detectedGeometryColumn) {
69
+ throw new Error(`Could not detect a geometry column. Available columns: ${fieldNames.join(', ')}`);
70
+ }
71
+ const vector = getFieldVector(table, detectedGeometryColumn);
72
+ const metadataEncoding = normalizeEncoding(fieldMetadata[detectedGeometryColumn]?.encoding) ??
73
+ normalizeEncoding(geoMetadata?.columns?.[detectedGeometryColumn]?.encoding);
74
+ const encoding = inferEncodingFromHint(geometryEncodingHint) ??
75
+ metadataEncoding ??
76
+ inferEncodingFromVector(vector);
77
+ return {
78
+ columnName: detectedGeometryColumn,
79
+ vector,
80
+ encoding,
81
+ nativeGeoArrow: isDirectGeoArrowEncoding(encoding),
82
+ };
83
+ }
84
+ //# sourceMappingURL=detectGeometryColumn.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detectGeometryColumn.js","sourceRoot":"","sources":["../../src/prepare/detectGeometryColumn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAE,4BAA4B,EAAC,MAAM,sBAAsB,CAAC;AAOlF,OAAO,EAAC,wBAAwB,EAAC,MAAM,YAAY,CAAC;AAQpD,SAAS,aAAa,CAAC,KAAkB;IACvC,OAAO,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,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AAC;IACJ,CAAC;IAED,MAAM,MAAM,GAAG,cAAc,CAAC,KAAK,EAAE,sBAAsB,CAAC,CAAC;IAC7D,MAAM,gBAAgB,GACpB,iBAAiB,CAAC,aAAa,CAAC,sBAAsB,CAAC,EAAE,QAAQ,CAAC;QAClE,iBAAiB,CAAC,WAAW,EAAE,OAAO,EAAE,CAAC,sBAAsB,CAAC,EAAE,QAAQ,CAAC,CAAC;IAE9E,MAAM,QAAQ,GACZ,qBAAqB,CAAC,oBAAoB,CAAC;QAC3C,gBAAgB;QAChB,uBAAuB,CAAC,MAAM,CAAC,CAAC;IAElC,OAAO;QACL,UAAU,EAAE,sBAAsB;QAClC,MAAM;QACN,QAAQ;QACR,cAAc,EAAE,wBAAwB,CAAC,QAAQ,CAAC;KACnD,CAAC;AACJ,CAAC","sourcesContent":["import {getGeoMetadata, getGeometryColumnsFromSchema} from '@loaders.gl/geoarrow';\nimport type * as arrow from 'apache-arrow';\nimport type {\n GeometryEncodingHint,\n ResolvedGeometryColumn,\n ResolvedGeometryEncoding,\n} from './types';\nimport {isDirectGeoArrowEncoding} from './geoarrow';\n\ntype DetectGeometryColumnOptions = {\n table: arrow.Table;\n geometryColumn?: string;\n geometryEncodingHint?: GeometryEncodingHint;\n};\n\nfunction getFieldNames(table: arrow.Table) {\n return table.schema.fields.map((field) => field.name);\n}\n\nfunction getFieldVector(table: arrow.Table, fieldName: string) {\n const vector = table.getChild(fieldName);\n if (!vector) {\n throw new Error(`Geometry column \"${fieldName}\" was not found in the Arrow table.`);\n }\n return vector;\n}\n\nfunction normalizeEncoding(\n encoding: string | undefined,\n): ResolvedGeometryEncoding | undefined {\n if (!encoding) {\n return undefined;\n }\n\n const normalized = encoding.toLowerCase() as ResolvedGeometryEncoding;\n switch (normalized) {\n case 'geoarrow.point':\n case 'geoarrow.multipoint':\n case 'geoarrow.linestring':\n case 'geoarrow.multilinestring':\n case 'geoarrow.polygon':\n case 'geoarrow.multipolygon':\n case 'geoarrow.wkb':\n case 'geoarrow.wkt':\n case 'wkb':\n case 'wkt':\n return normalized;\n default:\n return undefined;\n }\n}\n\nfunction inferEncodingFromHint(\n hint: GeometryEncodingHint | undefined,\n): ResolvedGeometryEncoding | undefined {\n switch (hint) {\n case 'wkb':\n return 'wkb';\n case 'wkt':\n return 'wkt';\n default:\n return undefined;\n }\n}\n\nfunction inferEncodingFromVector(vector: arrow.Vector): ResolvedGeometryEncoding {\n const typeName = String(vector.type).toLowerCase();\n if (typeName.includes('utf')) {\n return 'wkt';\n }\n if (typeName.includes('binary')) {\n return 'wkb';\n }\n return 'unknown';\n}\n\nexport function detectGeometryColumn(\n options: DetectGeometryColumnOptions,\n): ResolvedGeometryColumn {\n const {table, geometryColumn, geometryEncodingHint} = options;\n const fieldNames = getFieldNames(table);\n const fieldMetadata = getGeometryColumnsFromSchema(table.schema as never);\n const geoMetadata = getGeoMetadata(table.schema as never);\n const metadataCandidates = new Set<string>([\n ...Object.keys(fieldMetadata),\n ...Object.keys(geoMetadata?.columns ?? {}),\n ]);\n\n const namedCandidates = fieldNames.filter((fieldName) =>\n /^(geom|geometry)$/i.test(fieldName),\n );\n\n const explicitGeometryColumn = geometryColumn;\n const detectedGeometryColumn =\n explicitGeometryColumn ??\n (metadataCandidates.size === 1 ? [...metadataCandidates][0] : undefined) ??\n (namedCandidates.length === 1 ? namedCandidates[0] : undefined);\n\n if (!detectedGeometryColumn) {\n throw new Error(\n `Could not detect a geometry column. Available columns: ${fieldNames.join(', ')}`,\n );\n }\n\n const vector = getFieldVector(table, detectedGeometryColumn);\n const metadataEncoding =\n normalizeEncoding(fieldMetadata[detectedGeometryColumn]?.encoding) ??\n normalizeEncoding(geoMetadata?.columns?.[detectedGeometryColumn]?.encoding);\n\n const encoding =\n inferEncodingFromHint(geometryEncodingHint) ??\n metadataEncoding ??\n inferEncodingFromVector(vector);\n\n return {\n columnName: detectedGeometryColumn,\n vector,\n encoding,\n nativeGeoArrow: isDirectGeoArrowEncoding(encoding),\n };\n}\n"]}
@@ -0,0 +1,18 @@
1
+ import type * as arrow from 'apache-arrow';
2
+ import type { ResolvedGeometryColumn, ResolvedGeometryEncoding } from './types';
3
+ export declare function isDirectGeoArrowEncoding(encoding: ResolvedGeometryEncoding): boolean;
4
+ export declare function convertGeoArrowCellToGeometry(value: unknown, encoding: ResolvedGeometryEncoding): {
5
+ type: string;
6
+ coordinates: number[];
7
+ } | {
8
+ type: string;
9
+ coordinates: number[][];
10
+ } | {
11
+ type: string;
12
+ coordinates: number[][][];
13
+ } | {
14
+ type: string;
15
+ coordinates: number[][][][];
16
+ } | null;
17
+ export declare function buildNativeGeoArrowBinaryData(table: arrow.Table, geometry: ResolvedGeometryColumn): unknown;
18
+ //# sourceMappingURL=geoarrow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geoarrow.d.ts","sourceRoot":"","sources":["../../src/prepare/geoarrow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EAAC,sBAAsB,EAAE,wBAAwB,EAAC,MAAM,SAAS,CAAC;AAsF9E,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,wBAAwB,GACjC,OAAO,CAST;AAED,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,OAAO,EACd,QAAQ,EAAE,wBAAwB;;;;;;;;;;;;SAsBnC;AAED,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,QAAQ,EAAE,sBAAsB,GAC/B,OAAO,CAUT"}
@@ -0,0 +1,114 @@
1
+ import { buildBinaryGeoJsonData } from './toGeoJsonBinary';
2
+ function itemLength(value) {
3
+ if (Array.isArray(value)) {
4
+ return value.length;
5
+ }
6
+ if (value && typeof value === 'object' && 'length' in value) {
7
+ return Number(value.length);
8
+ }
9
+ return 0;
10
+ }
11
+ function itemAt(value, index) {
12
+ if (Array.isArray(value)) {
13
+ return value[index];
14
+ }
15
+ if (value && typeof value === 'object' && 'get' in value) {
16
+ return value.get(index);
17
+ }
18
+ return undefined;
19
+ }
20
+ function toCoordinates(value) {
21
+ return Array.from(value, (coordinate) => Number(coordinate));
22
+ }
23
+ function pointToGeometry(value) {
24
+ return { type: 'Point', coordinates: toCoordinates(value) };
25
+ }
26
+ function multiPointToGeometry(value) {
27
+ const coordinates = [];
28
+ for (let index = 0; index < itemLength(value); index++) {
29
+ const point = itemAt(value, index);
30
+ if (point) {
31
+ coordinates.push(toCoordinates(point));
32
+ }
33
+ }
34
+ return { type: 'MultiPoint', coordinates };
35
+ }
36
+ function lineStringToGeometry(value) {
37
+ const coordinates = [];
38
+ for (let index = 0; index < itemLength(value); index++) {
39
+ const point = itemAt(value, index);
40
+ if (point) {
41
+ coordinates.push(toCoordinates(point));
42
+ }
43
+ }
44
+ return { type: 'LineString', coordinates };
45
+ }
46
+ function multiLineStringToGeometry(value) {
47
+ const coordinates = [];
48
+ for (let index = 0; index < itemLength(value); index++) {
49
+ const lineString = itemAt(value, index);
50
+ if (lineString) {
51
+ coordinates.push(lineStringToGeometry(lineString).coordinates);
52
+ }
53
+ }
54
+ return { type: 'MultiLineString', coordinates };
55
+ }
56
+ function polygonToGeometry(value) {
57
+ const coordinates = [];
58
+ for (let ringIndex = 0; ringIndex < itemLength(value); ringIndex++) {
59
+ const ring = itemAt(value, ringIndex);
60
+ if (ring) {
61
+ coordinates.push(lineStringToGeometry(ring).coordinates);
62
+ }
63
+ }
64
+ return { type: 'Polygon', coordinates };
65
+ }
66
+ function multiPolygonToGeometry(value) {
67
+ const coordinates = [];
68
+ for (let polygonIndex = 0; polygonIndex < itemLength(value); polygonIndex++) {
69
+ const polygon = itemAt(value, polygonIndex);
70
+ if (polygon) {
71
+ coordinates.push(polygonToGeometry(polygon).coordinates);
72
+ }
73
+ }
74
+ return { type: 'MultiPolygon', coordinates };
75
+ }
76
+ export function isDirectGeoArrowEncoding(encoding) {
77
+ return [
78
+ 'geoarrow.point',
79
+ 'geoarrow.multipoint',
80
+ 'geoarrow.linestring',
81
+ 'geoarrow.multilinestring',
82
+ 'geoarrow.polygon',
83
+ 'geoarrow.multipolygon',
84
+ ].includes(encoding);
85
+ }
86
+ export function convertGeoArrowCellToGeometry(value, encoding) {
87
+ if (value == null) {
88
+ return null;
89
+ }
90
+ switch (encoding) {
91
+ case 'geoarrow.point':
92
+ return pointToGeometry(value);
93
+ case 'geoarrow.multipoint':
94
+ return multiPointToGeometry(value);
95
+ case 'geoarrow.linestring':
96
+ return lineStringToGeometry(value);
97
+ case 'geoarrow.multilinestring':
98
+ return multiLineStringToGeometry(value);
99
+ case 'geoarrow.polygon':
100
+ return polygonToGeometry(value);
101
+ case 'geoarrow.multipolygon':
102
+ return multiPolygonToGeometry(value);
103
+ default:
104
+ return null;
105
+ }
106
+ }
107
+ export function buildNativeGeoArrowBinaryData(table, geometry) {
108
+ return buildBinaryGeoJsonData({
109
+ table,
110
+ geometryColumnName: geometry.columnName,
111
+ getGeometryAt: (rowIndex) => convertGeoArrowCellToGeometry(geometry.vector.get(rowIndex), geometry.encoding),
112
+ });
113
+ }
114
+ //# sourceMappingURL=geoarrow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geoarrow.js","sourceRoot":"","sources":["../../src/prepare/geoarrow.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,sBAAsB,EAAC,MAAM,mBAAmB,CAAC;AAEzD,SAAS,UAAU,CAAC,KAAc;IAChC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC,MAAM,CAAC;IACtB,CAAC;IACD,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,QAAQ,IAAI,KAAK,EAAE,CAAC;QAC5D,OAAO,MAAM,CAAE,KAA0B,CAAC,MAAM,CAAC,CAAC;IACpD,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC;AAED,SAAS,MAAM,CAAC,KAAc,EAAE,KAAa;IAC3C,IAAI,KAAK,CAAC,OA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AC,UAAU;QACvC,aAAa,EAAE,CAAC,QAAQ,EAAE,EAAE,CAC1B,6BAA6B,CAC3B,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,EAC7B,QAAQ,CAAC,QAAQ,CAClB;KACJ,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type * as arrow from 'apache-arrow';\nimport type {ResolvedGeometryColumn, ResolvedGeometryEncoding} from './types';\nimport {buildBinaryGeoJsonData} from './toGeoJsonBinary';\n\nfunction itemLength(value: unknown) {\n if (Array.isArray(value)) {\n return value.length;\n }\n if (value && typeof value === 'object' && 'length' in value) {\n return Number((value as {length: number}).length);\n }\n return 0;\n}\n\nfunction itemAt(value: unknown, index: number): unknown {\n if (Array.isArray(value)) {\n return value[index];\n }\n if (value && typeof value === 'object' && 'get' in value) {\n return (value as {get: (index: number) => unknown}).get(index);\n }\n return undefined;\n}\n\nfunction toCoordinates(value: unknown): number[] {\n return Array.from(value as Iterable<number>, (coordinate) => Number(coordinate));\n}\n\nfunction pointToGeometry(value: unknown) {\n return {type: 'Point', coordinates: toCoordinates(value)};\n}\n\nfunction multiPointToGeometry(value: unknown) {\n const coordinates = [];\n for (let index = 0; index < itemLength(value); index++) {\n const point = itemAt(value, index);\n if (point) {\n coordinates.push(toCoordinates(point));\n }\n }\n return {type: 'MultiPoint', coordinates};\n}\n\nfunction lineStringToGeometry(value: unknown) {\n const coordinates = [];\n for (let index = 0; index < itemLength(value); index++) {\n const point = itemAt(value, index);\n if (point) {\n coordinates.push(toCoordinates(point));\n }\n }\n return {type: 'LineString', coordinates};\n}\n\nfunction multiLineStringToGeometry(value: unknown) {\n const coordinates = [];\n for (let index = 0; index < itemLength(value); index++) {\n const lineString = itemAt(value, index);\n if (lineString) {\n coordinates.push(lineStringToGeometry(lineString).coordinates);\n }\n }\n return {type: 'MultiLineString', coordinates};\n}\n\nfunction polygonToGeometry(value: unknown) {\n const coordinates = [];\n for (let ringIndex = 0; ringIndex < itemLength(value); ringIndex++) {\n const ring = itemAt(value, ringIndex);\n if (ring) {\n coordinates.push(lineStringToGeometry(ring).coordinates);\n }\n }\n return {type: 'Polygon', coordinates};\n}\n\nfunction multiPolygonToGeometry(value: unknown) {\n const coordinates = [];\n for (let polygonIndex = 0; polygonIndex < itemLength(value); polygonIndex++) {\n const polygon = itemAt(value, polygonIndex);\n if (polygon) {\n coordinates.push(polygonToGeometry(polygon).coordinates);\n }\n }\n return {type: 'MultiPolygon', coordinates};\n}\n\nexport function isDirectGeoArrowEncoding(\n encoding: ResolvedGeometryEncoding,\n): boolean {\n return [\n 'geoarrow.point',\n 'geoarrow.multipoint',\n 'geoarrow.linestring',\n 'geoarrow.multilinestring',\n 'geoarrow.polygon',\n 'geoarrow.multipolygon',\n ].includes(encoding);\n}\n\nexport function convertGeoArrowCellToGeometry(\n value: unknown,\n encoding: ResolvedGeometryEncoding,\n) {\n if (value == null) {\n return null;\n }\n\n switch (encoding) {\n case 'geoarrow.point':\n return pointToGeometry(value);\n case 'geoarrow.multipoint':\n return multiPointToGeometry(value);\n case 'geoarrow.linestring':\n return lineStringToGeometry(value);\n case 'geoarrow.multilinestring':\n return multiLineStringToGeometry(value);\n case 'geoarrow.polygon':\n return polygonToGeometry(value);\n case 'geoarrow.multipolygon':\n return multiPolygonToGeometry(value);\n default:\n return null;\n }\n}\n\nexport function buildNativeGeoArrowBinaryData(\n table: arrow.Table,\n geometry: ResolvedGeometryColumn,\n): unknown {\n return buildBinaryGeoJsonData({\n table,\n geometryColumnName: geometry.columnName,\n getGeometryAt: (rowIndex) =>\n convertGeoArrowCellToGeometry(\n geometry.vector.get(rowIndex),\n geometry.encoding,\n ),\n });\n}\n"]}
@@ -0,0 +1,9 @@
1
+ import type * as arrow from 'apache-arrow';
2
+ import type { PreparedGeoArrowLayerData, ResolvedGeometryEncoding } from './types';
3
+ export type SupportedGeoArrowLayerType = 'GeoArrowScatterplotLayer' | 'GeoArrowPathLayer' | 'GeoArrowSolidPolygonLayer';
4
+ export type GeometryDecoder = {
5
+ supportsGeoArrowPromotion: (layerType: SupportedGeoArrowLayerType, encoding: ResolvedGeometryEncoding, table: arrow.Table, columnName: string) => boolean;
6
+ toGeoArrowLike: (table: arrow.Table, columnName: string, encoding: ResolvedGeometryEncoding) => PreparedGeoArrowLayerData;
7
+ toGeoJsonBinary: (table: arrow.Table, columnName: string, encoding: ResolvedGeometryEncoding) => unknown;
8
+ };
9
+ //# sourceMappingURL=geometryDecoder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geometryDecoder.d.ts","sourceRoot":"","sources":["../../src/prepare/geometryDecoder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EAAC,yBAAyB,EAAE,wBAAwB,EAAC,MAAM,SAAS,CAAC;AAEjF,MAAM,MAAM,0BAA0B,GAClC,0BAA0B,GAC1B,mBAAmB,GACnB,2BAA2B,CAAC;AAEhC,MAAM,MAAM,eAAe,GAAG;IAC5B,yBAAyB,EAAE,CACzB,SAAS,EAAE,0BAA0B,EACrC,QAAQ,EAAE,wBAAwB,EAClC,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,UAAU,EAAE,MAAM,KACf,OAAO,CAAC;IACb,cAAc,EAAE,CACd,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,wBAAwB,KAC/B,yBAAyB,CAAC;IAC/B,eAAe,EAAE,CACf,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,wBAAwB,KAC/B,OAAO,CAAC;CACd,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=geometryDecoder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geometryDecoder.js","sourceRoot":"","sources":["../../src/prepare/geometryDecoder.ts"],"names":[],"mappings":"","sourcesContent":["import type * as arrow from 'apache-arrow';\nimport type {PreparedGeoArrowLayerData, ResolvedGeometryEncoding} from './types';\n\nexport type SupportedGeoArrowLayerType =\n | 'GeoArrowScatterplotLayer'\n | 'GeoArrowPathLayer'\n | 'GeoArrowSolidPolygonLayer';\n\nexport type GeometryDecoder = {\n supportsGeoArrowPromotion: (\n layerType: SupportedGeoArrowLayerType,\n encoding: ResolvedGeometryEncoding,\n table: arrow.Table,\n columnName: string,\n ) => boolean;\n toGeoArrowLike: (\n table: arrow.Table,\n columnName: string,\n encoding: ResolvedGeometryEncoding,\n ) => PreparedGeoArrowLayerData;\n toGeoJsonBinary: (\n table: arrow.Table,\n columnName: string,\n encoding: ResolvedGeometryEncoding,\n ) => unknown;\n};\n"]}
@@ -0,0 +1,11 @@
1
+ import type * as arrow from 'apache-arrow';
2
+ import type { GeometryEncodingHint, PreparedDeckDataset } from './types';
3
+ type PrepareDeckDatasetOptions = {
4
+ datasetId: string;
5
+ table: arrow.Table;
6
+ geometryColumn?: string;
7
+ geometryEncodingHint?: GeometryEncodingHint;
8
+ };
9
+ export declare function prepareDeckDataset(options: PrepareDeckDatasetOptions): PreparedDeckDataset;
10
+ export {};
11
+ //# sourceMappingURL=prepareDeckDataset.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prepareDeckDataset.d.ts","sourceRoot":"","sources":["../../src/prepare/prepareDeckDataset.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAM3C,OAAO,KAAK,EACV,oBAAoB,EACpB,mBAAmB,EAGpB,MAAM,SAAS,CAAC;AAGjB,KAAK,yBAAyB,GAAG;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;CAC7C,CAAC;AAEF,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,yBAAyB,GACjC,mBAAmB,CA4ErB"}
@@ -0,0 +1,66 @@
1
+ import { detectGeometryColumn } from './detectGeometryColumn';
2
+ import { buildNativeGeoArrowBinaryData, isDirectGeoArrowEncoding, } from './geoarrow';
3
+ import { wkbGeometryDecoder } from './wkbDecoder';
4
+ export function prepareDeckDataset(options) {
5
+ const { datasetId, table, geometryColumn, geometryEncodingHint } = options;
6
+ const resolvedGeometryCache = new Map();
7
+ const geoArrowCache = new Map();
8
+ const geoJsonBinaryCache = new Map();
9
+ const resolveGeometry = (geometryColumnOverride) => {
10
+ const cacheKey = geometryColumnOverride ?? '__default__';
11
+ const cached = resolvedGeometryCache.get(cacheKey);
12
+ if (cached) {
13
+ return cached;
14
+ }
15
+ const resolved = detectGeometryColumn({
16
+ table,
17
+ geometryColumn: geometryColumnOverride ?? geometryColumn,
18
+ geometryEncodingHint,
19
+ });
20
+ resolvedGeometryCache.set(cacheKey, resolved);
21
+ return resolved;
22
+ };
23
+ return {
24
+ datasetId,
25
+ table,
26
+ datasetGeometryColumn: geometryColumn,
27
+ resolveGeometry,
28
+ getGeoArrowLayerData(geometryColumnOverride) {
29
+ const cacheKey = geometryColumnOverride ?? '__default__';
30
+ const cached = geoArrowCache.get(cacheKey);
31
+ if (cached) {
32
+ return cached;
33
+ }
34
+ const resolved = resolveGeometry(geometryColumnOverride);
35
+ let prepared;
36
+ if (isDirectGeoArrowEncoding(resolved.encoding)) {
37
+ prepared = {
38
+ table,
39
+ geometryColumnName: resolved.columnName,
40
+ geometryColumn: resolved.vector,
41
+ encoding: resolved.encoding,
42
+ source: 'native',
43
+ };
44
+ }
45
+ else {
46
+ prepared = wkbGeometryDecoder.toGeoArrowLike(table, resolved.columnName, resolved.encoding);
47
+ }
48
+ geoArrowCache.set(cacheKey, prepared);
49
+ return prepared;
50
+ },
51
+ getGeoJsonBinaryData(geometryColumnOverride) {
52
+ const cacheKey = geometryColumnOverride ?? '__default__';
53
+ const cached = geoJsonBinaryCache.get(cacheKey);
54
+ if (cached) {
55
+ return cached;
56
+ }
57
+ const resolved = resolveGeometry(geometryColumnOverride);
58
+ const binaryData = resolved.nativeGeoArrow
59
+ ? buildNativeGeoArrowBinaryData(table, resolved)
60
+ : wkbGeometryDecoder.toGeoJsonBinary(table, resolved.columnName, resolved.encoding);
61
+ geoJsonBinaryCache.set(cacheKey, binaryData);
62
+ return binaryData;
63
+ },
64
+ };
65
+ }
66
+ //# sourceMappingURL=prepareDeckDataset.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prepareDeckDataset.js","sourceRoot":"","sources":["../../src/prepare/prepareDeckDataset.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,oBAAoB,EAAC,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EACL,6BAA6B,EAC7B,wBAAwB,GACzB,MAAM,YAAY,CAAC;AAOpB,OAAO,EAAC,kBAAkB,EAAC,MAAM,cAAc,CAAC;AAShD,MAAM,UAAU,kBAAkB,CAChC,OAAkC;IAElC,MAAM,EAAC,SAAS,EAAE,KAAK,EAAE,cAAc,EAAE,oBAAoB,EAAC,GAAG,OAAO,CAAC;IACzE,MAAM,qBAAqB,GAAG,IAAI,GAAG,EAAkC,CAAC;IACxE,MAAM,aAAa,GAAG,IAAI,GAAG,EAAqC,CAAC;IACnE,MAAM,kBAAkB,GAAG,IAAI,GAAG,EAAmB,CAAC;IAEtD,MAAM,eAAe,GAAG,CAAC,sBAA+B,EAAE,EAAE;QAC1D,MAAM,QAAQ,GAAG,sBAAsB,IAAI,aAAa,CAAC;QACzD,MAAM,MAAM,GAAG,qBAAqB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACnD,IAAI,MAAM,EAAE,CAAC;YACX,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,MAAM,QAAQ,GAAG,oBAAoB,CAAC;YACpC,KAAK;YACL,cAAc,EAAE,sBAAsB,IAAI,cAAc;YACxD,oBAAoB;SACrB,CAAC,CAAC;QACH,qBAAqB,CAAC,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,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AAC,cAAc;gBACxC,CAAC,CAAC,6BAA6B,CAAC,KAAK,EAAE,QAAQ,CAAC;gBAChD,CAAC,CAAC,kBAAkB,CAAC,eAAe,CAChC,KAAK,EACL,QAAQ,CAAC,UAAU,EACnB,QAAQ,CAAC,QAAQ,CAClB,CAAC;YAEN,kBAAkB,CAAC,GAAG,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;YAC7C,OAAO,UAAU,CAAC;QACpB,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import type * as arrow from 'apache-arrow';\nimport {detectGeometryColumn} from './detectGeometryColumn';\nimport {\n buildNativeGeoArrowBinaryData,\n isDirectGeoArrowEncoding,\n} from './geoarrow';\nimport type {\n GeometryEncodingHint,\n PreparedDeckDataset,\n PreparedGeoArrowLayerData,\n ResolvedGeometryColumn,\n} from './types';\nimport {wkbGeometryDecoder} from './wkbDecoder';\n\ntype PrepareDeckDatasetOptions = {\n datasetId: string;\n table: arrow.Table;\n geometryColumn?: string;\n geometryEncodingHint?: GeometryEncodingHint;\n};\n\nexport function prepareDeckDataset(\n options: PrepareDeckDatasetOptions,\n): PreparedDeckDataset {\n const {datasetId, table, geometryColumn, geometryEncodingHint} = options;\n const resolvedGeometryCache = new Map<string, ResolvedGeometryColumn>();\n const geoArrowCache = new Map<string, PreparedGeoArrowLayerData>();\n const geoJsonBinaryCache = new Map<string, unknown>();\n\n const resolveGeometry = (geometryColumnOverride?: string) => {\n const cacheKey = geometryColumnOverride ?? '__default__';\n const cached = resolvedGeometryCache.get(cacheKey);\n if (cached) {\n return cached;\n }\n\n const resolved = detectGeometryColumn({\n table,\n geometryColumn: geometryColumnOverride ?? geometryColumn,\n geometryEncodingHint,\n });\n resolvedGeometryCache.set(cacheKey, resolved);\n return resolved;\n };\n\n return {\n datasetId,\n table,\n datasetGeometryColumn: geometryColumn,\n resolveGeometry,\n getGeoArrowLayerData(geometryColumnOverride?: string) {\n const cacheKey = geometryColumnOverride ?? '__default__';\n const cached = geoArrowCache.get(cacheKey);\n if (cached) {\n return cached;\n }\n\n const resolved = resolveGeometry(geometryColumnOverride);\n let prepared: PreparedGeoArrowLayerData;\n\n if (isDirectGeoArrowEncoding(resolved.encoding)) {\n prepared = {\n table,\n geometryColumnName: resolved.columnName,\n geometryColumn: resolved.vector,\n encoding: resolved.encoding,\n source: 'native',\n };\n } else {\n prepared = wkbGeometryDecoder.toGeoArrowLike(\n table,\n resolved.columnName,\n resolved.encoding,\n );\n }\n\n geoArrowCache.set(cacheKey, prepared);\n return prepared;\n },\n getGeoJsonBinaryData(geometryColumnOverride?: string) {\n const cacheKey = geometryColumnOverride ?? '__default__';\n const cached = geoJsonBinaryCache.get(cacheKey);\n if (cached) {\n return cached;\n }\n\n const resolved = resolveGeometry(geometryColumnOverride);\n const binaryData = resolved.nativeGeoArrow\n ? buildNativeGeoArrowBinaryData(table, resolved)\n : wkbGeometryDecoder.toGeoJsonBinary(\n table,\n resolved.columnName,\n resolved.encoding,\n );\n\n geoJsonBinaryCache.set(cacheKey, binaryData);\n return binaryData;\n },\n };\n}\n"]}
@@ -0,0 +1,9 @@
1
+ import type * as arrow from 'apache-arrow';
2
+ type BuildBinaryGeoJsonDataOptions = {
3
+ table: arrow.Table;
4
+ geometryColumnName: string;
5
+ getGeometryAt: (rowIndex: number) => unknown;
6
+ };
7
+ export declare function buildBinaryGeoJsonData(options: BuildBinaryGeoJsonDataOptions): unknown;
8
+ export {};
9
+ //# sourceMappingURL=toGeoJsonBinary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toGeoJsonBinary.d.ts","sourceRoot":"","sources":["../../src/prepare/toGeoJsonBinary.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAG3C,KAAK,6BAA6B,GAAG;IACnC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC;IACnB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,aAAa,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC;CAC9C,CAAC;AAEF,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,6BAA6B,GACrC,OAAO,CA0BT"}
@@ -0,0 +1,25 @@
1
+ import { geojsonToBinary } from '@loaders.gl/gis';
2
+ export function buildBinaryGeoJsonData(options) {
3
+ const { table, geometryColumnName, getGeometryAt } = options;
4
+ const propertyColumns = table.schema.fields
5
+ .map((field) => field.name)
6
+ .filter((fieldName) => fieldName !== geometryColumnName);
7
+ const features = [];
8
+ for (let rowIndex = 0; rowIndex < table.numRows; rowIndex++) {
9
+ const geometry = getGeometryAt(rowIndex);
10
+ if (!geometry) {
11
+ continue;
12
+ }
13
+ const properties = {};
14
+ for (const fieldName of propertyColumns) {
15
+ properties[fieldName] = table.getChild(fieldName)?.get(rowIndex);
16
+ }
17
+ features.push({
18
+ type: 'Feature',
19
+ geometry: geometry,
20
+ properties,
21
+ });
22
+ }
23
+ return geojsonToBinary(features);
24
+ }
25
+ //# sourceMappingURL=toGeoJsonBinary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toGeoJsonBinary.js","sourceRoot":"","sources":["../../src/prepare/toGeoJsonBinary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAUhD,MAAM,UAAU,sBAAsB,CACpC,OAAsC;IAEtC,MAAM,EAAC,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAC,GAAG,OAAO,CAAC;IAC3D,MAAM,eAAe,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM;SACxC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC;SAC1B,MAAM,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,KAAK,kBAAkB,CAAC,CAAC;IAE3D,MAAM,QAAQ,GAAwB,EAAE,CAAC;IACzC,KAAK,IAAI,QAAQ,GAAG,CAAC,EAAE,QAAQ,GAAG,KAAK,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE,CAAC;QAC5D,MAAM,QAAQ,GAAG,aAAa,CAAC,QAAQ,CAAC,CAAC;QACzC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,SAAS;QACX,CAAC;QAED,MAAM,UAAU,GAA4B,EAAE,CAAC;QAC/C,KAAK,MAAM,SAAS,IAAI,eAAe,EAAE,CAAC;YACxC,UAAU,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC;QACnE,CAAC;QAED,QAAQ,CAAC,IAAI,CAAC;YACZ,IAAI,EAAE,SAAS;YACf,QAAQ,EAAE,QAAoB;YAC9B,UAAU;SACX,CAAC,CAAC;IACL,CAAC;IAED,OAAO,eAAe,CAAC,QAAQ,CAAC,CAAC;AACnC,CAAC","sourcesContent":["import {geojsonToBinary} from '@loaders.gl/gis';\nimport type * as arrow from 'apache-arrow';\nimport type {Feature, Geometry} from 'geojson';\n\ntype BuildBinaryGeoJsonDataOptions = {\n table: arrow.Table;\n geometryColumnName: string;\n getGeometryAt: (rowIndex: number) => unknown;\n};\n\nexport function buildBinaryGeoJsonData(\n options: BuildBinaryGeoJsonDataOptions,\n): unknown {\n const {table, geometryColumnName, getGeometryAt} = options;\n const propertyColumns = table.schema.fields\n .map((field) => field.name)\n .filter((fieldName) => fieldName !== geometryColumnName);\n\n const features: Feature<Geometry>[] = [];\n for (let rowIndex = 0; rowIndex < table.numRows; rowIndex++) {\n const geometry = getGeometryAt(rowIndex);\n if (!geometry) {\n continue;\n }\n\n const properties: Record<string, unknown> = {};\n for (const fieldName of propertyColumns) {\n properties[fieldName] = table.getChild(fieldName)?.get(rowIndex);\n }\n\n features.push({\n type: 'Feature',\n geometry: geometry as Geometry,\n properties,\n });\n }\n\n return geojsonToBinary(features);\n}\n"]}
@@ -0,0 +1,25 @@
1
+ import type * as arrow from 'apache-arrow';
2
+ export type GeometryEncodingHint = 'geoarrow' | 'wkb' | 'wkt';
3
+ export type ResolvedGeometryEncoding = 'geoarrow.point' | 'geoarrow.multipoint' | 'geoarrow.linestring' | 'geoarrow.multilinestring' | 'geoarrow.polygon' | 'geoarrow.multipolygon' | 'geoarrow.wkb' | 'geoarrow.wkt' | 'wkb' | 'wkt' | 'unknown';
4
+ export type ResolvedGeometryColumn = {
5
+ columnName: string;
6
+ vector: arrow.Vector;
7
+ encoding: ResolvedGeometryEncoding;
8
+ nativeGeoArrow: boolean;
9
+ };
10
+ export type PreparedGeoArrowLayerData = {
11
+ table: arrow.Table;
12
+ geometryColumnName: string;
13
+ geometryColumn: arrow.Vector;
14
+ encoding: ResolvedGeometryEncoding;
15
+ source: 'native' | 'promoted';
16
+ };
17
+ export type PreparedDeckDataset = {
18
+ datasetId: string;
19
+ table: arrow.Table;
20
+ datasetGeometryColumn?: string;
21
+ resolveGeometry: (geometryColumn?: string) => ResolvedGeometryColumn;
22
+ getGeoArrowLayerData: (geometryColumn?: string) => PreparedGeoArrowLayerData;
23
+ getGeoJsonBinaryData: (geometryColumn?: string) => unknown;
24
+ };
25
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/prepare/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAE3C,MAAM,MAAM,oBAAoB,GAAG,UAAU,GAAG,KAAK,GAAG,KAAK,CAAC;AAE9D,MAAM,MAAM,wBAAwB,GAChC,gBAAgB,GAChB,qBAAqB,GACrB,qBAAqB,GACrB,0BAA0B,GAC1B,kBAAkB,GAClB,uBAAuB,GACvB,cAAc,GACd,cAAc,GACd,KAAK,GACL,KAAK,GACL,SAAS,CAAC;AAEd,MAAM,MAAM,sBAAsB,GAAG;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC;IACrB,QAAQ,EAAE,wBAAwB,CAAC;IACnC,cAAc,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IAItC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC;IACnB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,cAAc,EAAE,KAAK,CAAC,MAAM,CAAC;IAC7B,QAAQ,EAAE,wBAAwB,CAAC;IACnC,MAAM,EAAE,QAAQ,GAAG,UAAU,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC;IACnB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,eAAe,EAAE,CAAC,cAAc,CAAC,EAAE,MAAM,KAAK,sBAAsB,CAAC;IACrE,oBAAoB,EAAE,CAAC,cAAc,CAAC,EAAE,MAAM,KAAK,yBAAyB,CAAC;IAC7E,oBAAoB,EAAE,CAAC,cAAc,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC;CAC5D,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/prepare/types.ts"],"names":[],"mappings":"","sourcesContent":["import type * as arrow from 'apache-arrow';\n\nexport type GeometryEncodingHint = 'geoarrow' | 'wkb' | 'wkt';\n\nexport type ResolvedGeometryEncoding =\n | 'geoarrow.point'\n | 'geoarrow.multipoint'\n | 'geoarrow.linestring'\n | 'geoarrow.multilinestring'\n | 'geoarrow.polygon'\n | 'geoarrow.multipolygon'\n | 'geoarrow.wkb'\n | 'geoarrow.wkt'\n | 'wkb'\n | 'wkt'\n | 'unknown';\n\nexport type ResolvedGeometryColumn = {\n columnName: string;\n vector: arrow.Vector;\n encoding: ResolvedGeometryEncoding;\n nativeGeoArrow: boolean;\n};\n\nexport type PreparedGeoArrowLayerData = {\n // TODO(geoarrow-upgrade): This `Table` + `Vector` payload shape matches published\n // `@geoarrow/deck.gl-layers@0.3.x`. Revisit it on the next GeoArrow bump; newer\n // versions may prefer RecordBatch/Data-chunk inputs instead of Table/Vector.\n table: arrow.Table;\n geometryColumnName: string;\n geometryColumn: arrow.Vector;\n encoding: ResolvedGeometryEncoding;\n source: 'native' | 'promoted';\n};\n\nexport type PreparedDeckDataset = {\n datasetId: string;\n table: arrow.Table;\n datasetGeometryColumn?: string;\n resolveGeometry: (geometryColumn?: string) => ResolvedGeometryColumn;\n getGeoArrowLayerData: (geometryColumn?: string) => PreparedGeoArrowLayerData;\n getGeoJsonBinaryData: (geometryColumn?: string) => unknown;\n};\n"]}
@@ -0,0 +1,3 @@
1
+ import type { GeometryDecoder } from './geometryDecoder';
2
+ export declare const wkbGeometryDecoder: GeometryDecoder;
3
+ //# sourceMappingURL=wkbDecoder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wkbDecoder.d.ts","sourceRoot":"","sources":["../../src/prepare/wkbDecoder.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAC,eAAe,EAA6B,MAAM,mBAAmB,CAAC;AAsHnF,eAAO,MAAM,kBAAkB,EAAE,eA2ChC,CAAC"}