Good afternoon,
Is it possible to identify/query VectorTileLayer in the most recent API (4.30)?
When I say identify/query I mean getting feature info under map cursor (coordinate).
I found some previous topics about this issue and answers were NO. But it is 2024 now and VectorTileLayer is not something new 🙂 Any improvements in this area??
Solved! Go to Solution.
Hi there,
You can use MapView.hitTest() to access features in a VectorTileLayer. This sample shows how to do this https://developers.arcgis.com/javascript/latest/sample-code/layers-vectortilelayer-hittest/
Still looks like a no, there aren't any methods on the VectorTileLayer class that do it.
https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-VectorTileLayer.html
Probably not the answer you want, but you can get the attribute data from a vector tile feature if you're using a different system like MapLibre, or even QGIS.
Wow. is this true that 'other' GIS applications can access a VectorTileLayer's attributes? not the native software it was created in?..yet?
I mean, there's nothing particularly special about where the tiles originate. Pro may generate a package with its own extension on it, but under the hood, their vector tiles are much like any other. It's the end program consuming the tiles that makes a difference.
sure, hitTest. but why?
Oh, I found this comparison example: https://reyemtm.github.io/map-compare//?map=esri-v4
It may be useful for some.. It sucks that in order to "identify" feature in ArcGIS Maps SDK for JavaScript 4.30 you have to make a separate call to server despite the fact that you already have features in your web browser 😄 (Hmm.. but if tile is already cached in web browser, maybe it is not the end of the world after all?)
And what about feature highlighting on mouse move in ArcGIS Maps SDK for JavaScript 4.30?
Hi there,
You can use MapView.hitTest() to access features in a VectorTileLayer. This sample shows how to do this https://developers.arcgis.com/javascript/latest/sample-code/layers-vectortilelayer-hittest/
Ohhh! I was looking in the wrong spot. This is fantastic, thanks!
Thank you! Works quite well!
Most of graphics in 'results' [except labels-points?] don't have geometry though. Is it a limitation of hitTest() when layer is of VectorTileLayer type?
Hi there,
Correct you only get the geometries for symbol layers in the style. It is documented in the hitTest description.