@@ -308,11 +308,22 @@ export class GeoArrowSolidPolygonLayer<
308308 const nDim = pointData . type . listSize ;
309309
310310 // const geomOffsets = multiPolygonData.valueOffsets;
311- const polygonOffsets = polygonData . valueOffsets ;
311+ // const polygonOffsets = polygonData.valueOffsets;
312312 // const ringOffsets = ringData.valueOffsets;
313313 const flatCoordinateArray = coordData . values ;
314314
315- const resolvedRingOffsets =
315+ // NOTE: we have two different uses of offsets. One is for _rendering_
316+ // each polygon. The other is for mapping _accessor attributes_ from one
317+ // value per feature to one value per vertex. And for that we need to use
318+ // these offsets in two different ways.
319+ //
320+ // TODO: Don't construct the offsets twice from scratch? I.e. from the
321+ // polygon-to-coord offsets you should be able to infer the
322+ // multi-polygon-to-coord offsets? Or something like that
323+ const resolvedPolygonToCoordOffsets =
324+ getPolygonResolvedOffsets ( polygonData ) ;
325+
326+ const resolvedMultiPolygonToCoordOffsets =
316327 getMultiPolygonResolvedOffsets ( multiPolygonData ) ;
317328
318329 const props : SolidPolygonLayerProps = {
@@ -330,11 +341,12 @@ export class GeoArrowSolidPolygonLayer<
330341 // Note: this needs to be the length one level down, because we're
331342 // rendering the polygons, not the multipolygons
332343 length : polygonData . length ,
333- // Offsets into coordinateArray where each polygon starts
334- // Note: this is polygonOffsets, not geomOffsets because we're
335- // rendering the individual polygons on the map.
336- // @ts -ignore
337- startIndices : resolvedRingOffsets ,
344+ // Offsets into coordinateArray where each single-polygon starts
345+ //
346+ // Note that this is polygonToCoordOffsets and not geomToCoordOffsets
347+ // because we're rendering each part of the MultiPolygon individually
348+ // @ts -expect-error
349+ startIndices : resolvedPolygonToCoordOffsets ,
338350 attributes : {
339351 getPolygon : { value : flatCoordinateArray , size : nDim } ,
340352 } ,
@@ -346,21 +358,21 @@ export class GeoArrowSolidPolygonLayer<
346358 propName : "getElevation" ,
347359 propInput : this . props . getElevation ,
348360 chunkIdx : recordBatchIdx ,
349- geomCoordOffsets : resolvedRingOffsets ,
361+ geomCoordOffsets : resolvedMultiPolygonToCoordOffsets ,
350362 } ) ;
351363 assignAccessor ( {
352364 props,
353365 propName : "getFillColor" ,
354366 propInput : this . props . getFillColor ,
355367 chunkIdx : recordBatchIdx ,
356- geomCoordOffsets : resolvedRingOffsets ,
368+ geomCoordOffsets : resolvedMultiPolygonToCoordOffsets ,
357369 } ) ;
358370 assignAccessor ( {
359371 props,
360372 propName : "getLineColor" ,
361373 propInput : this . props . getLineColor ,
362374 chunkIdx : recordBatchIdx ,
363- geomCoordOffsets : resolvedRingOffsets ,
375+ geomCoordOffsets : resolvedMultiPolygonToCoordOffsets ,
364376 } ) ;
365377
366378 const layer = new SolidPolygonLayer ( this . getSubLayerProps ( props ) ) ;
0 commit comments