Select to view content in your preferred language

Differences

1285
5
03-16-2017 05:00 AM
bharathreddy
Regular Contributor

1.Differences  Between query task and feature layer

2.Can we find features using query task?

0 Kudos
5 Replies
thejuskambi
Frequent Contributor

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.

bharathreddy
Regular Contributor

thank u thejus

0 Kudos
DanielPascual
Occasional Contributor

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.

0 Kudos
thejuskambi
Frequent Contributor

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.

DanielPascual
Occasional Contributor

Thanks for replying to the other discussion and confirming my understanding of the limitations on the FeatureLayerView for querying.

0 Kudos