Select to view content in your preferred language

Copy Pop-up Between Web Map Layers

2415
4
06-28-2021 01:07 AM
UriGilad_EsriAu
Esri Contributor
4 4 2,415

 

The attached Python script assigns a pop-up from one web map layer (source) to another web map layer (target). If you like it I'd appreciate if you give a Kudos. Thanks! 👍

To use the script:

  1. Download and extract the attached zip file.
  2. Open the script file in a python editor (e.g., IDLE. This should be installed by default on any machine with ArcGIS Pro).
  3. Change the following details under the USER INPUTS section:
    • Source web map 32-character id
    • Target web map 32-character id (if same as source web map enter the same id in both)
    • Exact name of pop-up source layer in source web map
    • Exact name of pop-up target layer in target web map
    • ArcGIS Online credentials: url, username & password (make sure you have permissions to edit the target web map).
  4. Save and Run the script.

 

The script will:

  • remove and replace the pop-up of the target layer with the pop-up of the source layer.
  • not remove/add layers from/to your web map.
  • not modify the pop-up of the source layer.
  • produce an error if you have more than one layer with the same name as the source or target name within the same web map.
  • produce an error if the layer name you provided cannot be found in the source or target web map.

This script is not an official Esri product and is therefore not supported or updated.

Written by Uri Gilad 28 June 2021

4 Comments
DougBrowning
MVP Esteemed Contributor

Thanks a lot for this!  I edited to copied all matching layers between the maps.  

See here for the code

https://community.esri.com/t5/arcgis-survey123-questions/pop-up-categories-not-syncing-between-surve...

 

DougBrowning
MVP Esteemed Contributor

Is there a way to add labels?

I tried targetLayer.update({'labelingInfo':sourceLayer.labelingInfo})  but no

 

thanks

UriGilad_EsriAu
Esri Contributor

Hi @DougBrowning,

I tired to have a look but it's not as straight forward as the pop-ups. I'm not sure how to hack it in the web map layer level (unless you use arcpy in Pro and re-publish but that might be an overkill). If you have standardized symbology throughout your web maps you can apply the symbology at the feature service level:

https://community.esri.com/t5/arcgis-api-for-python-blog/methods-for-updating-layer-symbology-with-t...

Might be worth posting a question to the community.

 

DougBrowning
MVP Esteemed Contributor

What's weird is I do not even see a spot for in the var chain.  So I just thought I would see if you knew.

Oh well we only have one layer with it.  Thanks for looking.