In the ArcGIS JavaScript Maps SDK 4.33, I have two separate Map Views that share a Map. One is the main map that users see, and the other is specifically for printing. The reason for the second map view is to render extra graphics on layers that are hidden on the main map view, but I digress.
On the printing map view, I apply a Feature Filter on specific layerviews, since a distinct query can only be applied to the layer itself, and would affect the main map view.
The labels are visible on both views, even after the Feature Filter is applied, but not in the exported file. If I export the map without the Feature Filter enabled, the labels are visible.
I'm not able to share any screenshots due to the data being private.
Hi @kaleb_integralNZ, thanks for posting your question here. Any chance you have a simplified reproducible test-app that I could take a look at? That would really help see what's going on. You can use dummy data for the layer URL(s). If not, take a look at the print request in the Network traffic and see if anything looks goofy in the webmap_as_json.
As a start, I took a look at the network traffic and did a diff on the webmap_as_json payload. When the feature filer is applied, the feature class is wrapped in it's own feature collection in an array of layers by itself, and in layer definition, under drawing info, it skips over labeling info and goes straight to renderer.
Thanks @kaleb_integralNZ, that is helpful. I tried to build an app that reproduces the issue based on the information you've shared, but I am unable to reproduce. Can you look at the test-app and check your behavior, and see if you can reproduce the issue using the sample data?
https://codepen.io/noash/pen/QwjYqaP
I spent a good chunk of the day trying to reproduce it in that app, unsuccessfully.
However, I did manage to find a fix, and it is the strangest thing ever (the last line).
I have double checked and the labels do not appear with out this line of code.
At a guess, it's because I never set the layer's labellingInfo explicitly in code? The layer is part of a group layer, which is initialised from a web map.
I'll also mention I'm using v11.5.0 of Portal to host the web map & feature services.