@sqlrooms/deck 0.29.0-rc.2 → 0.29.0-rc.4

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 (123) hide show
  1. package/LICENSE.md +9 -0
  2. package/README.md +69 -0
  3. package/dist/DeckJsonMap.d.ts +4 -0
  4. package/dist/DeckJsonMap.d.ts.map +1 -0
  5. package/dist/{DeckMap.js → DeckJsonMap.js} +57 -44
  6. package/dist/DeckJsonMap.js.map +1 -0
  7. package/dist/DeckJsonMapSpec.d.ts +7617 -0
  8. package/dist/DeckJsonMapSpec.d.ts.map +1 -0
  9. package/dist/DeckJsonMapSpec.js +81 -0
  10. package/dist/DeckJsonMapSpec.js.map +1 -0
  11. package/dist/DeckMapConfigPopoverEditor.d.ts +8 -0
  12. package/dist/DeckMapConfigPopoverEditor.d.ts.map +1 -0
  13. package/dist/DeckMapConfigPopoverEditor.js +43 -0
  14. package/dist/DeckMapConfigPopoverEditor.js.map +1 -0
  15. package/dist/createDeckJsonSpecFromDatasets.d.ts +11 -0
  16. package/dist/createDeckJsonSpecFromDatasets.d.ts.map +1 -0
  17. package/dist/createDeckJsonSpecFromDatasets.js +85 -0
  18. package/dist/createDeckJsonSpecFromDatasets.js.map +1 -0
  19. package/dist/dashboard.d.ts +4 -0
  20. package/dist/dashboard.d.ts.map +1 -0
  21. package/dist/dashboard.js +465 -0
  22. package/dist/dashboard.js.map +1 -0
  23. package/dist/dashboardConfig.d.ts +51 -0
  24. package/dist/dashboardConfig.d.ts.map +1 -0
  25. package/dist/dashboardConfig.js +54 -0
  26. package/dist/dashboardConfig.js.map +1 -0
  27. package/dist/datasets/PreparedDatasetStore.d.ts +120 -0
  28. package/dist/datasets/PreparedDatasetStore.d.ts.map +1 -0
  29. package/dist/datasets/PreparedDatasetStore.js +262 -0
  30. package/dist/datasets/PreparedDatasetStore.js.map +1 -0
  31. package/dist/datasets/helpers.d.ts +57 -0
  32. package/dist/datasets/helpers.d.ts.map +1 -0
  33. package/dist/datasets/helpers.js +146 -0
  34. package/dist/datasets/helpers.js.map +1 -0
  35. package/dist/datasets/normalizeDatasets.d.ts +8 -2
  36. package/dist/datasets/normalizeDatasets.d.ts.map +1 -1
  37. package/dist/datasets/normalizeDatasets.js +33 -48
  38. package/dist/datasets/normalizeDatasets.js.map +1 -1
  39. package/dist/datasets/tableAdapter.d.ts +11 -0
  40. package/dist/datasets/tableAdapter.d.ts.map +1 -0
  41. package/dist/datasets/tableAdapter.js +11 -0
  42. package/dist/datasets/tableAdapter.js.map +1 -0
  43. package/dist/datasets/types.d.ts +40 -0
  44. package/dist/datasets/types.d.ts.map +1 -0
  45. package/dist/datasets/types.js +2 -0
  46. package/dist/datasets/types.js.map +1 -0
  47. package/dist/datasets/usePreparedDatasetStates.d.ts +16 -0
  48. package/dist/datasets/usePreparedDatasetStates.d.ts.map +1 -0
  49. package/dist/datasets/usePreparedDatasetStates.js +59 -0
  50. package/dist/datasets/usePreparedDatasetStates.js.map +1 -0
  51. package/dist/index.d.ts +10 -3
  52. package/dist/index.d.ts.map +1 -1
  53. package/dist/index.js +7 -2
  54. package/dist/index.js.map +1 -1
  55. package/dist/json/colorScaleFunction.d.ts +14 -0
  56. package/dist/json/colorScaleFunction.d.ts.map +1 -0
  57. package/dist/json/colorScaleFunction.js +34 -0
  58. package/dist/json/colorScaleFunction.js.map +1 -0
  59. package/dist/json/compileColorScale.d.ts +4 -27
  60. package/dist/json/compileColorScale.d.ts.map +1 -1
  61. package/dist/json/compileColorScale.js +16 -450
  62. package/dist/json/compileColorScale.js.map +1 -1
  63. package/dist/json/compileGeoArrowAccessor.d.ts +7 -0
  64. package/dist/json/compileGeoArrowAccessor.d.ts.map +1 -1
  65. package/dist/json/compileGeoArrowAccessor.js +68 -2
  66. package/dist/json/compileGeoArrowAccessor.js.map +1 -1
  67. package/dist/json/createDeckJsonConfiguration.d.ts.map +1 -1
  68. package/dist/json/createDeckJsonConfiguration.js +86 -33
  69. package/dist/json/createDeckJsonConfiguration.js.map +1 -1
  70. package/dist/json/defaultClasses.d.ts +12 -6
  71. package/dist/json/defaultClasses.d.ts.map +1 -1
  72. package/dist/json/defaultClasses.js +7 -1
  73. package/dist/json/defaultClasses.js.map +1 -1
  74. package/dist/json/extractColorScaleLegends.d.ts +1 -1
  75. package/dist/json/extractColorScaleLegends.d.ts.map +1 -1
  76. package/dist/json/extractColorScaleLegends.js +8 -6
  77. package/dist/json/extractColorScaleLegends.js.map +1 -1
  78. package/dist/json/layerCompatibility.d.ts +9 -3
  79. package/dist/json/layerCompatibility.d.ts.map +1 -1
  80. package/dist/json/layerCompatibility.js +135 -11
  81. package/dist/json/layerCompatibility.js.map +1 -1
  82. package/dist/json/layerConfig.d.ts +7 -3
  83. package/dist/json/layerConfig.d.ts.map +1 -1
  84. package/dist/json/layerConfig.js +19 -8
  85. package/dist/json/layerConfig.js.map +1 -1
  86. package/dist/prepare/detectGeometryColumn.d.ts.map +1 -1
  87. package/dist/prepare/detectGeometryColumn.js +1 -1
  88. package/dist/prepare/detectGeometryColumn.js.map +1 -1
  89. package/dist/prepare/geoarrow.d.ts.map +1 -1
  90. package/dist/prepare/geoarrow.js.map +1 -1
  91. package/dist/prepare/geometryDecoder.d.ts +1 -2
  92. package/dist/prepare/geometryDecoder.d.ts.map +1 -1
  93. package/dist/prepare/geometryDecoder.js.map +1 -1
  94. package/dist/prepare/prepareDeckDataset.d.ts +46 -0
  95. package/dist/prepare/prepareDeckDataset.d.ts.map +1 -1
  96. package/dist/prepare/prepareDeckDataset.js +46 -0
  97. package/dist/prepare/prepareDeckDataset.js.map +1 -1
  98. package/dist/prepare/toGeoJsonBinary.d.ts.map +1 -1
  99. package/dist/prepare/toGeoJsonBinary.js +3 -2
  100. package/dist/prepare/toGeoJsonBinary.js.map +1 -1
  101. package/dist/prepare/wkbDecoder.d.ts.map +1 -1
  102. package/dist/prepare/wkbDecoder.js +36 -9
  103. package/dist/prepare/wkbDecoder.js.map +1 -1
  104. package/dist/types.d.ts +31 -92
  105. package/dist/types.d.ts.map +1 -1
  106. package/dist/types.js +6 -1
  107. package/dist/types.js.map +1 -1
  108. package/dist/useDeckLayersReadyRedraw.d.ts +13 -0
  109. package/dist/useDeckLayersReadyRedraw.d.ts.map +1 -0
  110. package/dist/useDeckLayersReadyRedraw.js +35 -0
  111. package/dist/useDeckLayersReadyRedraw.js.map +1 -0
  112. package/package.json +35 -29
  113. package/dist/ColorScaleLegend.d.ts +0 -8
  114. package/dist/ColorScaleLegend.d.ts.map +0 -1
  115. package/dist/ColorScaleLegend.js +0 -11
  116. package/dist/ColorScaleLegend.js.map +0 -1
  117. package/dist/DeckMap.d.ts +0 -4
  118. package/dist/DeckMap.d.ts.map +0 -1
  119. package/dist/DeckMap.js.map +0 -1
  120. package/dist/datasets/usePreparedDeckDatasets.d.ts +0 -3
  121. package/dist/datasets/usePreparedDeckDatasets.d.ts.map +0 -1
  122. package/dist/datasets/usePreparedDeckDatasets.js +0 -61
  123. package/dist/datasets/usePreparedDeckDatasets.js.map +0 -1
