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({ 
        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}"  }


    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]


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.

1 Answer 1


Turns out I needed to use a GraphicsLayer, not a FeatureLayer: Here's what worked:

    gl=new GraphicsLayer();  

    function AddPopovers(data) {                                                                
        let i,graphic;
        for (i=0;i<data.length;i++) {                                                           // For each element
            graphic=new Graphic({                                                               // Addloc new graphic
                geometry:{ type: "point", latitude:data[i].lat, longitude:data[i].lon },        // Position
                symbol:{ type: "picture-marker", url:"popover.png", width:19, height:13 },      // Shape
                attributes:data[i]                                                              // Raw data

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.