I`m trying to find a way to add an online layer to my local map, through Python. I know how to grab the layer info, but don't know how to use it.
onlinelayer = gis.content.search(mylayer)[0]
itemid= onlinelayer.id
I got the item ID but how do I apply it using something similar to addDataFromPath()?
1 Answer 1
This worked for me:
aprx = arcpy.mpArcGISProject("CURRENT")
m = aprx.listMaps("Map")[0]
itemid = '2ec9f27bea254a428e4eb70e7650672d'
m.addDataFromPath("https://mycounty.maps.arcgis.com/home/item.html?id=" + itemid)
The layer gets added to the Pro map.
answered Oct 4, 2019 at 20:25
Explore related questions
See similar questions with these tags.
lang-py