Skip to content
This repository has been archived by the owner on Jan 25, 2021. It is now read-only.

A tool that generates a custom URL for viewing Feature Service attachments in a responsive gallery. Intended for use as Embedded Content in an Operations Dashboard.

Notifications You must be signed in to change notification settings

nzjs/ESRI-Feature-Service-Attachment-Gallery

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ESRI Feature Service Attachment Gallery

What is it?

This tool takes an input ESRI hosted Feature Service URL and a theme parameter, and generates a new public URL for viewing the Feature Service attachments in a nice, responsive gallery. The intent is for the gallery URL to then be used as "Embedded Content" in an Operations Dashboard.

Tested and working for both Survey123 features and QuickCapture feature attachments. In theory, it should work for any hosted layer with attachments enabled.

It works for both public and privately shared data, by generating a token for the gallery each time the page is refreshed.

Requirements

  • Files hosted on your own web server with PHP enabled

  • Customise the main.php file with the below variables as desired

  • Input Service URL matches a format similar to the one below, with layer number (eg. 0):

    https://services3.arcgis.com/{ORG ID}/ArcGIS/rest/services/{SERVICE NAME}/FeatureServer/0

Customisation

// The AGOL user must have access to the feature layer(s) that you are generating a gallery for.
// This will generate a new token each time the Gallery page is refreshed (as tokens don't last forever).
// Generally speaking the tokenReferrer and tokenFormat should be left as the defaults below.
$agolUsername = '<ARCGIS ONLINE USERNAME>';
$agolPassword = '<ARCGIS ONLINE PASSWORD>';

$tokenReferrer = 'https://www.arcgis.com';
$tokenFormat   = 'pjson';

// Only show the latest ($maxImages) number of attachments in the Gallery page.
// Set to 0 (zero) if you want to return all attachments (not recommended).
$maxImages = 80;

// Here we also allow customisation of the dark/light themes.
// By default, we're using the ArcGIS Ops Dashboard CSS colours.
$darkThemeBack = '#222222';
$darkThemeFont = '#bdbdbd';

$lightThemeBack = '#ffffff';
$lightThemeFont = '#4c4c4c';

How to use

Copy the files to a PHP-enabled web server, then browse to the /index.php page

  1. Input your parameters on the initial page
  • Feature Service URL
  • Primary key identifier for layer (OBJECTID or FID?)
  • Theme selection for gallery
  1. View your gallery, then copy the custom gallery URL with GET parameters (something like: https://{host}/attachments/gallery.php?id={base64 encoded ID}&theme=dark&pk=OID)
  2. Paste the generated gallery URL into Operations Dashboard - Embedded Content panel

Example screenshots: example-screenshots example-screenshots 2

To do

If there is enough interest...

  • Add option to filter attachments by current Dashboard selection
  • Add option to filter attachments by current Dashboard map extent
  • Add better error handling
  • Test with MapServer layer attachments and fix as appropriate

About

A tool that generates a custom URL for viewing Feature Service attachments in a responsive gallery. Intended for use as Embedded Content in an Operations Dashboard.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published