0

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()?

0

1 Answer 1

3

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.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.