@@ -59,17 +59,15 @@ function isDataSeparatedCoords(
59
59
/**
60
60
* Check if the coordinates in a geometry are interleaved
61
61
* Returns true if the coordinates are interleaved, false if separated.
62
- *
62
+ *
63
63
* The geometry can be point, line, polygon, etc.
64
64
* The function recursively checks for the underlying
65
65
* coordinate data type when it's of type List.
66
- *
66
+ *
67
67
* If the coordinate type is neither a FixedSizeList nor a Struct,
68
68
* throw an error.
69
69
*/
70
- export function isGeomInterleaved (
71
- data : arrow . Data ,
72
- ) : boolean {
70
+ export function isGeomInterleaved ( data : arrow . Data ) : boolean {
73
71
if ( arrow . DataType . isList ( data . type ) ) {
74
72
return isGeomInterleaved ( data . children [ 0 ] ) ;
75
73
} else if ( arrow . DataType . isFixedSizeList ( data . type ) ) {
@@ -84,17 +82,15 @@ export function isGeomInterleaved(
84
82
/**
85
83
* Check if the coordinates in a geometry are separate
86
84
* Returns true if the coordinates are separate, false if they are interleaved.
87
- *
85
+ *
88
86
* The geometry can be point, line, polygon, etc.
89
87
* The function recursively checks for the underlying
90
88
* coordinate data type when it's of type List.
91
- *
89
+ *
92
90
* If the coordinate type is neither a FixedSizeList nor a Struct,
93
91
* throw an error.
94
92
*/
95
- export function isGeomSeparate (
96
- data : arrow . Data ,
97
- ) : boolean {
93
+ export function isGeomSeparate ( data : arrow . Data ) : boolean {
98
94
if ( arrow . DataType . isList ( data . type ) ) {
99
95
return isGeomSeparate ( data . children [ 0 ] ) ;
100
96
} else if ( arrow . DataType . isStruct ( data . type ) ) {
@@ -123,7 +119,7 @@ function convertStructToFixedSizeList(
123
119
} else if ( isDataSeparatedCoords ( coords ) ) {
124
120
const nDim = coords . children . length ;
125
121
const interleavedCoords = new Float64Array ( coords . length * nDim ) ;
126
-
122
+
127
123
for ( let i = 0 ; i < coords . length ; i ++ ) {
128
124
for ( let j = 0 ; j < nDim ; j ++ ) {
129
125
interleavedCoords [ i * nDim + j ] = coords . children [ j ] . values [ i ] ;
@@ -142,7 +138,7 @@ function convertStructToFixedSizeList(
142
138
data : interleavedCoords ,
143
139
} ) ;
144
140
145
- const data = arrow . makeData ( {
141
+ const data = arrow . makeData ( {
146
142
type : dataType ,
147
143
length : coords . length ,
148
144
nullCount : coords . nullCount ,
@@ -156,7 +152,6 @@ function convertStructToFixedSizeList(
156
152
throw new Error ( `Unsupported coordinate data type: ${ coords . type } ` ) ;
157
153
}
158
154
159
-
160
155
/**
161
156
* Get LineString Data with interleaved coordinates
162
157
* from the given LineString Data with separated (struct) coordinates.
@@ -169,13 +164,13 @@ export function getInterleavedLineString(
169
164
const interleavedPoints = convertStructToFixedSizeList ( points ) ;
170
165
171
166
return arrow . makeData ( {
172
- type : new arrow . List ( new arrow . Field ( ' element' , interleavedPoints . type ) ) ,
167
+ type : new arrow . List ( new arrow . Field ( " element" , interleavedPoints . type ) ) ,
173
168
length : lineStringData . length ,
174
169
nullCount : lineStringData . nullCount ,
175
170
nullBitmap : lineStringData . nullBitmap ,
176
171
valueOffsets : lineStringData . valueOffsets ,
177
172
offset : lineStringData . offset ,
178
- child : interleavedPoints
173
+ child : interleavedPoints ,
179
174
} ) ;
180
175
}
181
176
@@ -190,13 +185,15 @@ export function getInterleavedPolygon(
190
185
const interleavedLineString = getInterleavedLineString ( lineString ) ;
191
186
192
187
return arrow . makeData ( {
193
- type : new arrow . List ( new arrow . Field ( 'element' , interleavedLineString . type ) ) ,
188
+ type : new arrow . List (
189
+ new arrow . Field ( "element" , interleavedLineString . type ) ,
190
+ ) ,
194
191
length : polygonData . length ,
195
192
nullCount : polygonData . nullCount ,
196
193
nullBitmap : polygonData . nullBitmap ,
197
194
valueOffsets : polygonData . valueOffsets ,
198
195
offset : polygonData . offset ,
199
- child : interleavedLineString
196
+ child : interleavedLineString ,
200
197
} ) ;
201
198
}
202
199
0 commit comments