I've created this wrapper around feature layer where I create the empty feature layer as is in the API help page :

new FeatureLayer(featureCollectionObject, options?)

providing the first parameter an object (not url) and some options as the second paramater. then I fill this feature layer with my data that I get from my service (not the esri map service btw)...

So the features are on the map (what a beauty) and then I want to query them, but it seems like this api doesn't do the client side queries with where clause... using queryFeatures or selectFeatures doesn't matter, it always ends up with

"FeatureLayer::_query - query contains one or more unsupported parameters"

I can create my own wrapper and loop through the feature atrributes, and then set them selected based on my search criteria, but I want feature layer to do it for me, without having to send a request to a url (which doesn't exist in our case).

Simple test, now with a proper feature layer (instantiated using the url) with the SNAPSHOT mode, one would expect that query with a where clause would be performed on the client side, but no, it actually sends a request to a server (what for when I have all the data on client?)

I've reused someone else's jsfiddle here -> jsfiddle .Just click in the map to run simple query ("resolution = 3") and you can see it fails.

Can anyone shed more light into this for me please?

  • Did you ever get around this? Pretty lame to not allow this functionality. Commented Dec 1, 2014 at 7:07
  • yep. I'm using underscore to do all my queries now over featureLayer.graphics object. That does it quite nicely. 0 requests to server is quite nice.
    – belzebu
    Commented Dec 3, 2014 at 0:33
  • I experience the same thing, it's just too bad... Commented Feb 4, 2016 at 22:39

2 Answers 2


This is a limitation of a feature layer built from a featureCollection. See the help file page which says:

The feature layer, when initialized with a feature collection object... does not support queries that need to be performed on the server, e.g. queries with a where clause or non-extent based spatial queries.

  • 4
    thanks. I have seen that exact note before, but still, attribute queries should be available on the client side, it's all downloaded anyway for the snapshot mode.with all respect, it's just lame and this is why esri js api is never considered as a progressive and innovative api... back to writing another wrapper, this time for querying.
    – belzebu
    Commented Sep 2, 2014 at 11:39

This is a limitation of the client side FeatureLayer but there is one way to work around that still somewhat uses the API. The FeatureLayer will maintain it's own set of client side objectids, so while you still have to implement the actual querying yourself, you can use those objectids for selectFeatures, etc.

Example of selecting one feature based on an attribute:

// Implementing our "query" to select based on a unique field
var graphicToSelect = myFeatureLayer.graphics.filter(function(g) {
  return g.attributes.someField === myGraphic.attributes.someField;
var query = new Query();
query.objectIds = [graphicToSelect.attributes.OID];

If following this example, make sure you've set a selection symbol on the feature layer or it will look like nothing happened.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.