Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix querying within feature collection of polygons #477

Merged

Conversation

sbachinin
Copy link
Contributor

Fixes maplibre/maplibre-gl-js#3540

A bit verbose perhaps. But if we need to query stuff within multiple polygons, then Within.geometries has to be an array and therefore some changes are necessary here and there.

Of course this will be thoroughly tested after tests' migration from gl-js.

BTW this bug occurs not only with points but with lines too. (This is fixed here too).

@codecov-commenter
Copy link

codecov-commenter commented Jan 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (86c4898) 92.09% compared to head (c11cfc3) 92.20%.
Report is 7 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #477      +/-   ##
==========================================
+ Coverage   92.09%   92.20%   +0.10%     
==========================================
  Files         100      100              
  Lines        4176     4182       +6     
  Branches     1197     1199       +2     
==========================================
+ Hits         3846     3856      +10     
+ Misses        330      326       -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@HarelM
Copy link
Collaborator

HarelM commented Jan 7, 2024

I've merged the addition of the expression tests.
Please make sure to add the relevant test to the newly added tests.
Also, I think geometries in WithIn can be a multiploygon, and you can simply add all the polygons to it, I don't think there's a need to change it to be an array of multipolygon.
I think the solution can be simplified by collection all the polygons from the multipolygons and "throwing" it into a single multpoligon and init WithIn with it, right?

@sbachinin sbachinin force-pushed the fix-query-within-collection-of-polygons branch from 15f3c21 to 40f6d9f Compare January 8, 2024 04:31
@sbachinin
Copy link
Contributor Author

sbachinin commented Jan 8, 2024

Done.
Simplified solution using Multipolygon, as you prescribed.
Added tests

@HarelM
Copy link
Collaborator

HarelM commented Jan 8, 2024

Did you merge from main? The coverage doesn't report the right number...

@HarelM
Copy link
Collaborator

HarelM commented Jan 8, 2024

Thanks!! Added a few nit picking...

@sbachinin sbachinin force-pushed the fix-query-within-collection-of-polygons branch from 40f6d9f to e1fbd59 Compare January 8, 2024 09:21
@sbachinin
Copy link
Contributor Author

Done
Merged from main

@sbachinin sbachinin marked this pull request as ready for review January 8, 2024 12:34
@HarelM
Copy link
Collaborator

HarelM commented Jan 8, 2024

Can you add an item to the changelog?
After that I'll merge and create a new version.

Copy link
Collaborator

@HarelM HarelM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

THANKS!!

@HarelM HarelM merged commit 8d3b078 into maplibre:main Jan 8, 2024
6 checks passed
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.

queryRenderedFeatures within feature collection not working
3 participants