IOS swift - Webmap features access

542
4
08-20-2018 08:58 AM
MohamedMuzammil
New Contributor

Hi,

I have the web map that contains the map service and feature service.

1. I want to get the feature count and feature details based on map extent

2. How to apply filter/search for the features in the webmap

Please provide the example to access from web map. How to read and apply.

Thanks for your support

0 Kudos
4 Replies
GarimaDhakal
New Contributor III

Hi Mohamed Muzammil‌,

We have the following samples that might help you to get started. 

1. Feature layer query

2. Query a map image sublayer

3. Statistical query

Queries are performed on an AGSServiceFeatureTable. If a map is created from a portal item (webmap),  AGSServiceFeatureTable can be retrieved from the map as follows:

  • Get a list of operational layers from a map using the operationalLayers property on an AGSMap and filter those layers using layerId to get the required feature layer and map image layer. 
  • AGSFeatureLayer may expose a AGSFeatureTable through a featureTable property. The AGSFeatureTable can be casted to AGSServiceFeatureTable.
  • Sublayers of AGSArcGISMapImageLayer may expose a AGSServiceFeatureTable through a table property.  

I hope this helps. Please let me know if you have further questions. 

Thank you,

Garima

0 Kudos
MohamedMuzammil
New Contributor

Hi Garima,

Thank you for the reply.

I have tried the following but it is not filtered in the map

1. I have added portal item into the map

2. get the list of operational layers (let layers:[AGSLayer]! =  self?.map.operationalLayers as! [AGSLayer])

3. assigned in feature layer (self?.featureLayer1 = layers[3] as! AGSFeatureLayer)

4. applied filter (self.featureLayer5.definitionExpression="field='xxxx'")

5. -------- No filter applied in the map ---------

please guide me how to apply filter and filtered values should be changed in the map.

thanks

0 Kudos
GarimaDhakal
New Contributor III

Mohamed Muzammil‌ In step 4, you are applying definitionExpression on featureLayer5. Are you trying to apply definition expression on featureLayer1 or featureLayer5?

0 Kudos
MohamedMuzammil
New Contributor

thank you for your support. I got the answer with your reply

0 Kudos