fix: polygon filter not working for point layers in GeoJSON column mode#3310
Closed
pierreeurope wants to merge 1 commit into
Closed
fix: polygon filter not working for point layers in GeoJSON column mode#3310pierreeurope wants to merge 1 commit into
pierreeurope wants to merge 1 commit into
Conversation
e9f1d01 to
84aa5fc
Compare
Contributor
Author
|
Note: I just noticed #3301 addresses the same issue. Apologies for the duplicate — I should have checked open PRs more carefully before submitting. Happy to close this in favor of #3301 if the maintainers prefer, or keep both open for comparison. The approaches differ slightly (this PR parses WKT in the accessor, while #3301 caches parsed results and supports MultiPoint). |
897cfa2 to
ac96fc9
Compare
When filtering points by drawing a polygon, layers using GeoJSON column
mode failed because:
1. geojsonPosAccessor received data as {index, dataContainer} object
from filter-utils but tried to access it as an array via
d[geojson.fieldIdx], returning undefined
2. Even with correct data access, the accessor returned raw WKT strings
(e.g. 'POINT (7.63 45.04)') instead of [lng, lat] coordinates
Fix by:
- Currying geojsonPosAccessor with dataContainer (matching the pattern
used by pointPosAccessor and geoarrowPosAccessor)
- Using dataContainer.valueAt() to properly access field values
- Parsing WKT POINT strings into [lng, lat, alt] coordinate arrays
- Supporting GeoJSON objects with coordinates property
- Returning [NaN, NaN, 0] for invalid data so the existing
Number.isFinite check in filter-utils gracefully excludes them
Fixes keplergl#3278
Signed-off-by: pierreeurope <pierre.europe@pm.me>
ac96fc9 to
8311197
Compare
Contributor
Author
|
Closing in favor of #3321 which addresses the same issue with a more comprehensive approach. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Polygon filter (draw-to-filter) doesn't work for point layers using GeoJSON column mode. Points inside the drawn polygon are not correctly filtered.
Root Cause
Two issues in
geojsonPosAccessorinpoint-layer.ts:Wrong data access pattern: When called from
getPolygonFilterFunctorinfilter-utils.ts,datais an object{ index, dataContainer }, but the accessor treated it as an array (d[geojson.fieldIdx]), returningundefined.No coordinate parsing: Even with correct data access, the accessor returned raw WKT strings (e.g.
"POINT (7.63 45.04)") instead of[lng, lat]coordinates thatisInPolygonexpects.Fix
geojsonPosAccessorwithdataContainer(matching the pattern used bypointPosAccessorandgeoarrowPosAccessor)dataContainer.valueAt()to properly access field values[lng, lat, alt]coordinate arrayscoordinatesproperty[NaN, NaN, 0]for invalid/null data so the existingNumber.isFinitecheck in filter-utils gracefully excludes themFixes #3278