I have created a python script that takes csv files, converts them into feature class and then adds them to the map. I am using ArcGIS Pro so the function used is:
arcpy.management.XYTableToPoint(stabbings_in_table, stabbings_out_feature_class,stabbings_x_coords, stabbings_y_coords, stabbings_z_coords,arcpy.SpatialReference(2031))
I run this code two more times for the other two csv files I have. So, in the end my Contents section of the map has three layers in total: Homicides, Shootings, Stabbings
From there I then create the service definition and upload it to our internal Portal.
Here is my problem.
No matter what order I create the feature classes the Contents pane always ends up listing them in alphabetical order, which then causes the service definition/feature service to list them in alphabetical order as well. The order I need is:
I know that inside of the actual map file you can click and drag on the layers to reorder them, but can this be done programmatically? My hope is that as long as the layers are in the order I need then they will stay in that order when the feature service is created.
Any help is greatly appreciated.