Select to view content in your preferred language

VectorTileLayer identify/query in 2024?

486
9
Jump to solution
07-31-2024 06:43 AM
D_R_
by
Occasional Contributor

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??

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
UndralBatsukh
Esri Regular Contributor

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/

 

View solution in original post

9 Replies
jcarlson
MVP Esteemed Contributor

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.

- Josh Carlson
Kendall County GIS
Paco
by
Frequent Contributor

Wow.   is this true that 'other' GIS applications can access a VectorTileLayer's attributes?   not the native software it was created in?..yet?

0 Kudos
jcarlson
MVP Esteemed Contributor

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.

- Josh Carlson
Kendall County GIS
Paco
by
Frequent Contributor

sure,  hitTest.  but why?

0 Kudos
D_R_
by
Occasional Contributor

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?

0 Kudos
UndralBatsukh
Esri Regular Contributor

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/

 

jcarlson
MVP Esteemed Contributor

Ohhh! I was looking in the wrong spot. This is fantastic, thanks!

- Josh Carlson
Kendall County GIS
D_R_
by
Occasional Contributor

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?

0 Kudos
UndralBatsukh
Esri Regular Contributor

Hi there, 

Correct you only get the geometries for symbol layers in the style. It is documented in the hitTest description.

0 Kudos