How to add basemap to MapDocument using arcpy?

2039
3
06-20-2014 06:38 AM
PeterLen
Occasional Contributor
Hello - I am using ArcGIS 10.1 with Python 2.6.  I am using arcpy to work with an MXD template that I read using arcpy.mapping.MapDocument.  I want to add a basemap to the default dataframe (I have a URL to the basemap), but after searching high and low, I can't find a way to use the URL to add the basemap.  I see alot of examples of adding a layer (.lyr file) but nothing on how to add a basemap.  Any info on where I can find out how to do this would be greatly appreciated.

Thanks - Peter
Tags (2)
0 Kudos
3 Replies
JakeSkinner
Esri Esteemed Contributor
Hi Peter,

One way to do this is search for the basemap(s) that you want to add to ArcMap in ArcGIS.com.  Ex:

http://www.arcgis.com/home/search.html?q=basemaps&t=content

Open > Open in ArcGIS for Desktop > save this as a layer file.  You can then add the layer file to ArcMap using Python.
0 Kudos
PeterLen
Occasional Contributor
Thanks for the reponse.  Manually creating a .lyr file won't work for us however.  We get the basemap URL sent in to us so it could be from anywhere and it needs to be loaded dynamically.  They basemaps can't be staged in this case because we don't know what basemap will be asked for.  We only know that it will be accessible from the URL.
0 Kudos
AhnaMiller2
Occasional Contributor

Hi Peter, I am wondering if now that 4 years have passed you found a way to accomplish this?