I created my geojson layer like this:
var gjlayer = new ol.layer.Vector({
title: 'My Layer',
source: new ol.source.Vector({
url: '/path-to-my-geojson-file',
format: new ol.format.GeoJSON()
})
});
It's got properties on it that I change that I want to change when I click a polygon that was drawn from the gjlayer:
var feature = mc.map.forEachFeatureAtPixel(evt.pixel,
function(feature, layer) {
return feature;
});
if (feature) {
feature.set('newproperty', 'new');
};
The problem is, this 'feature.set' does not appear to actually change gjlayer. If I log out the feature and attempt to style it onclick it does change the color based on the property, it appears to work, but the problem is the same polygon that is in gjlayer appears to remain the same... so if I clear the map and 'redraw' gjlayer, the styling and the property are not there.
I expect that if I cleared the map, and 'readded' the gjlayer, the feature that had the 'newproperty' would be there.