fix: DataFilterExtension get_filter_category #884
Draft
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.
as we discussed in discussion #711 I was unable to get the DataFilterExtension to work for filtering data with categories.
I finally spent some time looking into what was going on, and the
FilterValueAccessor
was being used for the get_filter_category property, but that accessor is set up to work in conjunction with thefilter_size
parameter of the DataFilterExtension. I created a newFilterCategoryAccessor
accessor modeled after theFilterValueAccessor
that works with thecategory_size
parameter and does not do any casting of values to Float32, because looking at the DeckGL docs it appears that the category_filter should be able to work with string data.Using the new accessor for the get_filter_category on the data filter extension I'm now able to change
filter_categories
on the layer and the features are filtered as expected for numeric data. What I've got still isn't working for filtering with string data, but I figured this was worth throwing out there to see if anyone else had an idea how to get the filter working with those as well.I've added a notebook to the examples folder that I do not intend to actually check into the repo, which creates a DFE for a layer and links it to a widget to show that the category_filter is working for the numeric data, but not the string data. If we get the strings working I'd be happy to make a better example notebook that showcases category filters