I am trying to publish a map from Pro as a Web Map to my portal.
The reason is that I need to create many web maps, but need to use a custom basemap that I have created. I cannot use any of the Esri basemaps at all.
I have looked and have not been able to find any code that will allow me to publish a map document as a web map.
I have looked into creating a web map using: Web_Map = WebMap()
The issue though with that is that it will use a default Esri basemap. I cannot build it off a web map that already has the custom basemap I want.... they don't exist and will not exist. So I need to be able to set the basemap with an existing published layer... but nothing I have done is working.
Here is what I have tried:
#Publish layer as service
BM_layer_item = BM_item.publish()
BM_layer_item
#Create Web Map instance
Web_Map = WebMap()
#Add item to webmap as basemap
Web_Map.basemap=BM_layer_item
#Set web map properties
Set web_map_properties = {'title':'BaseMap1',
'snippet':'basemap test',
'tags':'test'}
#Save web map
web_map_item = Web_Map.save(item_properties=web_map_properties)
The end result is that I get a web map with an Esri basemap and not the custom basemap I was trying to set.
Can anyone help figure this out?