opengeos/leafmap

Interactive filtering within a layer (or more generally, greater maplibre support?)

cboettig opened this issue · 2 comments

When using pmtiles, we can already do some cool things that maplibre supports, such as mapping data to aesthetics (e.g. #708). One option that looks very compelling within maplibre is this support for interactive filtering within a layer, as illustrated in this example: https://maplibre.org/maplibre-gl-js/docs/examples/filter-within-layer/ (see link for interactive version)

image

Would it be possible to implement this?

Relatedly, it would be nice to be able to do maplibre styling for other vector formats too. i.e. most maplibre examples focus on geojson anyway, and it makes sense that we plot and style vectors without worrying about whether those vectors are serialized as geojson, or pmtiles (or even shapefiles or geopandas). It looks like currently add_geojson() cannot map fill color to a data layer, e.g. we can't do "fill-color": ["get", "color_column"] with geojson, even though we can do that with pmtiles.

(maybe py-maplibregl is relevant/helpful here? e.g. https://eodagmbh.github.io/py-maplibregl/api/map/#maplibre.Map.set_filter)

Unfortunately, interactive filtering is probably not feasible with folium-pmtiles. I just looked into py-maplibregl. It seems exciting. I am going to add it as a new mapping backend for leafmap. That should provide better support for maplibre styling than folium-pmtiles. #718