Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy a web map item #41

Closed
SergStol opened this issue Dec 2, 2016 · 1 comment
Closed

Copy a web map item #41

SergStol opened this issue Dec 2, 2016 · 1 comment

Comments

@SergStol
Copy link

SergStol commented Dec 2, 2016

Hello,

We are considering to use Python API for one of our projects in order to automate work order creation. A possible scenario consists of copying an existing master template web map, renaming it with work order ID and maybe changing a few other settings. So this is basically what you can do manually in AGOL by clicking on "Save As" within the web map.

However, currently I cannot find a way to do that in the API. I use search function to find the web map item of interest and find it successfully. Intellisense is telling me that there is a method of "Item" class called "copy", although when I went to explore the "gis" python module directly in the Visual Studio, I could not find such a method. Is this method in development for the upcoming stable release? And if not, could anyone recommend me a way to achieve what I need?

Thank you,

Serj

@SergStol
Copy link
Author

SergStol commented Dec 2, 2016

Okay, I have figured out a way to do this using this sample https://developers.arcgis.com/python/sample-notebooks/Publishing-web-maps-and-web-scenes/

My test code which copies 6 instances of the web map:

webmap = gis.content.search(query = 'title:PC_Test', item_type=None, sort_field='numViews', sort_order='desc', max_items=9999)

testmap = webmap[0]

web_map_dict = testmap.get_data(try_json=True)

x = 0
while x <= 5:
    title = "PC_Test_" + str(x)
    web_map_properties = {'title': title,
                         'type':'Web Map',
                         'snippet':'This web map copied from template',
                         'tags':'ArcGIS Python API PC Test',
                         'text':json.dumps(web_map_dict)}

    web_map_item = gis.content.add(web_map_properties)

@SergStol SergStol closed this as completed Dec 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant