setPaintProperties raises exception on ArcGIS API for JavaScript 4.18

507
1
01-28-2021 02:15 PM
Adiba
by
New Contributor

After upgrading to the new ArcGIS API for JavaScript 4.18, calling the function setPaintProperties of a VectorTileLayer raises the following exception:

 

 

Uncaught TypeError: can't convert undefined to object
    G VectorTileLayerView2D.js:267
    attach VectorTileLayerView2D.js:273
    emit (index):234
    emit (index):234
    emit (index):235
    setLayoutProperties VectorTileLayer.js:184
    React 5
    unstable_runWithPriority scheduler.development.js:646
    React 3
    workLoop scheduler.development.js:590
    flushWork scheduler.development.js:545
    performWorkUntilDeadline scheduler.development.js:157
    js scheduler.development.js:180
    js scheduler.development.js:843
    Webpack 21
VectorTileLayerView2D.js:267:195
    G VectorTileLayerView2D.js:267
    attach VectorTileLayerView2D.js:273
    emit (index):234
    forEach self-hosted:206
    emit (index):234
    emit (index):235
    setLayoutProperties VectorTileLayer.js:184
    React 5
    unstable_runWithPriority scheduler.development.js:646
    React 3
    workLoop scheduler.development.js:590
    flushWork scheduler.development.js:545
    performWorkUntilDeadline scheduler.development.js:157
    (Async: EventHandlerNonNull)
    js scheduler.development.js:180
    js scheduler.development.js:843

 

 


I have tried calling the same function with the following PaintProps objects, but I get always the same exception:

 

 

{visibility: "visible"}
{}
{
"text-allow-overlap": false,
​
"text-anchor": "top",
​
"text-field": "{field}",
​
"text-font": Array [ "arial-regular" ],
​
"text-justify": "center",
​
"text-line-height": 1,
​
"text-offset": Array [ 0, 0 ],
​
"text-padding": 0,
​
"text-size": 18,
​
visibility: "visible"
​
}

 

 

 

Tags (1)
0 Kudos
1 Reply
UndralBatsukh
Esri Regular Contributor

Hi there, 

Can you please provide a reproducible case? Visibility is a layout property (https://docs.mapbox.com/mapbox-gl-js/style-spec/layers/#layout-property) so using setPaintProperties to change style layer visibility wont work.  In any case, I am not able to reproduce the issue with this sample. https://developers.arcgis.com/javascript/latest/sample-code/layers-vectortilelayer-json/

Please check out this sample as showcases new methods that will allow you update the vector tile styles. https://developers.arcgis.com/javascript/latest/sample-code/layers-vectortilelayer-style/

 

-Undral

0 Kudos