IdentifyLayersAsync returns 0 Items while clicking on ArcGISVectorTiledLayer

1677
4
Jump to solution
05-26-2021 11:33 AM
RomanBoros
New Contributor III

Hi 

In my mapview if I load  a ArcGISVectorTiledLayer and when I select at any point on that layer then IdentifyLayersAsync always returns 0 items. Here is the sample code where the position is the selected coordinates. It works very well if I select any feature layer in my map view.

var results = View.MainMapView.IdentifyLayersAsync(position, 5, false, 1, _displayPopupCancellationTokenSource.Token);

RomanBoros_0-1622060042256.png

 

Any leads would be helpful. 

Thanks

0 Kudos
1 Solution

Accepted Solutions
Nicholas-Furness
Esri Regular Contributor

Hi Roman.

Thanks for the info. That's helpful. So you just need to know which vector tile layer was tapped on so that you can call identify against the corresponding feature layer?

That seems a little tricky to do at present. Here's one possible approach:

You could add the corresponding feature layers to the map with opacity 0 (in the same order as their visual Vector Tile layers) and then rely on MapView.IdentifyLayersAsync() to return you the first popup for each backing service. Just take the first result (that will be the topmost layer that had something to identify at the tapped point).

I'll update this if I think of a better solution, but if I understand what you're trying to do, that should work. (Update: Having checked with the team, this is the best solution available at the moment).

You could potentially refine that even more by keeping those layers to one side and only adding them to the Map when you are ready to do the Identify, and remove them after. That might not be necessary, depending on your app. Opacity 0 should work, but you might need to pick a very small non-0 value (e.g. 0.001).

I see the value of the configurable approach that Pro provides. I'll run it by the team.

View solution in original post

4 Replies
Nicholas-Furness
Esri Regular Contributor

Hi.

The data in Vector Tiles is static and purely used for rendering, so the connection back to the source data is lost when the tiles are created.

But as of Runtime 100.9 (2D) and 100.10 (3D), Runtime supports Feature Tiles by default when accessing a feature service. This fetches features from a feature service as PBF tiles, so you get a lot of the performance of vector tiles with the dynamic content of a feature layer. This is not quite as fast as static vector tile layers, but is pretty close and does give you full access to feature attributes and identify capabilities.

If you are interested in identifying individual features in one of our hosted basemaps, that is not currently supported. Is there specific basemap data you are interested in identifying?

0 Kudos
RomanBoros
New Contributor III

Hi,

Thank you for the advice about feature tiles. This is something we may use in the future, too. However, now we want to use vector tiles. Ideally, we would like to replicate in our application the same approach with a pop-up for vector tile layer as it is in ArcGIS Pro. We managed to display layers from Vector Tiles and have them associated with corresponding Feature Services on the backend of the application (similar as in ArcGIS Pro in attached image4). The problem is how to identify those Vector Tile layers when a user clicks somewhere in the map to know which Feature Services to request for pop-up (similar as in ArcGIS Pro in attached image5).

Is there no alternative to get the vector tiles layers loaded at the selected point? we just need the id of the vector tiles as we have all the layers available in the operational layers to fetch the desired information.

Also, we have found that for the vector tiled layer, the IsIdentityEnabled property is always false. Looks like the default behaviour which we can't change.

Thanks for your support in advance! 

0 Kudos
Nicholas-Furness
Esri Regular Contributor

Hi Roman.

Thanks for the info. That's helpful. So you just need to know which vector tile layer was tapped on so that you can call identify against the corresponding feature layer?

That seems a little tricky to do at present. Here's one possible approach:

You could add the corresponding feature layers to the map with opacity 0 (in the same order as their visual Vector Tile layers) and then rely on MapView.IdentifyLayersAsync() to return you the first popup for each backing service. Just take the first result (that will be the topmost layer that had something to identify at the tapped point).

I'll update this if I think of a better solution, but if I understand what you're trying to do, that should work. (Update: Having checked with the team, this is the best solution available at the moment).

You could potentially refine that even more by keeping those layers to one side and only adding them to the Map when you are ready to do the Identify, and remove them after. That might not be necessary, depending on your app. Opacity 0 should work, but you might need to pick a very small non-0 value (e.g. 0.001).

I see the value of the configurable approach that Pro provides. I'll run it by the team.

RomanBoros
New Contributor III

Hi Nicholas

Thanks for your reply.

As I can understand from your suggested approach that while loading the vector layer I should also load the associated Feature layer with opacity 0 so that the feature layer won't display in the map view but it would be available in the result of IdentifyLayersAsync(). I think it can work. I need to discuss this with the team this approach and let's see.