I am trying to add client-side feature graphics to a feature layer in a map with a roadmap baselayer using the following code, but nothing seems to appear on the map:
function CreateFeatureLayer() {
featureLayer=new FeatureLayer({
source:[],
objectIdField:"OBJECTID",
geometryType:"point",
spatialReference: { wkid: 4326 },
fields:[ { name:"OBJECTID", type:"oid" }, { name:"name", type:"string" }, { name:"ktypemid", type:"string" }, { name:"kmid", type:"string" }],
renderer: { type:"simple", symbol:{ type: "web-style", styleName: "Esri2DPointSymbolsStyle", name: "landmark" } },
popupTemplate: { title: "{Name}" }
});
map.add(featureLayer);
const data=[{ LATITUDE: 37.6251, LONGITUDE: -119.085, TYPE: "Title", NAME: "Name" }];
let graphics=[];
let i=0,graphic;
for (i=0;i<data.length;i++) {
graphic=new Graphic({
geometry: { type: "point", latitude: data[i].LATITUDE, longitude: data[i].LONGITUDE },
attributes: data[i]
});
graphics.push(graphic);
}
app.featureLayer.applyEdits(graphics);
}
Not sure what I'm doing wrong, after modeling an example. I also want to be able to use my own bitmap, rather than an ESRI icon.