-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
When filtering by drawing a polygon or rectangle, it has no effect on point layers with column mode geojson.
This is happening because
- inside the function
geojsonPosAccessorin the filepoint-layer.ts,dis normally an array, so accessing the position value withd[geojson.fieldIdx]works and returns a string "POINT (yy xx)".
But when I click filter, and the function is called fromfilter-utils.tsline 387,dis an object with this structure:{ index: 0, dataContainer: {...} }, leading to pos beingundefined. - Even if we arrive at line 387 in
filter-utils.tswith the geojson value, say like this:it still expects an array of coordinates, throwingexport const geojsonPosAccessor = ({geojson}: {geojson: LayerColumn}) => d => { if (Array.isArray(d)) { return d[geojson.fieldIdx]; } else if (typeof d === 'object' && d.dataContainer) { return d.dataContainer.valueAt(d.index, geojson.fieldIdx); } };
Uncaught TypeError: pos.every is not a functionon the same line.
A solution could be just extract the coordinates from the geojson string using regex, something likeBut it's ugly, so here I am.// Vibe coding solution warning if (isPointGeometry) { // Parse "POINT (lng lat)" const match = geometry.match( /POINT\s*\(\s*([-+]?[0-9]*\.?[0-9]+)\s+([-+]?[0-9]*\.?[0-9]+)\s*\)/ ); if (!match) return; lng = parseFloat(match[1]); lat = parseFloat(match[2]); }
Maybe we can add an ad hoc helper function inside the point layer class to get the coordinates?
Thoughts?
To Reproduce
Steps to reproduce the behavior:
- Create a simple csv like this:
point POINT (7.63 45.04) POINT (10.07 45.82) - Import into kepler using add data modal
- Change the layer type from geojson to point, and make sure it uses column "point" in geojson mode
- Draw a rectangle around a point, right click it and select the layer
- See error in console: Uncaught TypeError: can't access property "every", pos is undefined on line 387 of
filter-utils.ts
Expected behavior
It should correctly filter points without throwing errors.
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Reproduced in all demo websites and locally.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working