AnsweredAssumed Answered

Having Issue on Adding Point Graphic to The ArcGIS API for JS Map

Question asked by BEHSEINI on Aug 26, 2015
Latest reply on Aug 26, 2015 by BEHSEINI

Can you please take a look at this JSFiddle and let me know why I am not able to add the Market into the Map? I am getting this error

 

Uncaught TypeError: Cannot read property 'add' of null

Here is the ode I have

 

 var graphicsArray = [];
    require(["esri/map",
        "esri/geometry/Geometry",
        "esri/geometry/Point",
        "esri/geometry/Polyline",
        "esri/geometry/Polygon",
        "esri/graphic",
        "esri/symbols/SimpleMarkerSymbol",
        "esri/symbols/SimpleLineSymbol",
        "esri/symbols/SimpleFillSymbol",
        "esri/Color",
        "esri/InfoTemplate",
        "dojo/domReady!",
        "esri/geometry"], function (Map,


    Geometry,
    Point,
    Polyline,
    Polygon,
    Graphic,
    SimpleMarkerSymbol,
    SimpleLineSymbol,
    SimpleFillSymbol,
    Color,
    InfoTemplate) {
        map = new Map("map", {
            basemap: "topo",
            center: [-106.61, 35.1107],
            zoom: 13
        });
        var point = new Point(-106.61, 35.1107);
        var pointSymbol = new SimpleMarkerSymbol();
        var pointAttributes = { city: "Albuquerque", state: "New Mexico" };
        var pointInfoTemplate = new InfoTemplate("Albuquerque");
        var pointGraphic = new Graphic(point, pointSymbol, pointAttributes).setInfoTemplate(pointInfoTemplate);


        graphicsArray.push(pointGraphic);
        for (i = 0; i < graphicsArray.length; ++i) {
            map.graphics.add(graphicsArray[i]);


        }


    });

 

 

 

 html, body, #map {
              height: 100%;
              width: 100%;
              margin: 0;
              padding: 0;
          }
          body {
              background-color: #FFF;
              overflow: hidden;
              font-family:"Trebuchet MS";
          }

 

 

 

                

 

 

 

  [1]: http://jsfiddle.net/Behseini/ady51wrn/

Outcomes