Stop Configuring Pop-ups!

4927
6
12-15-2017 06:43 AM
BrianBaldwin
Esri Regular Contributor
12 6 4,927

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
RobertBorchert
Frequent Contributor III

I just configure the pop ups in the MXD I make the feature service from and never have to tinkle with the pop ups, Other than changing the date field to no show the time.

DavidWood2
New Contributor

This is a great approach. Good for making backups of pop-up configuration, especially if they are complicated and need to be different across different web maps. I also like to use Map Image Layers. Once created you can change the pop-up configuration then click the "Save Layer" button at the bottom. The pop-up configuration gets saved in the map image layer and can be moved across different web maps.

JoeBryant1
Occasional Contributor III

Can you recommend a free JSON validator?

BrianBaldwin
Esri Regular Contributor

I just always use this: https://jsonlint.com/

This would simply be to validate the JSON syntax.

GeorgeSprehn
New Contributor II

Brian, Your original post is dated 2017 and your instructions still work in 2021. I copied/pasted the entire Data section between layers and 'boom' (or should I say 'pop') with excellent results. Thank you! Happy New Year!

BrianBaldwin
Esri Regular Contributor

@GeorgeSprehn- Glad to hear that it still works and the content was useful, awesome!

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!