The user can download for offline use a file with a vector tile pack. I want them to be able to tap a point and get attributes for graphics on the layer. Is that possible with a vector tile pack? If not what is the best way to do that?
This is my simple example of what I'm trying to do but geoElements is always empty:
if let layer = viewModel.map.operationalLayers.first {
DispatchQueue.global(qos: .userInitiated).async {
Task {
do {
let result = try await proxy.identify(on: layer, screenPoint: viewPoint, tolerance: 12)
print(result.geoElements)
} catch {
print(error.localizedDescription)
}
}
}
}
I do have control over the creation of the vector tile pack so it might just be that we're not creating that correctly
Offline identify operation is possible, but I'd like to clarify the question.
Do you plan to identify a feature in an offline map (such as in a mobile map package, .mmpk), or do you want to identify locally created graphics in a map that loads it basemap from a offline vector tile package (.vtpk)?
Neither of those I think. Basically here's how it works:
1. Load a stripped down tpk from the device to make sure a basemap is available
2. Try to load the full blown basemap from the web
3. Once the map is loaded, load an ArcGISVectorTileLayer based on a downloaded .vtpk file
4. Tap the screen and do an identify on the vector tile layer for graphics on that layer to get their attributes
Hopefully that makes sense.
After consulting our team, unfortunately we don't support this feature in the Maps SDK. 🙁 There might be a few things going on
- Identify the attributes of a vector tile. Other mapping service providers' vector tiles spec support identifying attributes. ArcGIS Pro added this support a while back, but it hasn't got into Runtime/Maps SDK yet, due to the effort required spanning multiple teams.
- Identify an "object" (building footprint, road shapes, labels, etc.) in the vector tiles. This is neither supported, as the graphics in the tiles aren't structured the same as a graphic in the graphics overlay.
I've added your request to the tracking issue and hope it can be escalated in our future releases.
Hi @GBreen,
I'm afraid that you cannot identify on an ArcGISVectorTiledLayer at this time, whether using a Vector Tiled Service, or a VTPK. You won't get any results back for the layer in the identify results.
This is something that we are looking at, but currently do not support. Part of the reason is that our basemaps are primarily for visual reference so have very little attribution baked in. Adding attribution would add bloat to the PBF data that is returned. However, if you are working with your own vector tiled layers then one pattern is to have a separate "companion" feature layer that reflects the real-world objects in your vector tiled layer, and identify or query against that feature layer.
Sorry it's not the answer you want, but I hope that helps.
Nick.