There are times when you may find yourself creating similar maps and forms for use in ArcGIS Field Maps. Maybe you’re transitioning into a new field season or perhaps you’re using the same editable feature layer across multiple maps. Rather than create each map and form from scratch, you can duplicate them to save time and ensure consistency in your operations. You can duplicate maps using the Field Maps web app, and you can copy forms between maps using ArcGIS API for Python or ArcGIS Online Assistant.
Duplicate a map
Duplicating a map is a simple way to create a new map based on an existing workflow or purpose. In the Field Maps web app (shown below), I have a map that was used for collecting information about crops in the spring.
With summer approaching, I want to create a new map with the same settings and form. To do this, I can duplicate the spring map. On the map card, I’ll click the Duplicate button. In the window that appears, I’ll title the duplicated map Harvested Crops – Summer and click Yes, duplicate.
The duplicate map is created and contains the same summary, feature templates, forms, and offline settings as the original map. Map areas and sharing settings are not preserved when duplicating a map.
Now I can open the summer map and make any slight adjustments needed for the new season. Once I share the map, it’s ready to go. For more information, see Duplicate a map.
Copy a form
Sometimes you may only need to copy the form from one map to another. For example, if the Harvested Crops – Summer map required different settings and additional reference layers, I could create a map from scratch and then copy the form for the editable layer from the spring map. Forms can be copied from one map to another using the copy_form_between_maps.py Python script or AGO Assistant.
Copy a form with a Python script
First, you’ll need to install ArcGIS API for Python if you haven’t done so already. Field Maps scripts require ArcGIS API for Python 1.8.4 or later. For installation instructions, see Install and set up ArcGIS API for Python.
Next, clone or download the Field Maps scripts GitHub repository to your machine. This is where the sample Python scripts and notebooks are hosted for Field Maps. In the terminal or command prompt, set the file path to the location of the repository folder:
Run the following command to create the virtual environment with the correct dependencies needed to run the script:
conda env create --file environment.yml
Next, activate the environment:
conda activate field-maps-scripts
Once you’ve activated the environment, you are ready to run the script.
The copy_form_between_maps.py script allows you to copy the form from one map to another. For the script to work, the source map and destination map must have the same feature service. You can run the script to copy the form for all editable layers in the map, or you can select specific layers. If there is an existing form in the destination map, it will be overwritten.
Before running the script, direct the file path to the scripts folder within Field Maps scripts:
copy_form_between_maps.py script is as follows:
python copy_form_between_maps.py -org https//arcgis.com -u username -p password -source-map-id <source-map-id> -dest-map-id <dest-map-id> -layer-name <layer-name> --overwrite
Copy the script into a text editor, such as Notepad++, and edit the following parameters to match your own information:
- -org—Your ArcGIS organization.
- -u—Your ArcGIS user name.
- -p—Your account password.
- -source-map-id—The item ID of the source map.
- -dest-map-id—The item ID of the destination map.
- -layer-name—The layer name for which you want to copy the form. This field is optional. If you leave it blank, the script will replace the form for all layers.
Once you’ve edited the parameters, run the script in the terminal or command prompt. The form is copied to the destination map. For more information, see the copy form between maps readme.
Copy a form with AGO Assistant
Not familiar with Python? Don’t worry, you can also use AGO Assistant to copy the form. AGO Assistant is a tool developed to provide easy access to the underlying map and item .json files. AGO Assistant is meant for advanced users, so proceed with caution before editing the item .json file.
Browse to https://ago-assistant.esri.com/ and sign in to your account. Under I want to, select View an Item’s JSON.
Search for the map you want to copy the form or forms from and select the map.
You’ll see two JSON editors, one for the item metadata (top) and one for the map definition (bottom). In the map definition, search for the layer containing the form and copy the formInfo JSON object.
Now search for the map to which you’ll copy the form. Select that map and click Edit JSON. In the map definition, find the layer you want to apply the form to and paste the copied formInfo object.
Save your changes. If you open the map in the Field Maps web app, you’ll see the copied form.
These are three ways to save time by duplicating maps and copying forms. For more information about configuring maps for use in Field Maps, see Configure the map and Configure the form.