var stateFeature = map.forEachFeatureAtPixel(evt.pixel, function (feature, layer) { // If layer is undefined, that means it's a feature from a FeatureOverlay if (layer) { return feature; } }, null, function (layer) { return layer === statesLayer; });
var stateFeature = map.forEachFeatureAtPixel(evt.pixel, function (feature, layer) {
// If layer is undefined, that means it's a feature from a FeatureOverlay
if (layer) {
return feature;
}
}, null, function (layer) {
return layer === statesLayer;
});
The feature is undefined.