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.
^ 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
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 :(
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 :(