0

I already know how to share a layer, or create a empty webmap (and add layers after its creation) through Python on ArcGIS Pro. However I could not find a way to share a Web Map trough Python.

By that I mean uploading a map to AGOL, with all the current layers (either these layers being online or local). The way to do this on ArcGIS Pro is very straight forward (you just press Share as a Web Map, fill 3 fields and that is it), but I wonder if its possible to do through Python.

I'm write the code trough a Python Toolbox in ArcGIS Pro.

  • 1
    Are you trying to do this using ArcPy, the ArcGIS API for Python or another Python library? From your tags and text I don’t think it is possible to tell. – PolyGeo Dec 2 at 19:51
1

So, I believe what you want would be found in the ArcGIS API for Python. There is a "share()" method under the "Item" class. Please have a look at the documentation here and see if this helps. https://developers.arcgis.com/python/api-reference/arcgis.gis.toc.html#arcgis.gis.Item.share. If you haven't done so already, you can use Jupyter Notebooks that comes installed with Pro to use interactive scripting with AGO.

  • 1
    Here is a code snippet that uses the share() method: community.esri.com/thread/… – artwork21 Dec 2 at 20:30
  • artwork21: Thanks for your answer. However, it only shares a layer in that example (which I actually use in my code). I'm looking for web maps. I thought it would be straightforward (replace the layer to a map or something), but it is not – Gustavo Dec 2 at 22:00
  • amadbear: I dont quite follow. Reading it looks like it only changes the sharing properties of the item. Changing the sharing to groups and everyone does not make sense if the map is not even available in first place. – Gustavo Dec 2 at 22:05
  • Gustavo: so naturally, you'd have to create the item in AGO first, which would 1) be available to the user account that did the creation, and 2) generate a itemid that you could use afterward to share accordingly – amadbear Dec 2 at 22:09
  • Sorry, I guess I did not communicate properly then. I don't want to actually share, but instead upload. I wrote "Share" because that is how the ArcGIS Pro calls it, when you want to upload an offline Map on AGOL. My goal is to do exactly what the "Share as a Web Layer" thing does, but in Python. – Gustavo Dec 2 at 22:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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