@@ -5,7 +5,13 @@ const LAYER_COMPATIBILITY = {
5
5
  },
6
6
  GeoArrowScatterplotLayer: {
7
7
  representation: 'geoarrow',
8
- geometryProp: 'getPosition',
8
+ bindings: [
9
+ {
10
+ prop: 'getPosition',
11
+ kind: 'geometry',
12
+ configKey: 'geometryColumn',
13
+ },
14
+ ],
9
15
  vectorAccessorProps: [
10
16
  'getPosition',
11
17
  'getRadius',
@@ -13,26 +19,144 @@ const LAYER_COMPATIBILITY = {
13
19
  'getLineColor',
14
20
  'getLineWidth',
15
21
  ],
22
+ allowGeoArrowPromotion: true,
23
+ },
24
+ GeoArrowHeatmapLayer: {
25
+ representation: 'geoarrow',
26
+ bindings: [
27
+ {
28
+ prop: 'getPosition',
29
+ kind: 'geometry',
30
+ configKey: 'geometryColumn',
31
+ },
32
+ ],
33
+ vectorAccessorProps: ['getPosition', 'getWeight'],
34
+ allowGeoArrowPromotion: true,
35
+ },
36
+ GeoArrowColumnLayer: {
37
+ representation: 'geoarrow',
38
+ bindings: [
39
+ {
40
+ prop: 'getPosition',
41
+ kind: 'geometry',
42
+ configKey: 'geometryColumn',
43
+ },
44
+ ],
45
+ vectorAccessorProps: [
46
+ 'getPosition',
47
+ 'getFillColor',
48
+ 'getLineColor',
49
+ 'getLineWidth',
50
+ 'getElevation',
51
+ ],
52
+ allowGeoArrowPromotion: true,
16
53
  },
17
54
  GeoArrowPathLayer: {
18
55
  representation: 'geoarrow',
19
- geometryProp: 'getPath',
56
+ bindings: [
57
+ {
58
+ prop: 'getPath',
59
+ kind: 'geometry',
60
+ configKey: 'geometryColumn',
61
+ },
62
+ ],
20
63
  vectorAccessorProps: ['getPath', 'getColor', 'getWidth'],
21
64
  },
65
+ GeoArrowTripsLayer: {
66
+ representation: 'geoarrow',
67
+ bindings: [
68
+ {
69
+ prop: 'getPath',
70
+ kind: 'geometry',
71
+ configKey: 'geometryColumn',
72
+ },
73
+ {
74
+ prop: 'getTimestamps',
75
+ kind: 'column',
76
+ configKey: 'timestampColumn',
77
+ required: true,
78
+ },
79
+ ],
80
+ vectorAccessorProps: ['getPath', 'getTimestamps', 'getColor', 'getWidth'],
81
+ },
82
+ GeoArrowPolygonLayer: {
83
+ representation: 'geoarrow',
84
+ bindings: [
85
+ {
86
+ prop: 'getPolygon',
87
+ kind: 'geometry',
88
+ configKey: 'geometryColumn',
89
+ },
90
+ ],
91
+ vectorAccessorProps: [
92
+ 'getPolygon',
93
+ 'getFillColor',
94
+ 'getLineColor',
95
+ 'getLineWidth',
96
+ 'getElevation',
97
+ ],
98
+ },
22
99
  GeoArrowSolidPolygonLayer: {
23
100
  representation: 'geoarrow',
24
- geometryProp: 'getPolygon',
25
- vectorAccessorProps: ['getPolygon', 'getElevation', 'getFillColor', 'getLineColor'],
101
+ bindings: [
102
+ {
103
+ prop: 'getPolygon',
104
+ kind: 'geometry',
105
+ configKey: 'geometryColumn',
106
+ },
107
+ ],
108
+ vectorAccessorProps: [
109
+ 'getPolygon',
110
+ 'getElevation',
111
+ 'getFillColor',
112
+ 'getLineColor',
113
+ ],
114
+ },
115
+ GeoArrowArcLayer: {
116
+ representation: 'geoarrow',
117
+ bindings: [
118
+ {
119
+ prop: 'getSourcePosition',
120
+ kind: 'geometry',
121
+ configKey: 'sourceGeometryColumn',
122
+ required: true,
123
+ },
124
+ {
125
+ prop: 'getTargetPosition',
126
+ kind: 'geometry',
127
+ configKey: 'targetGeometryColumn',
128
+ required: true,
129
+ },
130
+ ],
131
+ vectorAccessorProps: [
132
+ 'getSourcePosition',
133
+ 'getTargetPosition',
134
+ 'getSourceColor',
135
+ 'getTargetColor',
136
+ 'getWidth',
137
+ 'getHeight',
138
+ 'getTilt',
139
+ ],
140
+ },
141
+ GeoArrowH3HexagonLayer: {
142
+ representation: 'geoarrow',
143
+ bindings: [
144
+ {
145
+ prop: 'getHexagon',
146
+ kind: 'column',
147
+ configKey: 'hexagonColumn',
148
+ required: true,
149
+ },
150
+ ],
151
+ vectorAccessorProps: [
152
+ 'getHexagon',
153
+ 'getFillColor',
154
+ 'getLineColor',
155
+ 'getElevation',
156
+ ],
26
157
  },
27
158
  };
28
159
  export function getLayerCompatibility(layerName) {
29
160
  return LAYER_COMPATIBILITY[layerName];
30
161
  }
