Currently I publish web feature service which contain all the related layers. This creates an single item in portal which lists all the layers and their service URL. I would now like to seperate these layers out into their own items in portal. Is there a way to do with automatically or does it have to be done manually? The reason I am asking is this method simplifies publishing, looks neater in the legend (Until group layers are available) and enables these to documented and searchable.
As far as I can tell based on the documentation, there is no way to separate layers once published up to Portal for ArcGIS. This is a decision that needs to be made before publishing.
If you feel like this is a gap in functionality that could benefit a wide swath of users, I would encourage you to create an idea within ArcGIS Ideas.
I did find some best practice recommendations on managing layers within Portal for ArcGIS.
I get the sense that if we are given the option to group layers together, then we would also be given the option to "ungroup" those same layers. So perhaps the request for group layers is actually what you are asking for here? If so, it has been listed as "In Product Plan" for now.
Hope this helps,
Hi Andrew Whitman,
I found this in an FAQ while I was scouring Google which is what I am aiming for:
How do I save an individual feature layer as an item?
To save an individual feature layer from a multilayer feature layer, complete the following steps:
This is a manual process though and I was hoping there would be an option at the point of publishing to create seperate items from multilayer map/feature layers. If not then a option in portal or even a python script. I can add that to the ideas pages as you suggested.
Grouping layer in the portal Map Viewer has been a long time coming. The link you posted is 6 years old. Publising a multilayer map/feature services creates "groups" in a sence which improves the user expereince but you lose the discoverability of these layer in portal. This is the basis for my question.
Hi David - the process you describe has to be done manually. There isn't an option for creating separate items when publishing or a python script from Esri (though perhaps somebody else here on GeoNet has one they've already written?). With this in mind, per Andrew's comment, I would recommend adding the suggestion to the Ideas Site.
HI David McDermott check out Uri's script, will this help with what you are working on?
In the meantime, this sounds like a great opportunity to capture this functionality in an Idea on the ArcGIS Ideas page. If you post the link here, others will be able to upvote it.
Maybe a future release will feature your idea.
I wrote a simple script (and a toolbox in the reply below. Modified from CreateWebLayerSDDraft—ArcPy | Documentation) that creates separate hosted feature layers on an AGOL/Poral account. The script py file is attached to this post.
#User to insert aprx file location, folder to which sddraft and sd files will be saved, and map name
aprx = arcpy.mp.ArcGISProject(r'C:\Users\...Project.aprx')
map_name = 'Map'
workspace = r'C:\Users\...\folder'
#List layers in aprx
m = aprx.listMaps(map_name)
layers = m.listLayers('*')
#For each layer, created sddraft, sd and upload to active portal/AGOL.
for lyr in layers:
sddraft = workspace+'\\'+str(lyr)+'.sddraft'
sd = workspace+'\\'+str(lyr)+'.sd'
arcpy.mp.CreateWebLayerSDDraft(lyr, sddraft, lyr, 'MY_HOSTED_SERVICES', 'FEATURE_ACCESS')
arcpy.UploadServiceDefinition_server(sd, 'My Hosted Services')
print (str(lyr)+': Published successfully')