setProperty

fun setProperty(name: String, value: Any)(source)

Sets the value of the feature's property with the given name.

If a property with the given name doesn't exist, it is created.

const height = feature.getProperty('Height'); // e.g., the height of a building
const name = 'clicked';
if (feature.getProperty(name)) {
console.log('already clicked');
} else {
feature.setProperty(name, true);
console.log('first click');
}

Parameters

name

The case-sensitive name of the property.

value

The value of the property that will be copied.

See also