31
- export function isSupportedGeoArrowLayerType(layerName) {
32
- return [
33
- 'GeoArrowScatterplotLayer',
34
- 'GeoArrowPathLayer',
35
- 'GeoArrowSolidPolygonLayer',
36
- ].includes(layerName);
37
- }
38
162
  //# sourceMappingURL=layerCompatibility.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"layerCompatibility.js","sourceRoot":"","sources":["../../src/json/layerCompatibility.ts"],"names":[],"mappings":"AAeA,MAAM,mBAAmB,GAAuC;IAC9D,YAAY,EAAE;QACZ,cAAc,EAAE,SAAS;QACzB,mBAAmB,EAAE,EAAE;KACxB;IACD,wBAAwB,EAAE;QACxB,cAAc,EAAE,UAAU;QAC1B,YAAY,EAAE,aAAa;QAC3B,mBAAmB,EAAE;YACnB,aAAa;YACb,WAAW;YACX,cAAc;YACd,cAAc;YACd,cAAc;SACf;KACF;IACD,iBAAiB,EAAE;QACjB,cAAc,EAAE,UAAU;QAC1B,YAAY,EAAE,SAAS;QACvB,mBAAmB,EAAE,CAAC,SAAS,EAAE,UAAU,EAAE,UAAU,CAAC;KACzD;IACD,yBAAyB,EAAE;QACzB,cAAc,EAAE,UAAU;QAC1B,YAAY,EAAE,YAAY;QAC1B,mBAAmB,EAAE,CAAC,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,CAAC;KACpF;CACF,CAAC;AAEF,MAAM,UAAU,qBAAqB,CAAC,SAAiB;IACrD,OAAO,mBAAmB,CAAC,SAAS,CAAC,CAAC;AACxC,CAAC;AAED,MAAM,UAAU,4BAA4B,CAC1C,SAAiB;IAEjB,OAAO;QACL,0BAA0B;QAC1B,mBAAmB;QACnB,2BAA2B;KAC5B,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;AACxB,CAAC","sourcesContent":["import type {SupportedGeoArrowLayerType} from '../prepare/geometryDecoder';\n\ntype GeoJsonCompatibility = {\n representation: 'geojson';\n vectorAccessorProps: string[];\n};\n\ntype GeoArrowCompatibility = {\n representation: 'geoarrow';\n geometryProp: string;\n vectorAccessorProps: string[];\n};\n\ntype LayerCompatibility = GeoJsonCompatibility | GeoArrowCompatibility;\n\nconst LAYER_COMPATIBILITY: Record<string, LayerCompatibility> = {\n GeoJsonLayer: {\n representation: 'geojson',\n vectorAccessorProps: [],\n },\n GeoArrowScatterplotLayer: {\n representation: 'geoarrow',\n geometryProp: 'getPosition',\n vectorAccessorProps: [\n 'getPosition',\n 'getRadius',\n 'getFillColor',\n 'getLineColor',\n 'getLineWidth',\n ],\n },\n GeoArrowPathLayer: {\n representation: 'geoarrow',\n geometryProp: 'getPath',\n vectorAccessorProps: ['getPath', 'getColor', 'getWidth'],\n },\n GeoArrowSolidPolygonLayer: {\n representation: 'geoarrow',\n geometryProp: 'getPolygon',\n vectorAccessorProps: ['getPolygon', 'getElevation', 'getFillColor', 'getLineColor'],\n },\n};\n\nexport function getLayerCompatibility(layerName: string) {\n return LAYER_COMPATIBILITY[layerName];\n}\n\nexport function isSupportedGeoArrowLayerType(\n layerName: string,\n): layerName is SupportedGeoArrowLayerType {\n return [\n 'GeoArrowScatterplotLayer',\n 'GeoArrowPathLayer',\n 'GeoArrowSolidPolygonLayer',\n ].includes(layerName);\n}\n"]}
