AnsweredAssumed Answered

ReferenceError: Graphic is not defined

Question asked by nmandava6442 on Apr 15, 2015
Latest reply on Apr 15, 2015 by kenbuja

Hello,

 

I'm trying to use the goecoder using dojo JavaScript. When I submit the address, I have this "ReferenceError: Graphic is not defined" error message. Any clue what s happening.

 

Below is my code:

  "esri/dijit/Geocoder",

  "esri/graphic" // search

    

   // begin geocoder

             var geocoder = new Geocoder({

                 map: map,

                 autoComplete: true,

                 zoomScale: 600

             }, dom.byId("search"));

             geocoder.startup();

 

             geocoder.on("select", showLocation);

 

 

 

             function showLocation(evt) {

                 map.graphics.clear();

                 var point = evt.result.feature.geometry;

                 var symbol = new SimpleMarkerSymbol()

                                .setStyle("square")

                                .setColor([255, 0, 0, 0.5]);

                 var graphic = new Graphic(point, symbol);

                 map.graphics.add(graphic);

 

 

                 map.infoWindow.setTitle("Search Result");

                 map.infoWindow.setContent(evt.result.name);

                 map.infoWindow.show(evt.result.feature.geometry);

                 map.infoWindow.on('hide', function () {

                     map.graphics.remove(graphic);

                 });

             }

             // end geocoder

 

 

Error at this line:

ReferenceError: Graphic is not defined

var graphic = new Graphic(point, symbol);

 

Thanks,

Naveen Mandava.

 

Outcomes