protomaps / protomaps-leaflet

Lightweight vector map rendering + labeling and symbology for Leaflet
https://protomaps.com/docs/frontends/leaflet
BSD 3-Clause "New" or "Revised" License
767 stars 43 forks source link

is `queryFeatures` deprecated? #134

Closed csbrown closed 9 months ago

csbrown commented 9 months ago

I would like to use some functionality related to retrieving polygons/features based on user interaction. One of the examples calls a method queryFeatures that seems to accomplish more-or-less what I need. However, I no longer see that method in the codebase, even though I have access to it through the module I installed with npm. It seems that the module I have installed is v1.24

Is this querying feature deprecated? If so, is there a recommended replacement for this workflow?

bdon commented 9 months ago

Yes, use MapLibre instead, because its internal design already supports user interaction out of the box.

csbrown commented 9 months ago

That's unfortunate. Do you have recommendations on how to translate points from the internal coordinate system to lat/long? I can roll my own queryFeatures with a kdtree.

bdon commented 9 months ago

I don't have any recommendations beyond how queryFeatures worked before, which is still in the Git history. The method used does not properly account for the difference between features in the tiles and features rendered by the style, does not persist properly across zoom interactions, and also doesn't work correctly when overzooming, which is why I recommend using MapLibre for anything involving dynamic interaction. It's not a good use of maintenance time to reproduce all those features when MapLibre already does them perfectly.