1
+ {"version":3,"file":"layerCompatibility.js","sourceRoot":"","sources":["../../src/json/layerCompatibility.ts"],"names":[],"mappings":"AAuBA,MAAM,mBAAmB,GAAuC;IAC9D,YAAY,EAAE;QACZ,cAAc,EAAE,SAAS;QACzB,mBAAmB,EAAE,EAAE;KACxB;IACD,wBAAwB,EAAE;QACxB,cAAc,EAAE,UAAU;QAC1B,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,aAAa;gBACnB,IAAI,EAAE,UAAU;gBAChB,SAAS,EAAE,gBAAgB;aAC5B;SACF;QACD,mBAAmB,EAAE;YACnB,aAAa;YACb,WAAW;YACX,cAAc;YACd,cAAc;YACd,cAAc;SACf;QACD,sBAAsB,EAAE,IAAI;KAC7B;IACD,oBAAoB,EAAE;QACpB,cAAc,EAAE,UAAU;QAC1B,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,aAAa;gBACnB,IAAI,EAAE,UAAU;gBAChB,SAAS,EAAE,gBAAgB;aAC5B;SACF;QACD,mBAAmB,EAAE,CAAC,aAAa,EAAE,WAAW,CAAC;QACjD,sBAAsB,EAAE,IAAI;KAC7B;IACD,mBAAmB,EAAE;QACnB,cAAc,EAAE,UAAU;QAC1B,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,aAAa;gBACnB,IAAI,EAAE,UAAU;gBAChB,SAAS,EAAE,gBAAgB;aAC5B;SACF;QACD,mBAAmB,EAAE;YACnB,aAAa;YACb,cAAc;YACd,cAAc;YACd,cAAc;YACd,cAAc;SACf;QACD,sBAAsB,EAAE,IAAI;KAC7B;I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;gBACE,IAAI,EAAE,mBAAmB;gBACzB,IAAI,EAAE,UAAU;gBAChB,SAAS,EAAE,sBAAsB;gBACjC,QAAQ,EAAE,IAAI;aACf;SACF;QACD,mBAAmB,EAAE;YACnB,mBAAmB;YACnB,mBAAmB;YACnB,gBAAgB;YAChB,gBAAgB;YAChB,UAAU;YACV,WAAW;YACX,SAAS;SACV;KACF;IACD,sBAAsB,EAAE;QACtB,cAAc,EAAE,UAAU;QAC1B,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,YAAY;gBAClB,IAAI,EAAE,QAAQ;gBACd,SAAS,EAAE,eAAe;gBAC1B,QAAQ,EAAE,IAAI;aACf;SACF;QACD,mBAAmB,EAAE;YACnB,YAAY;YACZ,cAAc;YACd,cAAc;YACd,cAAc;SACf;KACF;CACF,CAAC;AAEF,MAAM,UAAU,qBAAqB,CAAC,SAAiB;IACrD,OAAO,mBAAmB,CAAC,SAAS,CAAC,CAAC;AACxC,CAAC","sourcesContent":["import type {LayerConfigColumnKey} from './layerConfig';\n\ntype GeoJsonCompatibility = {\n representation: 'geojson';\n vectorAccessorProps: string[];\n};\n\ntype GeoArrowBinding = {\n prop: string;\n kind: 'geometry' | 'column';\n configKey: LayerConfigColumnKey;\n required?: boolean;\n};\n\ntype GeoArrowCompatibility = {\n representation: 'geoarrow';\n bindings: GeoArrowBinding[];\n vectorAccessorProps: string[];\n allowGeoArrowPromotion?: boolean;\n};\n\ntype LayerCompatibility = GeoJsonCompatibility | GeoArrowCompatibility;\n\nconst LAYER_COMPATIBILITY: Record<string, LayerCompatibility> = {\n GeoJsonLayer: {\n representation: 'geojson',\n vectorAccessorProps: [],\n },\n GeoArrowScatterplotLayer: {\n representation: 'geoarrow',\n bindings: [\n {\n prop: 'getPosition',\n kind: 'geometry',\n configKey: 'geometryColumn',\n },\n ],\n vectorAccessorProps: [\n 'getPosition',\n 'getRadius',\n 'getFillColor',\n 'getLineColor',\n 'getLineWidth',\n ],\n allowGeoArrowPromotion: true,\n },\n GeoArrowHeatmapLayer: {\n representation: 'geoarrow',\n bindings: [\n {\n prop: 'getPosition',\n kind: 'geometry',\n configKey: 'geometryColumn',\n },\n ],\n vectorAccessorProps: ['getPosition', 'getWeight'],\n allowGeoArrowPromotion: true,\n },\n GeoArrowColumnLayer: {\n representation: 'geoarrow',\n bindings: [\n {\n prop: 'getPosition',\n kind: 'geometry',\n configKey: 'geometryColumn',\n },\n ],\n vectorAccessorProps: [\n 'getPosition',\n 'getFillColor',\n 'getLineColor',\n 'getLineWidth',\n 'getElevation',\n ],\n allowGeoArrowPromotion: true,\n },\n GeoArrowPathLayer: {\n representation: 'geoarrow',\n bindings: [\n {\n prop: 'getPath',\n kind: 'geometry',\n configKey: 'geometryColumn',\n },\n ],\n vectorAccessorProps: ['getPath', 'getColor', 'getWidth'],\n },\n GeoArrowTripsLayer: {\n representation: 'geoarrow',\n bindings: [\n {\n prop: 'getPath',\n kind: 'geometry',\n configKey: 'geometryColumn',\n },\n {\n prop: 'getTimestamps',\n kind: 'column',\n configKey: 'timestampColumn',\n required: true,\n },\n ],\n vectorAccessorProps: ['getPath', 'getTimestamps', 'getColor', 'getWidth'],\n },\n GeoArrowPolygonLayer: {\n representation: 'geoarrow',\n bindings: [\n {\n prop: 'getPolygon',\n kind: 'geometry',\n configKey: 'geometryColumn',\n },\n ],\n vectorAccessorProps: [\n 'getPolygon',\n 'getFillColor',\n 'getLineColor',\n 'getLineWidth',\n 'getElevation',\n ],\n },\n GeoArrowSolidPolygonLayer: {\n representation: 'geoarrow',\n bindings: [\n {\n prop: 'getPolygon',\n kind: 'geometry',\n configKey: 'geometryColumn',\n },\n ],\n vectorAccessorProps: [\n 'getPolygon',\n 'getElevation',\n 'getFillColor',\n 'getLineColor',\n ],\n },\n GeoArrowArcLayer: {\n representation: 'geoarrow',\n bindings: [\n {\n prop: 'getSourcePosition',\n kind: 'geometry',\n configKey: 'sourceGeometryColumn',\n required: true,\n },\n {\n prop: 'getTargetPosition',\n kind: 'geometry',\n configKey: 'targetGeometryColumn',\n required: true,\n },\n ],\n vectorAccessorProps: [\n 'getSourcePosition',\n 'getTargetPosition',\n 'getSourceColor',\n 'getTargetColor',\n 'getWidth',\n 'getHeight',\n 'getTilt',\n ],\n },\n GeoArrowH3HexagonLayer: {\n representation: 'geoarrow',\n bindings: [\n {\n prop: 'getHexagon',\n kind: 'column',\n configKey: 'hexagonColumn',\n required: true,\n },\n ],\n vectorAccessorProps: [\n 'getHexagon',\n 'getFillColor',\n 'getLineColor',\n 'getElevation',\n ],\n },\n};\n\nexport function getLayerCompatibility(layerName: string) {\n return LAYER_COMPATIBILITY[layerName];\n}\n"]}
@@ -1,10 +1,14 @@
1
- import type { LayerColorLegendConfig, LayerColorScale } from '../types';
1
+ import type { ColorLegendConfig, ColorScaleConfig } from '@sqlrooms/color-scales';
2
+ import type { ColorScaleFunction, LayerBindingConfig } from '../DeckJsonMapSpec';
3
+ export type LayerConfigColumnKey = keyof Pick<LayerBindingConfig, 'geometryColumn' | 'sourceGeometryColumn' | 'targetGeometryColumn' | 'timestampColumn' | 'hexagonColumn'>;
2
4
  export declare function resolveDatasetId(props: Record<string, unknown>, datasetIds: string[]): string | undefined;
3
5
  export declare function isManagedLayer(props: Record<string, unknown>, datasetIds: string[]): boolean;
4
6
  export declare function stripLayerExtensionProps(props: Record<string, unknown>): {
5
7
  [x: string]: unknown;
6
8
  };
7
9
  export declare function resolveGeometryColumn(props: Record<string, unknown>): string | undefined;
8
- export declare function resolveColorScale(props: Record<string, unknown>): LayerColorScale | undefined;
9
- export declare function resolveColorLegend(props: Record<string, unknown>): LayerColorLegendConfig | undefined;
10
+ export declare function resolveConfiguredColumn(props: Record<string, unknown>, key: LayerConfigColumnKey): string | undefined;
11
+ export declare function isColorScaleFunction(value: unknown): value is ColorScaleFunction;
12
+ export declare function resolveColorScale(props: Record<string, unknown>, key?: string): ColorScaleConfig | undefined;
13
+ export declare function resolveColorLegend(props: Record<string, unknown>, key?: string): ColorLegendConfig | undefined;
10
14
  //# sourceMappingURL=layerConfig.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"layerConfig.d.ts","sourceRoot":"","sources":["../../src/json/layerConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sBAAsB,EACtB,eAAe,EAEhB,MAAM,UAAU,CAAC;AAelB,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,UAAU,EAAE,MAAM,EAAE,sBAarB;AAED,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,UAAU,EAAE,MAAM,EAAE,WAGrB;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;EAItE;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,sBAKnE;AAED,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B,eAAe,GAAG,SAAS,CAG7B;AAED,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B,sBAAsB,GAAG,SAAS,CAEpC"}
