I am trying to create a polygon feature layer from a feature collection using the ArcGIS API for Javascript. I have modified Esri's Flickr sample to use polygon geometries, rather than point geometries. The features are not getting added to the layer properly. I have put together a JSFiddle here that illustrates the problem. I have commented out the method where I add the features (line 137).
http://jsfiddle.net/gregKnight66/mmhqqan6/
There isn't an error per se, I am just not getting results (the features are not added to the layer).
var featureLayer = new FeatureLayer(featureCollection, {
id: 'buildingFeatures'
});
map.on("layers-add-result", function (results) {
addBuildingFeatures();
});
map.addLayers([featureLayer]);
function addBuildingFeatures() {
var features = buildingFeatures;
featureLayer.applyEdits(features, null, null);
}