Skip to content

fix: polygon filter for point layers with geojson column mode (#3278)#3321

Open
pierreeurope wants to merge 1 commit intokeplergl:masterfrom
pierreeurope:fix/geojson-point-polygon-filter-3278
Open

fix: polygon filter for point layers with geojson column mode (#3278)#3321
pierreeurope wants to merge 1 commit intokeplergl:masterfrom
pierreeurope:fix/geojson-point-polygon-filter-3278

Conversation

@pierreeurope
Copy link
Copy Markdown
Contributor

Summary

Fixes #3278

When using point layers with geojson column mode (e.g., CSV with WKT point columns like POINT (7.63 45.04)), drawing a polygon/rectangle filter would crash with:

Uncaught TypeError: can't access property "every", pos is undefined

Root Cause

The polygon filter pipeline passes data as {index, dataContainer} objects, but the geojson column mode's position accessor (geojsonPosAccessor) expects array-format data (row as array) and tries d[geojson.fieldIdx], which returns undefined for objects.

Fix

For point layers in geojson column mode, the polygon filter now uses the pre-parsed coordinates from layer.dataToFeature (which are computed during updateLayerMeta) instead of calling the raw position accessor. This avoids the format mismatch entirely and is more efficient since the coordinates are already parsed.

Testing

  1. Create a CSV with a WKT point column: POINT (lng lat)
  2. Import into kepler.gl
  3. Change layer type to Point, use geojson column mode
  4. Draw a rectangle around points and apply as filter
  5. Verify: points are correctly filtered without errors

…gl#3278)

When filtering by drawing a polygon, point layers using geojson column
mode would crash because the position accessor expected array-format
data but received {index, dataContainer} objects from the filter
pipeline.

Fix by using pre-parsed coordinates from dataToFeature when the layer
is in geojson column mode, instead of calling the raw position accessor
which doesn't support the filter data format.

Signed-off-by: pierreeurope <pierre.europe@pm.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Can't filter geojson column mode points by polygon

1 participant