I have a map with multiple feature layers.
I'm trying to identify a layer that is clicked on but I do not know which one will be clicked
So I have this line of code which as I understand it should accomplish what I want to do
mapView.identifyLayersWithMaxResults(mouse.x, mouse.y, 22, false, 1);
which should trigger in here
onIdentifyLayerStatusChanged: { } but instead what happens this line of code mapView.identifyLayersWithMaxResults(mouse.x, mouse.y, 22, false, 1); crashes my app everytime I was trying to follow the instructions per Identify features—ArcGIS Runtime SDK for Qt | ArcGIS for Developers
Identify features in all feature layers
When you do not know which specific layer to identify on, you can identify items in any layer in the map or scene. Change the first workflow above so that you do not specify the layer to identify. This time, the results are returned as a list of IdentifyLayerResult instead of a single result.
Layers that do not support identify or do not have any results based on the inputs are not included in the returned list.
Kyle,
That is weird, are you running it in the AppStudio AppRun? AppStudio Player? What device(s) are you using?
Do you see any error message(s) in the console when the app crashes?
cc: ArcGIS Runtime SDK for Qt , to see anyone in this group know anything about this specific issue.
Thank you,
Erwin
It crashes in both App Studio Player and through the Qt creator debug mode
Can you get a call stack?
no I cannot
So I was running App Studio 3.053, upgraded to the latest release(3.1) and this solves my issue the crash stops and I'm able to get past to the onIdentifyLayersStatusChange event.
I do have a follow up question, is it possible to select a feature using this process as well? Since I don't know the feature layer its selecting and the only way I know how to select a feature is featureLayer.selectFeatures()
So AppStudio 3.0 is running ArcGIS Runtime 100.2 and AppStudio 3.1 is running ArcGIS Runtime 100.3, it could be the reason.
the identify result gives access to the LayerContent, so that can be your layer for selecting. QML will implicitly cast LayerContent to FeatureLayer
Just to make sure I'm understanding this correctly
anything retrieved by
mapView.identifyLayersWithMaxResults()
will return in a variable defined like this
identifyLayersResults.geoElements
because so far any feature I click on returns empty or null variables
Ok, I feel dumb now, as it clearly states in the documentation
identifyLayersResults is a list
so retrieving it would be
identifyLayersResults [0].geoElements[0]