in this example in openlayers webstie: here
there is a style function the takes feature
ans resolution
as input parameters. my question is about the feature
parameter.
as stated in the code below:
style: function (feature, resolution) {
switch (feature.get('layer')) {
case 'water':
return waterStyle;
case 'roads':
return roadStyle(feature);
case 'buildings':
return resolution < 10 ? buildingStyle : null;
default:
return null;
}
},
}),
the feature
has a key named layer
. and in this code:
const roadStyle = function (feature) {
const kind = feature.get('kind');
const railway = feature.get('railway');
const sort_key = feature.get('sort_key');
feature
has other keys as shown.
my question is, how these key were added to the feature
, the code showed how the values can be retrieved given the keys, but how these keys were initially added?
i hope my explanation is clear