1
+ {"version":3,"file":"layerConfig.d.ts","sourceRoot":"","sources":["../../src/json/layerConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,iBAAiB,EAAE,gBAAgB,EAAC,MAAM,wBAAwB,CAAC;AAChF,OAAO,KAAK,EACV,kBAAkB,EAClB,kBAAkB,EAEnB,MAAM,oBAAoB,CAAC;AAoB5B,MAAM,MAAM,oBAAoB,GAAG,MAAM,IAAI,CAC3C,kBAAkB,EAChB,gBAAgB,GAChB,sBAAsB,GACtB,sBAAsB,GACtB,iBAAiB,GACjB,eAAe,CAClB,CAAC;AAEF,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,UAAU,EAAE,MAAM,EAAE,sBAarB;AAED,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,UAAU,EAAE,MAAM,EAAE,WAGrB;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;EAItE;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,sBAKnE;AAED,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,GAAG,EAAE,oBAAoB,sBAK1B;AAED,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,kBAAkB,CAM7B;AAED,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,GAAG,CAAC,EAAE,MAAM,GACX,gBAAgB,GAAG,SAAS,CAG9B;AAED,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,GAAG,CAAC,EAAE,MAAM,GACX,iBAAiB,GAAG,SAAS,CAE/B"}
@@ -1,12 +1,13 @@
1
1
  function hasExtensionKeys(props) {
2
- return '_sqlrooms' in props;
2
+ return (typeof props._sqlroomsBinding === 'object' && props._sqlroomsBinding != null);
3
3
  }
4
4
  function getLayerConfig(props) {
5
5
  const layerProps = props;
6
- if (!layerProps._sqlrooms || typeof layerProps._sqlrooms !== 'object') {
6
+ if (!layerProps._sqlroomsBinding ||
7
+ typeof layerProps._sqlroomsBinding !== 'object') {
7
8
  return undefined;
8
9
  }
9
- return layerProps._sqlrooms;
10
+ return layerProps._sqlroomsBinding;
10
11
  }
11
12
  export function resolveDatasetId(props, datasetIds) {
12
13
  const layerProps = props;
@@ -24,7 +25,7 @@ export function isManagedLayer(props, datasetIds) {
24
25
  }
25
26
  export function stripLayerExtensionProps(props) {
26
27
  const nextProps = { ...props };
27
- delete nextProps._sqlrooms;
28
+ delete nextProps._sqlroomsBinding;
28
29
  return nextProps;
29
30
  }
30
31
  export function resolveGeometryColumn(props) {
@@ -33,11 +34,21 @@ export function resolveGeometryColumn(props) {
33
34
  ? config.geometryColumn
34
35
  : undefined;
35
36
  }
36
- export function resolveColorScale(props) {
37
+ export function resolveConfiguredColumn(props, key) {
37
38
  const config = getLayerConfig(props);
38
- return config?.colorScale;
39
+ const value = config?.[key];
40
+ return typeof value === 'string' && value ? value : undefined;
39
41
  }
40
- export function resolveColorLegend(props) {
41
- return resolveColorScale(props)?.legend;
42
+ export function isColorScaleFunction(value) {
43
+ return Boolean(value &&
44
+ typeof value === 'object' &&
45
+ value['@@function'] === 'colorScale');
46
+ }
47
+ export function resolveColorScale(props, key) {
48
+ const value = key ? props[key] : undefined;
49
+ return isColorScaleFunction(value) ? value : undefined;
50
+ }
51
+ export function resolveColorLegend(props, key) {
52
+ return resolveColorScale(props, key)?.legend;
42
53
  }
43
54
  //# sourceMappingURL=layerConfig.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"layerConfig.js","sourceRoot":"","sources":["../../src/json/layerConfig.ts"],"names":[],"mappings":"AAMA,SAAS,gBAAgB,CAAC,KAA8B;IACtD,OAAO,WAAW,IAAI,KAAK,CAAC;AAC9B,CAAC;AAED,SAAS,cAAc,CAAC,KAA8B;IACpD,MAAM,UAAU,GAAG,KAA+C,CAAC;IACnE,IAAI,CAAC,UAAU,CAAC,SAAS,IAAI,OAAO,UAAU,CAAC,SAAS,KAAK,QAAQ,EAAE,CAAC;QACtE,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,UAAU,CAAC,SAAS,CAAC;AAC9B,CAAC;AAED,MAAM,UAAU,gBAAgB,CAC9B,KAA8B,EAC9B,UAAoB;IAEpB,MAAM,UAAU,GAAG,KAA+C,CAAC;IACnE,M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ale,\n LayerExtensionProps,\n} from '../types';\n\nfunction hasExtensionKeys(props: Record<string, unknown>) {\n return '_sqlrooms' in props;\n}\n\nfunction getLayerConfig(props: Record<string, unknown>) {\n const layerProps = props as LayerExtensionProps & {data?: unknown};\n if (!layerProps._sqlrooms || typeof layerProps._sqlrooms !== 'object') {\n return undefined;\n }\n\n return layerProps._sqlrooms;\n}\n\nexport function resolveDatasetId(\n props: Record<string, unknown>,\n datasetIds: string[],\n) {\n const layerProps = props as LayerExtensionProps & {data?: unknown};\n const config = getLayerConfig(props);\n if (typeof config?.dataset === 'string' && config.dataset) {\n return config.dataset;\n }\n\n if (datasetIds.length === 1 && layerProps.data === undefined) {\n return datasetIds[0];\n }\n\n return undefined;\n}\n\nexport function isManagedLayer(\n props: Record<string, unknown>,\n datasetIds: string[],\n) {\n return hasExtensionKeys(props) || resolveDatasetId(props, datasetIds) != null;\n}\n\nexport function stripLayerExtensionProps(props: Record<string, unknown>) {\n const nextProps = {...props};\n delete nextProps._sqlrooms;\n return nextProps;\n}\n\nexport function resolveGeometryColumn(props: Record<string, unknown>) {\n const config = getLayerConfig(props);\n return typeof config?.geometryColumn === 'string' && config.geometryColumn\n ? config.geometryColumn\n : undefined;\n}\n\nexport function resolveColorScale(\n props: Record<string, unknown>,\n): LayerColorScale | undefined {\n const config = getLayerConfig(props);\n return config?.colorScale;\n}\n\nexport function resolveColorLegend(\n props: Record<string, unknown>,\n): LayerColorLegendConfig | undefined {\n return resolveColorScale(props)?.legend;\n}\n"]}
1
+ {"version":3,"file":"layerConfig.js","sourceRoot":"","sources":["../../src/json/layerConfig.ts"],"names":[],"mappings":"AAOA,SAAS,gBAAgB,CAAC,KAA8B;IACtD,OAAO,CACL,OAAO,KAAK,CAAC,gBAAgB,KAAK,QAAQ,IAAI,KAAK,CAAC,gBAAgB,IAAI,IAAI,CAC7E,CAAC;AACJ,CAAC;AAED,SAAS,cAAc,CAAC,KAA8B;IACpD,MAAM,UAAU,GAAG,KAA6C,CAAC;IAC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AAU,uBAAuB,CACrC,KAA8B,EAC9B,GAAyB;IAEzB,MAAM,MAAM,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;IACrC,MAAM,KAAK,GAAG,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC;IAC5B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AAChE,CAAC;AAED,MAAM,UAAU,oBAAoB,CAClC,KAAc;IAEd,OAAO,OAAO,CACZ,KAAK;QACL,OAAO,KAAK,KAAK,QAAQ;QACxB,KAAkC,CAAC,YAAY,CAAC,KAAK,YAAY,CACnE,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,iBAAiB,CAC/B,KAA8B,EAC9B,GAAY;IAEZ,MAAM,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC3C,OAAO,oBAAoB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACzD,CAAC;AAED,MAAM,UAAU,kBAAkB,CAChC,KAA8B,EAC9B,GAAY;IAEZ,OAAO,iBAAiB,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC;AAC/C,CAAC","sourcesContent":["import type {ColorLegendConfig, ColorScaleConfig} from '@sqlrooms/color-scales';\nimport type {\n ColorScaleFunction,\n LayerBindingConfig,\n LayerBindingProps,\n} from '../DeckJsonMapSpec';\n\nfunction hasExtensionKeys(props: Record<string, unknown>) {\n return (\n typeof props._sqlroomsBinding === 'object' && props._sqlroomsBinding != null\n );\n}\n\nfunction getLayerConfig(props: Record<string, unknown>) {\n const layerProps = props as LayerBindingProps & {data?: unknown};\n if (\n !layerProps._sqlroomsBinding ||\n typeof layerProps._sqlroomsBinding !== 'object'\n ) {\n return undefined;\n }\n\n return layerProps._sqlroomsBinding;\n}\n\nexport type LayerConfigColumnKey = keyof Pick<\n LayerBindingConfig,\n | 'geometryColumn'\n | 'sourceGeometryColumn'\n | 'targetGeometryColumn'\n | 'timestampColumn'\n | 'hexagonColumn'\n>;\n\nexport function resolveDatasetId(\n props: Record<string, unknown>,\n datasetIds: string[],\n) {\n const layerProps = props as LayerBindingProps & {data?: unknown};\n const config = getLayerConfig(props);\n if (typeof config?.dataset === 'string' && config.dataset) {\n return config.dataset;\n }\n\n if (datasetIds.length === 1 && layerProps.data === undefined) {\n return datasetIds[0];\n }\n\n return undefined;\n}\n\nexport function isManagedLayer(\n props: Record<string, unknown>,\n datasetIds: string[],\n) {\n return hasExtensionKeys(props) || resolveDatasetId(props, datasetIds) != null;\n}\n\nexport function stripLayerExtensionProps(props: Record<string, unknown>) {\n const nextProps = {...props};\n delete nextProps._sqlroomsBinding;\n return nextProps;\n}\n\nexport function resolveGeometryColumn(props: Record<string, unknown>) {\n const config = getLayerConfig(props);\n return typeof config?.geometryColumn === 'string' && config.geometryColumn\n ? config.geometryColumn\n : undefined;\n}\n\nexport function resolveConfiguredColumn(\n props: Record<string, unknown>,\n key: LayerConfigColumnKey,\n) {\n const config = getLayerConfig(props);\n const value = config?.[key];\n return typeof value === 'string' && value ? value : undefined;\n}\n\nexport function isColorScaleFunction(\n value: unknown,\n): value is ColorScaleFunction {\n return Boolean(\n value &&\n typeof value === 'object' &&\n (value as {'@@function'?: unknown})['@@function'] === 'colorScale',\n );\n}\n\nexport function resolveColorScale(\n props: Record<string, unknown>,\n key?: string,\n): ColorScaleConfig | undefined {\n const value = key ? props[key] : undefined;\n return isColorScaleFunction(value) ? value : undefined;\n}\n\nexport function resolveColorLegend(\n props: Record<string, unknown>,\n key?: string,\n): ColorLegendConfig | undefined {\n return resolveColorScale(props, key)?.legend;\n}\n"]}
@@ -1 +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"}
1
+ {"version":3,"file":"detectGeometryColumn.d.ts","sourceRoot":"","sources":["../../src/prepare/detectGeometryColumn.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAE3C,OAAO,KAAK,EACV,oBAAoB,EACpB,sBAAsB,EAEvB,MAAM,SAAS,CAAC;AAEjB,KAAK,2BAA2B,GAAG;IACjC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;CAC7C,CAAC;AAmEF,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,2BAA2B,GACnC,sBAAsB,CA0CxB"}
@@ -1,4 +1,4 @@
1
- import { getGeoMetadata, getGeometryColumnsFromSchema } from '@loaders.gl/geoarrow';
1
+ import { getGeoMetadata, getGeometryColumnsFromSchema, } from '@loaders.gl/geoarrow';
2
2
  import { isDirectGeoArrowEncoding } from './geoarrow';
3
3
  function getFieldNames(table) {
4
4
  return table.schema.fields.map((field) => field.name);
@@ -1 +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,a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C;QAC5B,MAAM,IAAI,KAAK,CACb,0DAA0D,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAClF,CAAC;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"]}
1
+ {"version":3,"file":"detectGeometryColumn.js","sourceRoot":"","sources":["../../src/prepare/detectGeometryColumn.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,4BAA4B,GAC7B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAC,wBAAwB,EAAC,MAAM,YAAY,CAAC;AAapD,SAAS,aAAa,CAAC,KAAkB;IACvC,OAAO,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AACxD,CAAC;AAED,SAAS,cAAc,CAAC,KAAkB,EAAE,SAAiB;IAC3D,MAAM,MAAM,GAAG,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IACzC,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CACb,oBAAoB,SAAS,qCAAqC,CACnE,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,iBAAiB,CACxB,QAA4B;IAE5B,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,UAAU,GAAG,QAAQ,CAAC,WAAW,EAA8B,CAAC;IACtE,QAAQ,UAAU,EAAE,CAAC;QACnB,KAAK,gBAAgB,CAAC;QACtB,KAAK,qBAAqB,CAAC;QAC3B,KAAK,qBAAqB,CAAC;QAC3B,KAAK,0BAA0B,CAAC;QAChC,KAAK,kBAAkB,CAAC;QACxB,KAAK,uBAAuB,CAAC;QAC7B,KAAK,cAAc,CAAC;QACpB,KAAK,cAAc,CAAC;QACpB,KAAK,KAAK,CAAC;QACX,KAAK,KAAK;YACR,OAAO,UAAU,CAAC;QACpB;YACE,OAAO,SAAS,CAAC;IACrB,CAAC;AACH,CAAC;A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B,sBAAsB;QACtB,CAAC,kBAAkB,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QACxE,CAAC,eAAe,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAElE,IAAI,CAAC,sBAAsB,EAAE,CAAC;QAC5B,MAAM,IAAI,KAAK,CACb,0DAA0D,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAClF,CAAC;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 {\n getGeoMetadata,\n getGeometryColumnsFromSchema,\n} from '@loaders.gl/geoarrow';\nimport type * as arrow from 'apache-arrow';\nimport {isDirectGeoArrowEncoding} from './geoarrow';\nimport type {\n GeometryEncodingHint,\n ResolvedGeometryColumn,\n ResolvedGeometryEncoding,\n} from './types';\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(\n `Geometry column \"${fieldName}\" was not found in the Arrow table.`,\n );\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(\n vector: arrow.Vector,\n): 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"]}
@@ -1 +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"}
1
+ {"version":3,"file":"geoarrow.d.ts","sourceRoot":"","sources":["../../src/prepare/geoarrow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAE3C,OAAO,KAAK,EAAC,sBAAsB,EAAE,wBAAwB,EAAC,MAAM,SAAS,CAAC;AAuF9E,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,wBAAwB,GACjC,OAAO,CAST;AAED,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,OAAO,EACd,QAAQ,EA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QAAkC;IAElC,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;QAClB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,gBAAgB;YACnB,OAAO,eAAe,CAAC,KAAK,CAAC,CAAC;QAChC,KAAK,qBAAqB;YACxB,OAAO,oBAAoB,CAAC,KAAK,CAAC,CAAC;QACrC,KAAK,qBAAqB;YACxB,OAAO,oBAAoB,CAAC,KAAK,CAAC,CAAC;QACrC,KAAK,0BAA0B;YAC7B,OAAO,yBAAyB,CAAC,KAAK,CAAC,CAAC;QAC1C,KAAK,kBAAkB;YACrB,OAAO,iBAAiB,CAAC,KAAK,CAAC,CAAC;QAClC,KAAK,uBAAuB;YAC1B,OAAO,sBAAsB,CAAC,KAAK,CAAC,CAAC;QACvC;YACE,OAAO,IAAI,CAAC;IAChB,CAAC;AACH,CAAC;AAED,MAAM,UAAU,6BAA6B,CAC3C,KAAkB,EAClB,QAAgC;IAEhC,OAAO,sBAAsB,CAAC;QAC5B,KAAK;QACL,kBAAkB,EAAE,QAAQ,CAAC,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"]}
1
+ {"version":3,"file":"geoarrow.js","sourceRoot":"","sources":["../../src/prepare/geoarrow.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,sBAAsB,EAAC,MAAM,mBAAmB,CAAC;AAGzD,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,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC;IACtB,CAAC;IACD,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,IAAI,KAAK,EAAE,CAAC;QACzD,OAAQ,KAA2C,CAAC,GAAG,CAAC,KAAK,CAAC,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import {buildBinaryGeoJsonData} from './toGeoJsonBinary';\nimport type {ResolvedGeometryColumn, ResolvedGeometryEncoding} from './types';\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) =>\n Number(coordinate),\n );\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"]}
@@ -1,8 +1,7 @@
1
1
  import type * as arrow from 'apache-arrow';
2
2
  import type { PreparedGeoArrowLayerData, ResolvedGeometryEncoding } from './types';
3
- export type SupportedGeoArrowLayerType = 'GeoArrowScatterplotLayer' | 'GeoArrowPathLayer' | 'GeoArrowSolidPolygonLayer';
4
3
  export type GeometryDecoder = {
5
- supportsGeoArrowPromotion: (layerType: SupportedGeoArrowLayerType, encoding: ResolvedGeometryEncoding, table: arrow.Table, columnName: string) => boolean;
4
+ supportsGeoArrowPromotion: (layerType: string, encoding: ResolvedGeometryEncoding, table: arrow.Table, columnName: string) => boolean;
6
5
  toGeoArrowLike: (table: arrow.Table, columnName: string, encoding: ResolvedGeometryEncoding) => PreparedGeoArrowLayerData;
7
6
  toGeoJsonBinary: (table: arrow.Table, columnName: string, encoding: ResolvedGeometryEncoding) => unknown;
8
7
  };
@@ -1 +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"}
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,EACV,yBAAyB,EACzB,wBAAwB,EACzB,MAAM,SAAS,CAAC;AAEjB,MAAM,MAAM,eAAe,GAAG;IAC5B,yBAAyB,EAAE,CACzB,SAAS,EAAE,MAAM,EACjB,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"}
@@ -1 +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"]}
1
+ {"version":3,"file":"geometryDecoder.js","sourceRoot":"","sources":["../../src/prepare/geometryDecoder.ts"],"names":[],"mappings":"","sourcesContent":["import type * as arrow from 'apache-arrow';\nimport type {\n PreparedGeoArrowLayerData,\n ResolvedGeometryEncoding,\n} from './types';\n\nexport type GeometryDecoder = {\n supportsGeoArrowPromotion: (\n layerType: string,\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"]}
@@ -6,6 +6,52 @@ type PrepareDeckDatasetOptions = {
6
6
  geometryColumn?: string;
7
7
  geometryEncodingHint?: GeometryEncodingHint;
8
8
  };
9
+ /**
10
+ * Build the reusable deck-facing geometry helpers for one resolved Arrow table.
11
+ *
12
+ * This is the expensive preparation step that `preparedDatasetStore` caches.
13
+ * It accepts one resolved Arrow table plus a geometry column/hint and turns
14
+ * the source geometry into canonical deck-facing outputs that can be reused by
15
+ * multiple layers and multiple `DeckJsonMap` instances.
16
+ *
17
+ * Supported input geometry forms:
18
+ *
19
+ * - native GeoArrow columns
20
+ * Already columnar and geometry-aware. These are the cheapest inputs:
21
+ * preparation mainly does geometry-column detection plus lightweight wrapper
22
+ * shaping so GeoArrow-capable deck layers can consume the Arrow table/vector
23
+ * directly.
24
+ * - WKB / GeoArrow WKB columns
25
+ * Binary geometry needs decoding because deck layers cannot render raw WKB
26
+ * bytes. Preparation promotes the binary values into deck-ready geometry
27
+ * structures for GeoArrow layers and GeoJSON-binary fallback layers.
28
+ * - WKT / GeoArrow WKT columns
29
+ * Text geometry likewise needs parsing before deck can render it. This has a
30
+ * similar cost profile to WKB, but starts from text parsing rather than
31
+ * binary decoding.
32
+ *
33
+ * These transformations are necessary because the input table shape is chosen
34
+ * by the query/data source, while deck expects render-oriented geometry
35
+ * payloads. The canonical outputs produced here are:
36
+ *
37
+ * - GeoArrow layer data
38
+ * A `PreparedGeoArrowLayerData` payload for GeoArrow-native deck layers,
39
+ * either forwarded directly from native GeoArrow inputs or promoted from
40
+ * WKB/WKT into a GeoArrow-like representation.
41
+ * - GeoJSON-binary data
42
+ * A binary GeoJSON-style payload for layers such as `GeoJsonLayer` that do
43
+ * not consume GeoArrow inputs directly.
44
+ *
45
+ * The returned object also memoizes:
46
+ *
47
+ * - geometry column detection
48
+ * - GeoArrow layer payloads
49
+ * - GeoJSON-binary fallbacks
50
+ *
51
+ * Caching at this level lets deck reuse geometry decoding and shaping work
52
+ * even when the upstream query result is already cached by another system such
53
+ * as Mosaic's query manager.
54
+ */
9
55
  export declare function prepareDeckDataset(options: PrepareDeckDatasetOptions): PreparedDeckDataset;
10
56
  export {};
11
57
  //# sourceMappingURL=prepareDeckDataset.d.ts.map
@@ -1 +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"}
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,yBAAyB,GACjC,mBAAmB,CA4ErB"}
@@ -1,6 +1,52 @@
1
1
  import { detectGeometryColumn } from './detectGeometryColumn';
2
2
  import { buildNativeGeoArrowBinaryData, isDirectGeoArrowEncoding, } from './geoarrow';
3
3
  import { wkbGeometryDecoder } from './wkbDecoder';
4
+ /**
5
+ * Build the reusable deck-facing geometry helpers for one resolved Arrow table.
6
+ *
7
+ * This is the expensive preparation step that `preparedDatasetStore` caches.
8
+ * It accepts one resolved Arrow table plus a geometry column/hint and turns
9
+ * the source geometry into canonical deck-facing outputs that can be reused by
10
+ * multiple layers and multiple `DeckJsonMap` instances.
11
+ *
12
+ * Supported input geometry forms:
13
+ *
14
+ * - native GeoArrow columns
15
+ * Already columnar and geometry-aware. These are the cheapest inputs:
16
+ * preparation mainly does geometry-column detection plus lightweight wrapper
17
+ * shaping so GeoArrow-capable deck layers can consume the Arrow table/vector
18
+ * directly.
19
+ * - WKB / GeoArrow WKB columns
20
+ * Binary geometry needs decoding because deck layers cannot render raw WKB
21
+ * bytes. Preparation promotes the binary values into deck-ready geometry
22
+ * structures for GeoArrow layers and GeoJSON-binary fallback layers.
23
+ * - WKT / GeoArrow WKT columns
24
+ * Text geometry likewise needs parsing before deck can render it. This has a
25
+ * similar cost profile to WKB, but starts from text parsing rather than
26
+ * binary decoding.
27
+ *
28
+ * These transformations are necessary because the input table shape is chosen
29
+ * by the query/data source, while deck expects render-oriented geometry
30
+ * payloads. The canonical outputs produced here are:
31
+ *
32
+ * - GeoArrow layer data
33
+ * A `PreparedGeoArrowLayerData` payload for GeoArrow-native deck layers,
34
+ * either forwarded directly from native GeoArrow inputs or promoted from
35
+ * WKB/WKT into a GeoArrow-like representation.
36
+ * - GeoJSON-binary data
37
+ * A binary GeoJSON-style payload for layers such as `GeoJsonLayer` that do
38
+ * not consume GeoArrow inputs directly.
39
+ *
40
+ * The returned object also memoizes:
41
+ *
42
+ * - geometry column detection
43
+ * - GeoArrow layer payloads
44
+ * - GeoJSON-binary fallbacks
45
+ *
46
+ * Caching at this level lets deck reuse geometry decoding and shaping work
47
+ * even when the upstream query result is already cached by another system such
48
+ * as Mosaic's query manager.
49
+ */
4
50
  export function prepareDeckDataset(options) {
5
51
  const { datasetId, table, geometryColumn, geometryEncodingHint } = options;
6
52
  const resolvedGeometryCache = new Map();
@@ -1 +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,CAAC;QAC9C,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC;IAEF,OAAO;QACL,SAAS;QACT,KAAK;QACL,qBAAqB,EAAE,cAAc;QACrC,eAA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K,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"]}
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,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,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,QAAQ,CAAC;QAClB,CAAC;QACD,oBAAoB,CAAC,sBAA+B;YAClD,MAAM,QAAQ,GAAG,sBAAsB,IAAI,aAAa,CAAC;YACzD,MAAM,MAAM,GAAG,kBAAkB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YAChD,IAAI,MAAM,EAAE,CAAC;gBACX,OAAO,MAAM,CAAC;YAChB,CAAC;YAED,MAAM,QAAQ,GAAG,eAAe,CAAC,sBAAsB,CAAC,CAAC;YACzD,MAAM,UAAU,GAAG,QAAQ,CAAC,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\n/**\n * Build the reusable deck-facing geometry helpers for one resolved Arrow table.\n *\n * This is the expensive preparation step that `preparedDatasetStore` caches.\n * It accepts one resolved Arrow table plus a geometry column/hint and turns\n * the source geometry into canonical deck-facing outputs that can be reused by\n * multiple layers and multiple `DeckJsonMap` instances.\n *\n * Supported input geometry forms:\n *\n * - native GeoArrow columns\n * Already columnar and geometry-aware. These are the cheapest inputs:\n * preparation mainly does geometry-column detection plus lightweight wrapper\n * shaping so GeoArrow-capable deck layers can consume the Arrow table/vector\n * directly.\n * - WKB / GeoArrow WKB columns\n * Binary geometry needs decoding because deck layers cannot render raw WKB\n * bytes. Preparation promotes the binary values into deck-ready geometry\n * structures for GeoArrow layers and GeoJSON-binary fallback layers.\n * - WKT / GeoArrow WKT columns\n * Text geometry likewise needs parsing before deck can render it. This has a\n * similar cost profile to WKB, but starts from text parsing rather than\n * binary decoding.\n *\n * These transformations are necessary because the input table shape is chosen\n * by the query/data source, while deck expects render-oriented geometry\n * payloads. The canonical outputs produced here are:\n *\n * - GeoArrow layer data\n * A `PreparedGeoArrowLayerData` payload for GeoArrow-native deck layers,\n * either forwarded directly from native GeoArrow inputs or promoted from\n * WKB/WKT into a GeoArrow-like representation.\n * - GeoJSON-binary data\n * A binary GeoJSON-style payload for layers such as `GeoJsonLayer` that do\n * not consume GeoArrow inputs directly.\n *\n * The returned object also memoizes:\n *\n * - geometry column detection\n * - GeoArrow layer payloads\n * - GeoJSON-binary fallbacks\n *\n * Caching at this level lets deck reuse geometry decoding and shaping work\n * even when the upstream query result is already cached by another system such\n * as Mosaic's query manager.\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"]}
@@ -1 +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"}
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,CA4BT"}
@@ -4,6 +4,7 @@ export function buildBinaryGeoJsonData(options) {
4
4
  const propertyColumns = table.schema.fields
5
5
  .map((field) => field.name)
6
6
  .filter((fieldName) => fieldName !== geometryColumnName);
7
+ const propertyVectors = propertyColumns.map((name) => table.getChild(name));
7
8
  const features = [];
8
9
  for (let rowIndex = 0; rowIndex < table.numRows; rowIndex++) {
9
10
  const geometry = getGeometryAt(rowIndex);
@@ -11,8 +12,8 @@ export function buildBinaryGeoJsonData(options) {
11
12
  continue;
12
13
  }
13
14
  const properties = {};
14
- for (const fieldName of propertyColumns) {
15
- properties[fieldName] = table.getChild(fieldName)?.get(rowIndex);
15
+ for (let i = 0; i < propertyColumns.length; i++) {
16
+ properties[propertyColumns[i]] = propertyVectors[i]?.get(rowIndex);
16
17
  }
17
18
  features.push({
18
19
  type: 'Feature',
@@ -1 +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"]}
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,eAAe,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;IAE5E,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,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,eAAe,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAChD,UAAU,CAAC,eAAe,CAAC,CAAC,CAAE,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC;QACtE,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 propertyVectors = propertyColumns.map((name) => table.getChild(name));\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 (let i = 0; i < propertyColumns.length; i++) {\n properties[propertyColumns[i]!] = propertyVectors[i]?.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"]}
@@ -1 +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"}
1
+ {"version":3,"file":"wkbDecoder.d.ts","sourceRoot":"","sources":["../../src/prepare/wkbDecoder.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAgJvD,eAAO,MAAM,kBAAkB,EAAE,eAuDhC,CAAC"}