copy map with all form settings as template

2129
8
04-19-2022 01:12 AM
Status: Open
Labels (1)
GISTeam4
Occasional Contributor

In order to quickly reproduce settings  for use in field maps it would be helpfull if a web map could be saved as a template for use in other similar projects. For example; for inspection of trees a field maps map is made with certain forms, domains and conditional formatting. For another project, the same inspection is done. 

It would save a lot of time if one could make one (empty dataset) field maps map with all settings, which then can be duplicated to enable datacollection in an identical way for subsequent projects

8 Comments
DougBrowning

I would love this as well.  We build out 12 states and it is all day of manual clicking.

Have you at AGOL Assistant?  https://ago-assistant.esri.com/ 

Also script can do it but it has been a bit unreliable.

 

account = 'https://www.arcgis.com' # AGOL/Portal url
# using Pro instead
##username = 'yourusername' # AGOL Username
##password = 'yourpassword' # AGOL password
webmap_id_source = '13a149de6659bc68' #  32-character id of web map with the source layer
webmap_id_target = '9f5d4d3574af2' #  32-character id of web map with the target laye

##############################################################################################

### EXECUTE ###

#Import
from arcgis.gis import GIS
from arcgis.mapping import WebMap
import sys

print("Starting")

# Check layers names and web maps are not identical
if webmap_id_source == webmap_id_target and copy_popup_from_this_layer == paste_popup_to_this_layer:
    sys.exit("Script cancelled: Source and Target layers have the same name and are within the same web map. Please rename one layer before continuing")

#Connect to GIS
#gis = GIS(account,username, password)
gis = GIS('pro')
source_webmap = gis.content.get(webmap_id_source)
target_webmap = gis.content.get(webmap_id_target)

# Get a list of layers in both web maps
web_map_obj_source = WebMap(source_webmap)
web_map_obj_target = WebMap(target_webmap)
layers_sourceWM = web_map_obj_source.layers
layers_targetWM = web_map_obj_target.layers

# Loop through all the source layers and copy to the matching targets
for sourceLayer in layers_sourceWM:
    found = 0
    for targetLayer in layers_targetWM:
        if targetLayer.title == sourceLayer.title:
            targetLayer.update({'popupInfo':sourceLayer.popupInfo})
            targetLayer.update({'showLabels':sourceLayer.showLabels})
            #targetLayer.update({'labelingInfo':sourceLayer.labelingInfo})
            found += 1

    if found == 0:
        print("Warning did not find layer " + sourceLayer.title + " in the target map")
    elif found > 1:
        print("Warning found the source layer " + sourceLayer.title + " " + str(found) + " times in the target map")
    else:
        print("Copied " + sourceLayer.title)

# Update/save webmap
web_map_obj_target.update()

print("Finished")

 

 

Sietse_de_Haan

This is possible by using a arcgis notebook within arcgis online. 

Send a DM if you need help with this.

RichardHowe

This idea is absolutely key. The amount of hours my team spends recreating similar field maps and feature layers for different projects and having to go through all the settings again is incredible.

I'm currently writing a (very complicated) python script to try and do it, but surely this is something ESRI could provide at the click of a button.

"Clone Webmap Template" or something similar.

Input would be an existing configured webmap and output would ask for a "New name" and then create a new map containing blank cloned copies of all the feature layers within that map.

JocelynWhite

I'm assuming this has not been resolved yet? I'm getting really tired of having to rebuild 126 questions with drop-down options each time I go to a new community for sewer mapping. 

JamesPoeschel

This would also save me countless hours of work. I really hope this gets implemented.

LanSong

I love this idea which will be super helpful for avoiding duplicate effort.

Sietse_de_Haan

@JamesPoeschel @LanSong 

It is already possible by using an ArcGIS Online Notebook. I can send you a copy if you like. 

 

JamesPoeschel

@Sietse_de_Haan Please do! I keep getting errors with the code posted above.