Extract basemap/web layer url from ArcGIS pro using ArcPy

851
2
11-23-2018 06:13 AM
Status: Open
AntriaChristodoulou
New Contributor II

Retrieve url of a basemap/web map layer used in Arc GIS pro with arcpy 

I would like to have the possibility to retrieve automatically (by using python) the url of a basemap/web layer which is in ArcGIS pro . As you can see in the image below, from the 'source' of the basemap layer I can manually retrieve the url of the basemap (web map layer).Url of a basemap/web map layer that can be seen in its properties (ArcGIS Pro)

- I tried to retrieve the properties of the web layer by using arcpy.Describe but there was no method to evoke in order to retrieve the url of the web layer. I could retrieve though the name of the basemap and its dataType (InternetTiledLayer):
Web layer properties with arcpy.Describe

- I looked in the documentation for arcpy.Describe but it seems there are no specific methods that can be applied on web layers (ArcInfo Workstation Item properties—ArcPy Functions | ArcGIS Desktop ).
- I also tried to access the CONNECTIONPROPERTIES  of the basemap layer but it appers that the connection properties are not applicable for web layers (Layer—ArcPy | ArcGIS Desktop ).

If I could automatically (using ArcPy) extract the url of the basemap from ArcGIS Pro, then I could use the url to specify the basemap I want to have when publishing a web map automatically (by using ArcPy).

2 Comments
JoshuaBixby

They used to have the information you are looking for under service properties in ArcMap but removed it in Pro.  Given that ArcGIS Pro is supposed to be more web GIS integrated, it is ridiculous getting this kind of information is more difficult or impossible.

JeffBarrette

Have your tried layer.dataSource?  We have made improvements to service layers.

p = arcpy.mp.ArcGISProject('current')
m = p.listMaps('Map')[0]
l = m.listLayers('World Topographic Map')[0]
l.dataSource
'https:\\\\www.arcgis.com\\sharing\\rest\\content\\items\\7dc6cea0b1764a1f9af2e679f642f0f5\\resources\\styles\\root.json'