I’m using the ESRI ArcGIS Online Feature Service Writer to update a layer in AGOL. I have it configured as per the screenshot below.
After it runs, the layer in AGOL is visible when zoomed all the way out!
So, I then republish the layer in ArcGIS Pro and it fixes the layer so that it now disappears when zoomed out (I could also do this directly in AGOL).
I then change the FME writer to ‘Use Existing’ (and not ‘Truncate Existing’) and re-run the translation.
This time it works without affecting the AGOL layer visibility.
So I change the FME writer back to ‘Truncate Existing’ (and not ‘Use Existing’) and re-run the translation.
It breaks the AGOL layer visibility again!
I plan to use something like this to update many layers, and I cannot have them all visible when zoomed out. It would be a complete mess.
Am I doing something wrong? How can I update the data (including deleting features) without affecting the AGOL layer’s visibility?
(The issue occurs for both 'Insert' and 'Upsert'. I’m using ‘Truncate Existing’ so that if we delete a feature locally, this will cause it to be deleted on AGOL. Perhaps there is a better way to do this? But that would be another question entirely.)
UPDATE WITH FURTHER INFORMATION:
It has been suggested to me (elsewhere) that perhaps FME is overwriting the feature service entirely. However, I don't think this is the case because it does not alter the symbology, the labels or the custom (arcade) pop-ups.
(Note that FME cannot send the symbology, labels or pop-ups configuration. It doesn't have access to this. It is only accessing the source data as feature classes from the local database directly and not accessing any layers.)
Here's some other odd behaviour: Although the layer visibility gets reset to display at all zoom-scales, the label visibility remains at the original zoom-scale range as the layer itself originally had. The labels never had any explicit visibility range set - it was just inherited from the layer itself.
The FME writer in this case is not using 'create' or 'overwrite' but is set to 'Use Existing'. Here's what the FME AGOL Feature Service Writer documentation says about 'Truncate Existing':
Truncate Existing - Attempt to remove all the features or attachments in a hosted feature service Layer before writing features. If the Layer does not exist, the translation will fail.
If the Layer supports truncation, this option supports deleting all features or attachments in a hosted feature service layer.
If the Layer does not support truncation (or the operation fails), the writer performs a truncation by reading all feature IDs from the layer, and then making deletion requests in batches according to the advanced writer parameter Features Per Request. There is nothing there that suggests it would be overwriting the hosted feature layer. It explicitly says that it would just remove all the features.
I have verified that deleting all the features (from the AGOL layer) using ArcGIS Pro, and then re-appending them from ArcGIS Pro does not cause the issue. So there appears to be some odd behaviour unique to the interaction between FME and AGOL. However, it does not appear that FME is overwriting the service completely.