Maybe it's too simple, but: Is there a way to add the OpenStreetMap basemap from Python-Script in ArcMap?


Load first time your basemap in arcmap and export it to *.lyr file.

You can simply save "Basemap" group layer to a .lyr file to your system somewhere.

Next, you can load it with

basemapLayer = arcpy.mapping.Layer("C:/temp/basemap_osm.lyr")  

mxd = arcpy.mapping.MapDocument("CURRENT")  
df = arcpy.mapping.ListDataFrames(mxd, "*")[0]   
arcpy.mapping.AddLayer(df, basemapLayer, "BOTTOM")  

That is simpliest


Add the OpenStreetMap basemap to a blank map and then save that Layer as a Layer File.

You can then use ArcPy to create a Layer object from the Layer File that can be used by arcpy.mapping.AddLayer().

Not the answer you're looking for? Browse other questions tagged or ask your own question.