Pop-up

These Pop-ups are Making Me Thirsty: Embedding Related Attachments from ArcGIS Server in an ArcGIS Online Pop-up

 

In an ArGIS Online webmap, a user can click on a link within a pop-up window to view an attachment, or even embed an attachment stored in ArcGIS Online or in an outside photo-sharing site. But is there a way to embed related attachments (as a large batch) that reside on ArcGIS Server directly within the pop-up windows? We sought an answer to this question while creating a Utility Pole Viewer for the City of Sullivan, Illinois.


After some tinkering, we came up with a solution. There are a few twists and turns in the process, but nothing that suggests getting twisted up like a pretzel (or getting as angry as George Costanza).

First, you want to rename your feature class to [FeatureClassName]_working (or something to differentiate it from the original), and go about the process of enabling attachments on that feature class. Use the Generate Attachment Match Table and Add Attachments tools to populate the attachments in the related table. If you publish your service at this point and view the pop-up for this layer in an ArcGIS Online webmap, this is what you would see...

AttachmentLink.png


...just a link to the attachment.

Clicking that link opens up the attachment in a new browser tab:


That's OK, but we want to see the attachment in the pop-up. Lets take a closer look at the URL in the image above:

We determined that the group of digits between 0/ and /attachments refers to the OBJECTID of the feature class, and the group of digits after attachments/ is the ATTACHMENTID from the related table. However, fields from the related table are not available to choose when configuring the URL for the pop-up image in a webmap-so we need to get the ATTACHMENTID into the feature class attributes.

In ArcMap, join your feature class and the related table ([FeatureClassName_working__ATTACH) based on the Object GUID from the feature class and REL_GLOBALID from the table.

Export the feature class, but turn off all fields from the related table except ATTACHMENT ID and REL_GLOBALID. Give the file name the original name of the feature class. In ArcCatalog, create attachments on this feature class, and load data from the [FeatureClassName]_working__ATTACH table into [FeatureClassName]__ATTACH.

Back in ArcMap, add your feature class to an mxd and publish a mapping service. 

Add the service to a new webmap, enable and configure the pop-up, and add an image under Pop-up Media.

In the Configure Image window, you can choose a field to use as a title (we used ATTACHMENTID), and add the URL where the attachment resides. To get this, copy and paste the URL from the browser tab that has the attachment, and change the digits between 0/ and /attachments to {OBJECTID} and the digits after attachments/ to {ATTACHMENTID}

The result: An attachment embedded within the pop-up window.