I'm not sure if this is the most prudent way to go about this, so feel free to critique my code structure as well.
Okay, long story short, I have about a feature service that has tens of thousands of features. I only want the features contained within the current camera extent to be displayed, so:
- I've created a feature layer from the REST service URL. I call this the 'internal' feature layer.
- I've also created a corresponding 'wrapper' layer which 'wraps' around the internal feature layer.
- This wrapper layer is what will be displayed on the map, and it's source will be set to the result of a query executed on the feature layer. It's sort of like the internal layer is a database table, and the wrapper layer is a view of that table.
So anytime the camera changes, I tell the wrapper layer to execute a query on its internal layer based on the current extent of the view. So far, so good. This all works in the code.
Here's the problem: The features aren't drawing. I've printed the JSON of the wrapper layer to the console, so I know that the source of the wrapper layer has been set to the result of the query correctly, but...
The features don't have symbols. 'symbol: null'
The internal layer has a Unique Value renderer that was built from the REST service, and when I create the wrapper layer I pass this render to the wrapper layers. I know that this renderer is present in the wrapper layer at the time of the query.
I can't figure out why the wrapper layer is not using it's renderer to generate symbols for the features, so I'm wondering if there is a function call that I need to make in order to make the layer redraw itself and use its renderer to generate the proper symbols.
Any thoughts or wisdom is appreciated.