OpenLayers getFeatures() access properties

1.2k Views Asked by At

I have some levels with many features. Each feature has properties, e.g. Values (is an Array). But I can not access this property.

When I try to access the property like that

layer.getSource().getFeatures()[0].values

I get an undefined exception. I try to access it

layer.getSource().getFeatures().get('values')

Does this function not exist.

What must i do? How can i access my required values?

1

There are 1 best solutions below

0
On

You can use

layer.getSource().getFeatures()[0].getProperties().values

or

layer.getSource().getFeatures()[0].get('values')