Show Attachments in Web Map Popup

Document created by jskinner-esristaff Employee on Dec 14, 2015Last modified by jskinner-esristaff Employee on Mar 13, 2018
Version 18Show Document
  • View in full screen mode

I work with a lot of customers that request the ability to display their feature service attachments in the web map's popup rather than a hyperlink.  The attached script will convert the feature services attachments URL to a field.  You can then display the attachment directly in the popup after some configuration.


Here is a screen shot on how attachments display within a web map popup by default:




Below are the steps to show the attached image directly in the popup:


1.  Add a TEXT/STRING field (i.e. "Picture")  to the feature service that can support a large amount of characters (i.e. 1,000).

2.  Execute the attached GP tool.

3.  Configure the pop-up to Show Images.  Ex:




The image will now display directly in the popup.  Ex:





  • the timeout for an ArcGIS Online feature service is set to the max of 15 days.
  • the timeout for an ArcGIS Server service is set to the default 'Lifespan of long lived token'.  The default is 1 day.  This can be changed by going to Server Manager > Security > Settings.  After the long lived token is updated, you can update the expiration parameter on line 33.


Update 9/8/17: GP tool will update ArcGIS Server services that are federated with Portal for ArcGIS

Update 9/27/17:  GP tool now works with ArcGIS Pro

Update 3/13/18:  Script is a single file that utilizes the requests module.  No longer have to specify a referer.

80 people found this helpful