1.Differences Between query task and feature layer
2.Can we find features using query task?
1. Query task is a task used to query features from server, whereas, FeatureLayer is a type of map layer where the data is downloaded from server to client and displayed on map. These are two different things. We can use FeatureLayer to query features, that is because it would be redundant to send request to server and get data which is already in the client for FeatureLayers. If you are querying feature from DynamicLayers or Tables or even services which is not added to map, then you would have to use QueryTask.
2. Yes, then main purpose of the QueryTask to to find/query features from a service. we can use both/either attribute (where property) or spatial (geometry property) to find the Features.
thank u thejus
I just posted another question similar to this, so was hoping for some clarification.
When you say "it would be redundant to send request to server and get data which is already in the client for FeatureLayers" are you implying that a call to the queryFeatures() method of the FeatureLayer will not make a call to the server to get features? I'm seeing that it is, and don't want that behavior. I'm hoping we can keep the query on the client side since the data already seems to be there.
I am talking about 3.XX version api,
It may send a request to the server, if the FeatureLayer does not contain the data/features you wish to select. If you are doing a spatial query and the geometry type is not an "Extent", then also the FeatureLayer will sends a request to the server, even though it may have the data on the client side.
In 4.XX, its different, FeatureLayer always sends request to service. If you need to query data from the client side you need to use FeatureLayerView.
To query features/graphics available to or visible in the View on the client rather than making a server-side query, you must use the FeatureLayerView.queryFeatures() method.
Thanks for replying to the other discussion and confirming my understanding of the limitations on the FeatureLayerView for querying.
Retrieving data ...