Select to view content in your preferred language

Capture screenshot of user's experience

2275
2
05-27-2016 08:06 AM
GaryMcTall
Deactivated User

What is the best way to generate an image of the users current map and extent? Here is my use case. User has selected a feature and is at a specific extent. Upon moving to the next step in the process (clickevent), I want to capture an image of the location and the extent without any user interaction and store it in my cloud application. I am using the javascript api.

Thanks in advance for your help!

Tags (1)
0 Kudos
2 Replies
FC_Basson
MVP Regular Contributor

You could treat the following click event as a Print Task (PrintTask | API Reference | ArcGIS API for JavaScript 3.18 ) event.  Just submit the current map to the Print Task and grab the resulting image returned from the Print Service.  You could play around with the output extent by adjusting it with the esriRequest.setRequestPreCallback (esri/request | API Reference | ArcGIS API for JavaScript 3.18).  Also use the MAP_ONLY option for the layout.

SteveCole
Honored Contributor

What's your target environment, because this sounds more of an HTML 5 solution. If that's the case,  I suspect you might get variable success given how Internet Explorer is the exception to every web rule. Anyways, no matter your noble reasons for doing so, I think this scenario is exactly why javascript has restrictions in place against doing this. Scraping user information from their browser, silently, is how folks get their personal information compromised so it gets might hard to do what you want, even if for legitimate purposes

I'll throw another option out to you- why not write out a record into a db table that would contain the xmin/xma/ymin/ymax of the mapextent, the layer name, and featureID that the user interacted with? This would be TOTALLY doable within the JS API and current framework, and I'd imagine quicker than a print request.