in my project I define many var, including this one in example:
var lyr_Confini = new ol.layer.Vector({
declutter: true,
source: jsonSource_Confini,
style: style_Confini,
interactive: true,
title: 'Confini'
});
In a second time, or in another file called later in the index.html, I would like to add a variable in this ol.layer.Vector without overwriting the other variables like:
permalink: 'example',
to have this example in the end:
var lyr_Confini = new ol.layer.Vector({
declutter: true,
source: jsonSource_Confini,
style: style_Confini,
interactive: true,
title: 'Confini',
permalink: 'example',
});
How can I do? Thanks
I managed to solve it on my own. The answer was actually very simple and it was enough to read the Openlayers API well.
The documentation specifies that it is possible to add properties with
setPropertiesand define a value of a property withset(key,value)therefore the example in question can be solved by adding this code in the same file or in another file called later from the index.htmlyou will have finally