lonboard icon indicating copy to clipboard operation
lonboard copied to clipboard

fix: DataFilterExtension get_filter_category

Open ATL2001 opened this issue 3 months ago • 6 comments

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 the filter_size parameter of the DataFilterExtension. I created a new FilterCategoryAccessor accessor modeled after the FilterValueAccessor that works with the category_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

ATL2001 avatar Sep 21 '25 19:09 ATL2001

a couple screenshots to show the selector changing the filtered points on my map: image image

ATL2001 avatar Sep 21 '25 19:09 ATL2001

ugh, I don't know what I've done over here (I honestly don't think I did anything, but clearly I must have). Friday night I went in to modify that docstring and start making some tests, and I started getting the GL_INVALID_OPERATION: Vertex shader input type does not match the type of the bound vertex attribute error that was happening when I was sending a string column to the category filter, but now it's showing up for the int and float columns too. 😭

I'm starting to think it may be a better use of my time to abandon this branch and start over from scratch 😞

ATL2001 avatar Oct 19 '25 14:10 ATL2001

Do you know if this branch works again with the latest fix on main?

kylebarron avatar Oct 27 '25 18:10 kylebarron

yes, I just pulled the updates in, and it is functional again 🎉 . I'll try to carve out some time in the evenings this week to see if I can wire up some sort of tests.

ATL2001 avatar Oct 27 '25 21:10 ATL2001

@kylebarron while I'm updating the data filter extension example to add a section for categorical filtering, do you mind if I change the existing DataFilterExtension example notebook?

What I'm thinking of doing is making a geopandas dataframe of 1 million random points with columns for x/y/a random int(1-5) and then hooking a MultiRangeSlider to these columns, so the person playing with the sliders won't need to know anything about the data being displayed to understand how changing the sliders limits the data displayed.

image

ATL2001 avatar Nov 02 '25 18:11 ATL2001

@kylebarron while I'm updating the data filter extension example to add a section for categorical filtering, do you mind if I change the existing DataFilterExtension example notebook?

Could you add another new notebook specifically for category filtering?

What I'm thinking of doing is making a geopandas dataframe of 1 million random points with columns for x/y/a random int(1-5) and then hooking a MultiRangeSlider to these columns, so the person playing with the sliders won't need to know anything about the data being displayed to understand how changing the sliders limits the data displayed.

I don't think it's that hard to understand that the sliders change the numeric values in the frontend, even if in the case of the existing notebook it's download speeds? The names of the sliders should be pretty self explanatory

kylebarron avatar Nov 07 '25 18:11 kylebarron