Using version 4.28 of the maps SDK and looking for advice on best practice to update a GeoJSON layer that uses uniqueValueRenderer to create a custom simpleMarkerSymbol. Without providing the specific code, the program flow is as follows:
- load webmap
- send request for GeoJSON
- receive GeoJSON
- create content blob
- create url reference to blob
- create GeoJSON layer
- use query.queryFeatures() to fetch outfields
- create a uniqueValueRenderer instance
- iterate Features:
- create a new simpleMarkerSymbol which is dependent on the Feature data
- addUniqueValueInfo to the renderer
- add the renderer to the layer
- add the layer to the map
At this point the layer is created and shows on the map as expected. The problem I'm having is, how to apply the changes to the existing layer when a new request/response is generated/received? Currently I'm removing the layer and adding it back, but that causes the layer to flash when replaced. Any recommended approaches for this scenario?
I've experimented with applyEdits-updateFeatures-Collection but haven't been successful in getting the layer to update.
Additionally, I feel like I'm using the uniqueValueRenderer as a workaround, and there may be a better solution to accomplish the goal of creating data-driven marker symbols that depend on the feature content (including an SVG path) which is contained in the feature data. Any comments are appreciated.
-Ed