Feature Layer Filtering

1056
1
07-02-2019 01:04 AM
EdmundoBotner1
New Contributor

Is there any way to filter (and show only) specific features from feature layer? I couldn't find the answer to that.

Tags (1)
0 Kudos
1 Reply
TylerSchiewe
New Contributor II

Hi Edmundo,

There are a number of ways to do this depending on your specific use case.

If you want to filter the features when they are requested from the server, you can create QueryParameters with a where clause (essentially a SQL query string) and use it to populate the feature layer's feature table. Here is an Android samples that shows this: https://github.com/Esri/arcgis-runtime-samples-android/blob/master/java/service-feature-table-manual....

For a feature layer that is already loaded and displayed, you can filter which features are displayed using a definition expression on the feature layer https://developers.arcgis.com/android/latest/api-reference/reference/com/esri/arcgisruntime/layers/F.... Here is another sample which shows the definition expression: https://github.com/Esri/arcgis-runtime-samples-android/blob/master/java/feature-layer-definition-exp....

Alternatively, if you'd prefer to show/hide features manually (without a query expression), you can use https://developers.arcgis.com/android/latest/api-reference/reference/com/esri/arcgisruntime/layers/F....

Hope this helps,

Tyler