Offline Identify ArcGIS Runtime SDK for Android (offline data)

2060
4
07-20-2016 06:40 AM
LageplanGöttingen
New Contributor III


Hey ALL,

we need some help!

In our Android app, we use the IdentifyTask:

https://developers.arcgis.com/android/api-reference/reference/com/esri/core/tasks/identify/IdentifyT...

This works well as long as we provide an URL to a map service as input parameter for the IdentifyTask. However, now we would like to use the IdentifyTask in an offline version of our app, i.e. for feature layers that are contained within an offline geodatabase. 

How can we do this? Any ideas?

0 Kudos
4 Replies
AlexanderNohe1
Regular Contributor II

Hello Lageplan Göttingen​,

I believe that this identify task is more closely assimilated with the identify server task found here:

Identify (Operation)

What you might want to do instead is work on creating a query against your offline geodatabase and then creating a callout from that query that shows the relevant information.  This can be done via a layer query:

LayerQuery | ArcGIS Android 10.2.8 API

https://developers.arcgis.com/android/api-reference/reference/com/esri/core/tasks/geodatabase/LayerQ... Callout | ArcGIS Android 10.2.8 API

I hope this helps!

LageplanGöttingen
New Contributor III

Hi @Alexander Nohe, thanks for your reply!

However, I am not quite sure how to use LayerQuery to accomplish this task, or if it is even possible.

Here are some more details:

We have six layers with different POIs (one layer for bus stops, one layer for campus security, one layer for parent-child rooms on campus…). The user can either turn off all layers, or activate only the layers they want, or activate all of them. When a layer is activated, small POI icons are shown on the map. The user can then click on the icon to get more information.

The problem is how to find out to which layer a clicked icon belongs, especially if all layers are activated and shown on the map. Of course we could first query the bus stop layer, then the campus security layer, … and so on, until the correct one is found. But this would not be very efficient. That’s why we used the IdentifyTask that identifies features for all layers that are currently activated, and returns an IdentifyResult.

But I am not sure how to do this in an offline environment. “LayerQuery” seems to query features only for a given layer, but we might have up to six layers that need to be queried at the same time….?

0 Kudos
AlexanderNohe1
Regular Contributor II

The identify task is not supported by local server and would not work on the device.  Instead, a more efficient way to query would be to run query features, and then in the query parameters, apply a spatial filter with setGeometry.  From there, you can iterate over the feature results and check which result contains data (featureResult.getCount() > 0).  Then you can aggregate the results and return them to the user in either a popup or recycler view so the user can select the specific one they would like to identify.

ShellyGill1
Esri Contributor

Alexanders reply above looks correct to me, but thought I would also add that we've improved the API for exactly this type of workflow in the current Beta version, so in future you'll be able to use identify methods to identify a tapped feature on any of the layers - Identify features—ArcGIS Runtime SDK for Android (Quartz Beta) | ArcGIS for Developers .