identifyLayersWithMaxResults crashes app

217
10
10-25-2018 08:37 AM
KyleSchultz1
New Contributor II

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.

0 Kudos
10 Replies
ErwinSoekianto
Esri Regular Contributor

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

0 Kudos
KyleSchultz1
New Contributor II

It crashes in both App Studio Player and through the Qt creator debug mode

0 Kudos
LucasDanzinger
Esri Frequent Contributor

Can you get a call stack?

0 Kudos
KyleSchultz1
New Contributor II

no I cannot

0 Kudos
KyleSchultz1
New Contributor II

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()


					
				
			
			
				
			
			
				
			
			
			
			
			
			
		
0 Kudos
ErwinSoekianto
Esri Regular Contributor

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. 

0 Kudos
LucasDanzinger
Esri Frequent Contributor

the identify result gives access to the LayerContent, so that can be your layer for selecting. QML will implicitly cast LayerContent to FeatureLayer

KyleSchultz1
New Contributor II

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
0 Kudos
KyleSchultz1
New Contributor II

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]