I'm new to esri so thanks in advance for reading. I have a json string that I'm trying to turn into points on a feature layer. esri doesn't complain about the json but it only puts one of the points on the map. Am I missing something obvious here? Thanks in advance:
data= {"geometryType": "esriGeometryPoint",
"spatialReference": {
"wkid": 102100,
"latestWkid": 102100
},
"features":[
{
"attributes":{
"Moisture":"2.66",
"Width":"914",
"Yield":"144.725399633191"
},
"geometry":{
"spatialReference":{
"wkid":102100
},
"x":-1.0402576116868861E7,
"y":5138355.49346632
}
},
{
"attributes":{
"Moisture":"25.64",
"Width":"914",
"Yield":"12.5850541487206"
},
"geometry":{
"spatialReference":{
"wkid":102100
},
"x":-1.0402517685268145E7,
"y":5138268.160804208
}
}
]
};
var featureCollection = {
layerDefinition: null,
featureSet: data
};
console.log(featureCollection.featureSet);
featureCollection.layerDefinition = {
"geometryType": "esriGeometryPoint",
"objectIdField": "ObjectID",
"fields": [{
"name": "ObjectID",
"alias": "ObjectID",
"type": "esriFieldTypeOID"
},
/*{ "name": "description",
"alias": "Description",
"type": "esriFieldTypeString"
},
{"name": "title",
"alias": "Title",
"type": "esriFieldTypeString"
},*/
{"name": "Yield",
"alias": "Yield",
"type": "esriFieldTypeString"
}]
};
var featureLayer = new esri.layers.FeatureLayer(featureCollection,{"mode":esri.layers.FeatureLayer.MODE_SNAPSHOT});
featureLayer.setRenderer(yieldRenderer);
featureLayer.id="yieldLayer";
map.addLayer(featureLayer);
... View more