Export Web Map Tool

The Export Web Map tool is a geoprocessing tool that comes published as a service (Utilities/PrintingTools) out of the box with ArcGIS Server. From ESRI’s docs:

This tool takes the state of a web application (for example, included services, layer visibility settings, and client-side graphics) and returns a printable page layout or basic map of the specified area of interest.

This is most commonly used as a print service for web applications allowing the user to download a PDF of the current map extent.

The Problem

AGRC’s base map services (including the Google imagery) are hosted as WMTS services on discover.agrc.utah.gov. In order to use them an organization needs to register and request a quad-word. To prevent unauthorized use they are each locked down to a specific domain or set of domains. So if someone tries to use your quad-word from any other domain or server, the request is blocked. This all works well until you send a web map to the PrintingTools service in ArcGIS Server. The web map contains URL’s to Discover services that have quad-words locked down to your web app’s domain. When the service requests tiles, it does so from the server that is hosting the service, not the browser. This causes Discover to reject the request because the origin of the request does not match what the quad-word is locked down to.

The Solution

To work around this issue, AGRC developed a Google Cloud function called serverless-print-proxy. Our proxy service takes the same parameters as Esri’s Export Web Map. When it receives a request, it swaps out any locked-down quad-words with wide open quad-words. Then it simply passes on the request to your Export Web Map service and passes back the response stripped of the wide open quad-words for security. You can read more about how we built serverless-print-proxy in our blog post about it. To get started, you need to get your account added to accounts.js. You can do this by submitting a pull request or by contacting Scott Davis from AGRC at stdavis@utah.gov.

Why don’t I just use a wide open quad-word in the first place? That’s a great question. I’m glad you asked! Using wide open quad-words in web applications would violate the Organizational Usage Agreement. It would be very easy for a savvy web developer to get your quad-words and use them on their own site.

AGRC’s serverless-print-proxy is open source and available for download and deployment to your own Google Cloud Platform account via: https://github.com/agrc/serverless-print-proxy. Feedback and pull requests are welcome.