FeatureLayer query options

254
3
06-05-2019 03:55 AM
RomanKönig
New Contributor III

Is there a way to influence the way a FeatureLayer is queried by the JS API (4.11)?

For example we use arcgis online hosted feature layers with only a handful or up to < 100 features.

Now when we add this FeatureLayer to a MapView there are numerous (in our sample 6) query requests sent to each FeatureLayer on every scale change.

I know this was introduced, as in early versions of the js api 4 all features were queried at once, but it would be nice to have an option to force such a behavior.

Am i missing something here?

0 Kudos
3 Replies
AndyGup
Esri Regular Contributor

Roman König‌ can you share your app? Or if you don't want to share it publicly can you email it to me agup at esri dot com? The 4.x API is designed to make highly optimized queries automatically when working with AGOL feature layers. If you've hit on a use case that is creating an issue we want to learn more about it.

Also please note that querying all features at once isn't necessarily the most efficient approach. It can cause networking, processing and rendering bottlenecks and usually makes it more challenging to take advantage of a variety of caching strategies.

0 Kudos
RomanKönig
New Contributor III

Thanks for your reply - i'll email you a sample with a single feature layer endpoint.

And i know that querying all features at once is usually not a goiod idea, but in cases where we know that the layer does not hold thousands of features it would be good to be ably to have influence on how the data is queried.

0 Kudos
UndralBatsukh
Esri Regular Contributor

Hi there, 

The behavior you describe and see is how it works today (features are being requested on demand). We have this on our to do list so that features are not requested on demand if certain requirements are met. I do not have the exact time frame for this, but I am hoping before the end of this year.