AnsweredAssumed Answered

Cannot remove WMTS layer from MapView

Question asked by opli on Dec 18, 2018
Latest reply on Dec 19, 2018 by ubatsukh-esristaff

Hi,

 

I changed to use ArcGIS JS 4.10 API and noticed that I cannot remove WMTS layer from view.map

 

console.log shows:

Uncaught (in promise) TypeError: Cannot set property 'visible' of null
at Object.<anonymous> (MapView.js:603)
at b.callback (dojo.js:365)
at b.notify (dojo.js:325)
at b.propertyInvalidated (dojo.js:326)
at b.propertyInvalidated (dojo.js:298)
at b.callback (dojo.js:330)
at b.notify (dojo.js:325)
at b.propertyCommitted (dojo.js:327)
at b.propertyCommitted (dojo.js:299)
at b.internalSet (dojo.js:297)

 

I have attached example file. Changing active layer to another will trigger the remove operation which causes the problem.

 

This was working on ArcGIS JS API 4.9 and this problem occurs only with WMTS layers. Please provide a fix as soon as possible.

 

UPDATE:

Found a workaround. Set layer visible to false on WMTS layer before removing it from the MapView then it does not cause the crash.

 

Br,

Markus

Outcomes