Hi,
is there a way to set a spatial condition in FeatureLayer.definitionExpression?
I mean select and show features inside a geometry object.
My FeatureLayer is a huge layer server side.
Thanks
Massimiliano
Hi Massimiliano,
Instead of using definitionExpression, try using FeatureLayer.queryFeatures(). See this section in the API Reference on Spatial Queries for more information: Spatial Query | ArcGIS API for JavaScript 4.14
Here's a sample that shows querying statistics by geometry: SceneLayerView - query statistics by geometry | ArcGIS API for JavaScript 4.14
Hope this helps!
Thanks,
Anne
Hi Anne,
and so I did but I wanted to avoid creating a new client side layer.
However I used QueryTask to perform the spatial selection, is it the same in terms of performance as FeatureLayer.queryFeatures() ?
thank you
Massimiliano
Yes, they are the same in terms of performance, assuming that your FeatureLayer is created from a service. But it is probably better to just use FeatureLayer.queryFeatures() so that you do not have to import another task.