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

PolyGeo
65.5k29 gold badges115 silver badges349 bronze badges
asked Oct 4, 2019 at 17:30
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.

answered Oct 4, 2019 at 20:25
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.