Take the 2-minute tour ×

I have a map service that represents the World map with a table with population associated. I would like to filter some of the data matching a criteria and then, select ALL remaining features to work with them later, for instance, adding all them to an array.

For example, I can solve the first part of the problem if I create an ArcGIS Dynamic Map Service and apply a Layer Definition filtering to obtain a subset, like filtering countries with an population bigger/smaller than a threshold.

But, once I see on the screen my filtered map, how can I select all remaining features?

Does anyone know? Any Feature Layer magic?

Thanks for your help!

share|improve this question

1 Answer 1

I would use arrays of object ids to do this. When you initialize the layer, get a list of all the object ids in the layer. This can be done using the returnIdsOnly option on the REST API query.

Note that while there is a limit on the number of features included in the feature set response, there is no limit on the number of object IDs returned in the ID array response. Clients can exploit this to get all the query conforming object IDs by specifying returnIdsOnly=true and subsequently requesting feature sets for subsets of object IDs.

Once you have an array of all object IDs, you could use client side language (e.g. javascript) to generate a list of "all remaining" features, and query those by passing that as a REST query parameter objectIds. I believe the javascript API wraps this REST call using the FeatureLayer's queryIds method.

Keep in mind that ObjectIds are not necessarily continous - numbers can be skipped.

share|improve this answer

Your Answer


