Select to view content in your preferred language

Take map screenshot in background service

1522
3
07-04-2018 03:31 AM
LanceParker
New Contributor

Dear all,

I wonder what is the correct way to make a snapshot of map area in background.

E.g. At 0:00 AM everyday, the background service will generate an image/snapshot of my house with relevant information (10 layers data, picture marker,...).

Thanks

Old content bellow 

Dear all,

I would like to take the image of the map in background service (include layers, graphic,...) but unable to make it work with my own code (.NetCore) or some public services such as (tried with 10 or more - paid or free):

https://www.url2png.com/#testdrive

SelectPdf for .NET - Convert from Url to Image - C# / ASP.NET 

...

It always returns a blank page while it works with browsers such as firefox/chrome.

The URL I want to make screenshot is

https://siteref.com.au/map/GetImage?type=Planning&reportId=158

My questions are:

1. Is there any configuration that prevent arcgis js files cannot be loaded by background web kit? (I enable cors and other security stuffs at above server in order to making that work)

2. Is there any other good/correct way to make map snapshot image in background service? E.g. I want create an image of an area (with marker, popup,...) daily using a windows service to send to subscribe users

p.s I can make the image from Google Map, Bing Map, and even other pages of my current website (above). It just cannot work with ArcGIS map

Thanks

0 Kudos
3 Replies
LanceParker
New Contributor

Today I can get more trace log with wkhtmltopdf toolkit and it seem that many libaries base on this toolkit will have issue with loading arcgis js.

Here is the details error when generating the image.

 Warning: https://js.arcgis.com/4.7/dojo/dojo.js:29 TypeError: 'undefined' is not an object

0 Kudos
LanceParker
New Contributor

FYI: 

I'm able to get the map image using wkhtmltopdf with javascript version 3 only, not version 4. So basically there is something is not good with wkhtmltopdf and its base libraries. I will update in this thread when I have result from wkhtmltopdf  guys.

JavaScript V3 test link   

ArcGIS API for JavaScript Sandbox 

JavaScript V4 test link

ArcGIS API for JavaScript Sandbox 

0 Kudos
by Anonymous User
Not applicable

Hi Lance

Did you ever get a resolution with this question? I'm attempting to use wkhtmltopdf as well and coming up with similar problems. It will export, but I can't get it to export with the map actually loaded. I've tried with ArcGIS javascript v3 and v4 with no luck. Tried using the --javascript-delay switch but no luck. And tried using the --window-status switch b setting that on various handlers, or even just a timeout in the page but no go. In the case of setting timeouts, I can see a pause in the execution of wkhtmltopdf (e.g. if I set it to something long like 20 seconds), but still just getting blank output where the map should be.

I'm testing with the most basic html page possible with just a basic map element.

0 Kudos