setProperty

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

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

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');
}

Return

true if the property was set, false otherwise.

Parameters

name

The case-sensitive name of the property.

value

The value of the property that will be copied.

See also