I've published a hosted service (feature layer) by uploading a GDB. With that, I can easily update this service via Python by specifying a new GDB as a parameter in the overwrite command.
However, I wanted to apply some symbology to the service layers using ArcGIS Pro. So after initially creating the service by uploading the GDB, I then loaded the GDB feature classes into ArcGIS Pro, applied my symbology, then overwrote the service. I also made sure that the layers were listed in my Table of Contents in a layer order that matched the existing service, and had the exact same layer names. After this overwrite, things look great.
Now that the symbology is set, I want to automate the update of this service via Python by specifying a new updated GDB in the script. When I do this, the service does successfully update, but the layers are now out of order, and the symbology is mismatched as a result.
I can't figure out what is causing the layer order to change when overwriting via Python using a new GDB? The feature classes are exactly the same as the initial service publish. The feature class names, and schemas are also identical, and the only difference is that there are more features inside of the new feature classes.
Clearly something must be getting scrambled by using the two different overwrite methods of the same service, but I can't seem to get a handle on it.
Solved! Go to Solution.