AnsweredAssumed Answered

ESRI JS API 4.11: webworkers: document is not defined

Question asked by michal.gasparovic@bhp.com_bhp on May 13, 2019
Latest reply on May 16, 2019 by ubatsukh-esristaff

I'd like to report a broken functionality, I cannot create the ElevationLayer in webworker anymore, ending with the error of: 

 {name: "ReferenceError", message: "document is not defined", details: undefined}

 

Webworker file (excerpt)

Calculator.prototype.startViewshed = function(data, connection) {
  if (!elevationLayer || elevationLayer.url !== data.url) {
    // --> Error happens here
    elevationLayer = new ElevationLayer({
      url: data.url
    });
  }

..
..
..

I need to create the ElevationLayer so I can create an elevationSampler and run the analysis on it. Apparently, the 4.11 version does require a 'document' to be available, whereas it wasn't a requirement for 4.10 version of ElevationLayer class.

 

Please advise the relevant workaround for this issue. Thank you.

Outcomes