Why are layer filters on web map not honored when creating agsmap from web map?

05-31-2017 02:24 PM
Occasional Contributor III

I'm following some of the samples for creating a new AGSMap instance from a web map.  This works fine except that filters on layers in the web map are not honored or used.  My web map basically contains a layer that has a filter expression that limits features to a single floor within a building.  When viewed on the web, the web map works fine.  However, used within the iOS 100.0.0 SDK, features from all floors within the building are displayed.

Unfortunately, I cannot find anything in the documentation to suggest that layer filters defined in the web map would not be honored but while I have been developing with the Javascript API for some time, I am pretty new to the iOS SDK.

Any help appreciated!

0 Kudos
2 Replies
Esri Contributor

Hello.  How are you setting the filter expression on the feature layer in the AGOL map viewer?  I have been able to set a filter and have it loaded successfully using the "filter" button on the layer:

Once I set a filter, it looks like this:

And then how are you creating the AGSMap in your app? I'm using the following code:

//filterLayer map:
let portal = AGSPortal.arcGISOnline(withLoginRequired: false)
let portalItem = AGSPortalItem(portal: portal, itemID: "415658075f2840b89925258867081d90")
let map = AGSMap(item:portalItem)

self.mapView.map = self.map

0 Kudos
Occasional Contributor III

Thank you Mark.  I'll compare your code to mine tonight.  It looks similar but I was following a different sample which I don't think created the portal and portal item.

0 Kudos