Respect FeatureLayer's fullExtent to improve performance when filtering by geometry

110
0
2 weeks ago
Status: Open
Labels (1)
DavidKlinger
New Contributor II

I have an app where users can run a report on an area they define.  The report has a map where I add multiple layers filtered to their geometry.  These layers have lots of data on them, and normally I wouldn't show them zoomed out, but on the report map, I'd like to show the features without scale restrictions, limited to their area. Unfortunately, FeatureLayers do not provide a good way to filter on a geometry, aside from adding a geometry filter to the LayerView.  But adding it there has no impact on the queries being made automatically for features that will never be shown on the report map, since the geometry filter will never change on the report map.  This problem is even more evident if a user zooms out.  It's a real performance issue that there isn't currently a very good work around for.

The best solution I have at the moment is to download all the features in the area for these layers and convert them to client-side feature layers.  Then there is no further chatter with the back end.  I've found that trying to override the geometry in the queries with customParameters is dangerously hacky.  Another idea that is probably not feasible for me is to include extent information in the layer fields, and then include a clause based on the extent in the definitionExpression.

I'm not sure if it's possible to just add a geometry filter property to the layer itself.  That would be nice, but perhaps it can't take advantage of potentially cached FeatureTiles as easily?  At the minimum though, if I were able to explicitly set the "fullExtent" property of the FeatureLayer, and the layer would respect that and not query for FeatureTiles outside of the fullExtent, that would be amazing!  Then I could set the geometry on the LayerView, and not have to worry about users downloading 100,000 invisible polygons when they zoom out.