Stop Configuring Pop-ups!

4925
6
12-15-2017 06:43 AM
BrianBaldwin
Esri Regular Contributor
12 6 4,925

I just had a great question from a customer: "Whenever we publish or update a map service, it's a real pain to manually click 'enable pop-up' for each layer, never mind getting all of the right attributes set up and configured again".

If you are constantly adding the same map service to a map and basically want the same pop-up configuration each time, you should not manually recreate the same configuration...and you don't have to.

I have experienced the same pain and honestly, never thought about looking into making this a whole lot easier on myself. But, in looking for an answer, I stumbled across a fantastic tool for the job that is put out by Esri: ArcGIS Online Assistant (it also includes some great other functionality for copying items, updating urls, etc). If you have never visited the link, now is the time.

After you log in to your organization, click I Want To, and then select View an Item's JSON.

All of the pop-up configuration is saved on the feature layer level. So, select a web map that has a layer with some pop-up configurations that you never want to manually rebuild again. On the right hand side of the screen you will be presented with all of the web map's JSON. For this little exercise, scroll down to the Data section. Now, you can see all of the operational layers and also, any of the layers, which include a popupInfo parameter (if pop-ups were setup).

 

Now, just copy the entire Data field and save it out to a local text editor. Or, select specific operational layers to save. You can now restore or 'build' those custom pop-ups that you painstakingly built out at a moments notice!

As noted in the ArcGIS Online Assistant tool, the JSON Editing feature is a 'Do At Your Own Risk' exercise and you should certainly use a JSON validator prior to updating any code... so proceed with caution and make sure you understand the risk.

In my test, I saved the entire Data field. Next, I went back to ArcGIS Online and created a new web map with the same operational layers, but without any pop-ups enabled. After saving this new web map and going back to the AGO Assistant tools, I began editing the Data field (As always... PLEASE SAVE OUT ANY JSON YOU ARE GOING TO OVERWRITE FIRST TO ENSURE THAT YOU CAN RECOVER IF THINGS GO AWRY) and simply pasted the configured JSON in and saved it. After returning back to the new web map... all of the pop-ups were configured and ready to roll.

6 Comments
About the Author
Brian works as a Lead Engineer at Esri to support customers in Education. Brian has worked as a lecturer in GIS, supported non-profits through his community planning work, and honestly just loves working with users to help solve their geospatial quandaries!