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

Add hitTest function for vector tile layers #217

Open
gowin20 opened this issue Apr 10, 2024 · 0 comments
Open

Add hitTest function for vector tile layers #217

gowin20 opened this issue Apr 10, 2024 · 0 comments

Comments

@gowin20
Copy link
Contributor

gowin20 commented Apr 10, 2024

Describe the problem

Querying the attributes of a vector tile layer is a popular workflow that is very clunky in Esri Leaflet Vector. You can currently query layer attributes, but you can only do so by manually accessing the layer._maplibreGL._glMap and using functions from MapLibre GL JS.

Not only is that confusing and unintuitive, it is also tricky to document and relies on developers having an understanding of a different, unrelated mapping library.

Describe the proposed solution

I would like the ability to query the attributes of a vector tile layer using a new method specific to the layer.

The ArcGIS JS Maps SDK just added support for VTL hit tests as a method of the map object: https://developers.arcgis.com/javascript/latest/sample-code/layers-vectortilelayer-hittest/

MapLibre GL JS also supports this as a method of the map object: https://maplibre.org/maplibre-gl-js/docs/examples/queryrenderedfeatures/

^ this method in MapLibre is how I am currently querying vector tiles in Esri Leaflet, by calling layer._maplibreGL._glMap.queryRenderedFeatures(). I would like to add an exposed method to the vector tile layer class that invokes this MapLibre method under the hood.

Desired implementation: const features = layer.hitTest() //features contains the returned maplibre features

Alternatives considered

No response

Additional Information

Here's another example of using the underlying maplibre map for a different purpose (styling the layer): https://developers.arcgis.com/documentation/mapping-apis-and-services/maps/basemap-places/#filter-places-by-style-category

This is a similar workflow that has to access the same private data variable, definitely not best practice either. And unfortunately not resolved by this feature request :(

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

No branches or pull requests

1 participant