<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic problem with map.graphics.add(graphic); in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problem-with-map-graphics-add-graphic/m-p/423001#M38900</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi all,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;function getLocRes(results) {
 //map.graphics.clear();
 var symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([80, 0, 0]), 2), new dojo.Color([80, 0, 0, 0.5]));
 var combinedExtent = new esri.geometry.Extent();
 console.log("er",results.features.length);
 for (var i = 0;i &amp;lt; results.features.length; i++) {console.log("i=",i);
&amp;nbsp; var polyGraphic = new esri.Graphic(results.features&lt;I&gt;, symbol);
&amp;nbsp; console.log("i=",polyGraphic);
&amp;nbsp; polyGraphic.setSymbol(symbol);
&amp;nbsp; //map.graphics.add(graphic);
 }
 combinedExtent = esri.graphicsExtent(results.features);
 map.setExtent(combinedExtent, true);
}&lt;/I&gt;&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;this function is working sort of&amp;nbsp; but when I enable either&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;map.graphics.clear();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;or&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;map.graphics.add(graphic);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;it stops where the code is&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;console.log("i=",i);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;this shows&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;only 0 when map.graphics.add(graphic); is on&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;if not it doesn't add graphic but shows console.log("i=",i); result until the end&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Am I missing something here that map.graphics.add(graphic); shouldn't work?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;dojo.require("dijit.layout.BorderContainer");
dojo.require("dijit.layout.ContentPane");
dojo.require("esri.map");
dojo.require("esri.dijit.Popup");
dojo.require("esri.dijit.Legend");
dojo.require("esri.layers.agsdynamic");

dojo.require("esri.layers.ArcGISTiledMapServiceLayer");
dojo.require("dijit.dijit");
dojo.require("esri.tasks.find");//search&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 

dojo.require("esri.arcgis.utils");
dojo.require("esri.dijit.Print");
dojo.require("dojox.grid.DataGrid");

dojo.require("dojo.data.ItemFileReadStore");
dojo.require("dijit.form.Button");
dojo.require("esri.tasks.query");
dojo.require("esri.dijit.Scalebar");
dojo.require("esri.graphic");
dojo.require("esri.symbol");&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 29 Apr 2014 18:20:14 GMT</pubDate>
    <dc:creator>GyeyoungChoi</dc:creator>
    <dc:date>2014-04-29T18:20:14Z</dc:date>
    <item>
      <title>problem with map.graphics.add(graphic);</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problem-with-map-graphics-add-graphic/m-p/423001#M38900</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi all,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;function getLocRes(results) {
 //map.graphics.clear();
 var symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([80, 0, 0]), 2), new dojo.Color([80, 0, 0, 0.5]));
 var combinedExtent = new esri.geometry.Extent();
 console.log("er",results.features.length);
 for (var i = 0;i &amp;lt; results.features.length; i++) {console.log("i=",i);
&amp;nbsp; var polyGraphic = new esri.Graphic(results.features&lt;I&gt;, symbol);
&amp;nbsp; console.log("i=",polyGraphic);
&amp;nbsp; polyGraphic.setSymbol(symbol);
&amp;nbsp; //map.graphics.add(graphic);
 }
 combinedExtent = esri.graphicsExtent(results.features);
 map.setExtent(combinedExtent, true);
}&lt;/I&gt;&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;this function is working sort of&amp;nbsp; but when I enable either&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;map.graphics.clear();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;or&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;map.graphics.add(graphic);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;it stops where the code is&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;console.log("i=",i);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;this shows&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;only 0 when map.graphics.add(graphic); is on&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;if not it doesn't add graphic but shows console.log("i=",i); result until the end&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Am I missing something here that map.graphics.add(graphic); shouldn't work?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;dojo.require("dijit.layout.BorderContainer");
dojo.require("dijit.layout.ContentPane");
dojo.require("esri.map");
dojo.require("esri.dijit.Popup");
dojo.require("esri.dijit.Legend");
dojo.require("esri.layers.agsdynamic");

dojo.require("esri.layers.ArcGISTiledMapServiceLayer");
dojo.require("dijit.dijit");
dojo.require("esri.tasks.find");//search&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 

dojo.require("esri.arcgis.utils");
dojo.require("esri.dijit.Print");
dojo.require("dojox.grid.DataGrid");

dojo.require("dojo.data.ItemFileReadStore");
dojo.require("dijit.form.Button");
dojo.require("esri.tasks.query");
dojo.require("esri.dijit.Scalebar");
dojo.require("esri.graphic");
dojo.require("esri.symbol");&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Apr 2014 18:20:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problem-with-map-graphics-add-graphic/m-p/423001#M38900</guid>
      <dc:creator>GyeyoungChoi</dc:creator>
      <dc:date>2014-04-29T18:20:14Z</dc:date>
    </item>
    <item>
      <title>Re: problem with map.graphics.add(graphic);</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problem-with-map-graphics-add-graphic/m-p/423002#M38901</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You are trying to add an object that does not exist. You want to add 'polyGraphic' to the map.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
map.graphics.add(polyGraphic);
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, make sure you have access to your map object within that functional scope.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 19:06:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problem-with-map-graphics-add-graphic/m-p/423002#M38901</guid>
      <dc:creator>JonathanUihlein</dc:creator>
      <dc:date>2021-12-11T19:06:54Z</dc:date>
    </item>
    <item>
      <title>Re: problem with map.graphics.add(graphic);</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problem-with-map-graphics-add-graphic/m-p/423003#M38902</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;You are trying to add an object that does not exist. You want to add 'polyGraphic' to the map.&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
map.graphics.add(polyGraphic);
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;Also, make sure you have access to your map object within that functional scope.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;oops, but anyways that wasn't problem still does same thing&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;and I have full access to the map as well &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;any suggestions? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've tried&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
function getLocRes(results) {
 //map.graphics.clear();
 var symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([80, 0, 0]), 2), new dojo.Color([80, 0, 0, 0.5]));
 var combinedExtent = new esri.geometry.Extent();
 for (var i = 0;i &amp;lt; results.features.length; i++) {console.log("i=",i);
&amp;nbsp; var polyGraphic = new esri.Graphic(results.features&lt;I&gt;, symbol);
&amp;nbsp; map.graphics.add(polyGraphic);
&amp;nbsp; console.log("i=",i);
 }
 combinedExtent = esri.graphicsExtent(results.features);
 map.setExtent(combinedExtent, true);
}
&lt;/I&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
function getLocRes(results) {
 //map.graphics.clear();
 var symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([80, 0, 0]), 2), new dojo.Color([80, 0, 0, 0.5]));
 var combinedExtent = new esri.geometry.Extent();
 for (var i = 0;i &amp;lt; results.features.length; i++) {console.log("i=",i);
&amp;nbsp; var polyGraphic = results.features&lt;I&gt;;
&amp;nbsp; polyGraphic.setSymbol(symbol);
&amp;nbsp; map.graphics.add(polyGraphic);
&amp;nbsp; console.log("i=",i);
 }
 combinedExtent = esri.graphicsExtent(results.features);
 map.setExtent(combinedExtent, true);
}
&lt;/I&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;both stop at either map.graphics.add(polyGraphic); or&amp;nbsp; map.graphics.clear();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks Jon&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 19:06:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problem-with-map-graphics-add-graphic/m-p/423003#M38902</guid>
      <dc:creator>GyeyoungChoi</dc:creator>
      <dc:date>2021-12-11T19:06:57Z</dc:date>
    </item>
    <item>
      <title>Re: problem with map.graphics.add(graphic);</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problem-with-map-graphics-add-graphic/m-p/423004#M38903</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Could you recreate the issue using jsfiddle.net so I can take a closer look? Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Apr 2014 19:27:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problem-with-map-graphics-add-graphic/m-p/423004#M38903</guid>
      <dc:creator>JonathanUihlein</dc:creator>
      <dc:date>2014-04-29T19:27:50Z</dc:date>
    </item>
    <item>
      <title>Re: problem with map.graphics.add(graphic);</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problem-with-map-graphics-add-graphic/m-p/423005#M38904</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Could you recreate the issue using jsfiddle.net so I can take a closer look? Thanks!&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried using jsfiddle but here is url &lt;/SPAN&gt;&lt;A _jive_internal="true" href="https://community.esri.com/ "&gt; &lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Apr 2014 20:39:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problem-with-map-graphics-add-graphic/m-p/423005#M38904</guid>
      <dc:creator>GyeyoungChoi</dc:creator>
      <dc:date>2014-04-29T20:39:12Z</dc:date>
    </item>
    <item>
      <title>Re: problem with map.graphics.add(graphic);</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problem-with-map-graphics-add-graphic/m-p/423006#M38905</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Unfortunately, this doesn't help because your application is simply too big for me to spend time digging through. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I really need you to strip out all the unnecessary code and create a sample that highlights your specific issue using jsfiddle.net.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Sometimes, when doing this, the issue presents itself, so I suggest giving it a try!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Sorry and thank you!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Apr 2014 20:52:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problem-with-map-graphics-add-graphic/m-p/423006#M38905</guid>
      <dc:creator>JonathanUihlein</dc:creator>
      <dc:date>2014-04-29T20:52:09Z</dc:date>
    </item>
    <item>
      <title>Re: problem with map.graphics.add(graphic);</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problem-with-map-graphics-add-graphic/m-p/423007#M38906</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Unfortunately, this doesn't help because your application is simply too big for me to spend time digging through. &lt;BR /&gt;&lt;BR /&gt;I really need you to strip out all the unnecessary code and create a sample that highlights your specific issue using jsfiddle.net.&lt;BR /&gt;&lt;BR /&gt;Sometimes, when doing this, the issue presents itself, so I suggest giving it a try!&lt;BR /&gt;&lt;BR /&gt;Sorry and thank you!&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks Jon &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I'll try to put my code on jsfiddle soon&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Apr 2014 20:54:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problem-with-map-graphics-add-graphic/m-p/423007#M38906</guid>
      <dc:creator>GyeyoungChoi</dc:creator>
      <dc:date>2014-04-29T20:54:44Z</dc:date>
    </item>
    <item>
      <title>Re: problem with map.graphics.add(graphic);</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problem-with-map-graphics-add-graphic/m-p/423008#M38907</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;here is how it works and problems:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;url looks like &lt;/SPAN&gt;&lt;A href="http://my.com/test.htm?bldgabbrv=msc,sup3,gsc,rudd,cen"&gt;http://my.com/test.htm?bldgabbrv=msc,sup3,gsc,rudd,cen&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;query.where = Abbrev = 'MSC' OR Abbrev = 'SUP3' OR Abbrev = 'GSC' OR Abbrev = 'RUDD' OR Abbrev = 'CEN' &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;then queryTask.execute(query, getLocRes);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;if you look at getLocRes&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;script stops where map.whatever without them script just goes (tested with bunch of console.log)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;tried for and while but they were not a problem.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The &lt;/SPAN&gt;&lt;STRONG&gt;Funny thing&lt;/STRONG&gt;&lt;SPAN&gt; is when I add alert(); right before queryTask.execute the function works perfect.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Does anyone knows what I did wrong?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;*update on jsfiddle when u click run it should select 4 polygons in maroon color&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 May 2014 13:56:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problem-with-map-graphics-add-graphic/m-p/423008#M38907</guid>
      <dc:creator>GyeyoungChoi</dc:creator>
      <dc:date>2014-05-01T13:56:31Z</dc:date>
    </item>
    <item>
      <title>Re: problem with map.graphics.add(graphic);</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problem-with-map-graphics-add-graphic/m-p/423009#M38908</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;So the problem with this is &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;error: Cannot read property 'add' of null &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]33536[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am not sure what this means... does anyone knows about this?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 May 2014 18:13:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problem-with-map-graphics-add-graphic/m-p/423009#M38908</guid>
      <dc:creator>GyeyoungChoi</dc:creator>
      <dc:date>2014-05-01T18:13:43Z</dc:date>
    </item>
    <item>
      <title>Re: problem with map.graphics.add(graphic);</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problem-with-map-graphics-add-graphic/m-p/423010#M38909</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;on firebug says&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;error: map.graphics is null&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;still doesn't make any sense&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 May 2014 18:18:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problem-with-map-graphics-add-graphic/m-p/423010#M38909</guid>
      <dc:creator>GyeyoungChoi</dc:creator>
      <dc:date>2014-05-01T18:18:11Z</dc:date>
    </item>
    <item>
      <title>Re: problem with map.graphics.add(graphic);</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problem-with-map-graphics-add-graphic/m-p/423011#M38910</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;my guess is that you are trying to do the query before the map finishes loading.&amp;nbsp; Try moving your query.execute into a map.on layers-add-result event&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;that is why the alert makes it work.&amp;nbsp; It is basically waiting, giving the map enough time to load&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 May 2014 18:51:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problem-with-map-graphics-add-graphic/m-p/423011#M38910</guid>
      <dc:creator>JeffPace</dc:creator>
      <dc:date>2014-05-01T18:51:02Z</dc:date>
    </item>
    <item>
      <title>Re: problem with map.graphics.add(graphic);</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problem-with-map-graphics-add-graphic/m-p/423012#M38911</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;my guess is that you are trying to do the query before the map finishes loading.&amp;nbsp; Try moving your query.execute into a map.on layers-add-result event&lt;BR /&gt;&lt;BR /&gt;that is why the alert makes it work.&amp;nbsp; It is basically waiting, giving the map enough time to load&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks Jeff! on it&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 May 2014 19:10:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problem-with-map-graphics-add-graphic/m-p/423012#M38911</guid>
      <dc:creator>GyeyoungChoi</dc:creator>
      <dc:date>2014-05-01T19:10:55Z</dc:date>
    </item>
    <item>
      <title>Re: problem with map.graphics.add(graphic);</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problem-with-map-graphics-add-graphic/m-p/423013#M38912</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;tried&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
map.on("layers-add-result", queryTask.execute(query, getLocRes, function(error){console.log("error: " + error.message);}));&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;when I use this code below:&lt;/SPAN&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
function getLocRes(results) {
 map.graphics.clear();
 var symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([80, 0, 0]), 2), new dojo.Color([80, 0, 0, 0.5]));
 var combinedExtent = new esri.geometry.Extent();
 for (var i = 0;i &amp;lt; results.features.length; i++){
&amp;nbsp; var polyGraphic = results.features&lt;I&gt;;
&amp;nbsp; polyGraphic.setSymbol(symbol);
&amp;nbsp; map.graphics.add(polyGraphic);
 }
 combinedExtent = esri.graphicsExtent(results.features);
 map.setExtent(combinedExtent, true);
}&lt;/I&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;get&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;error: map.graphics is null&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;which is same&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;and tried this but&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
var polyGraphic = new esri.Graphic(results.features&lt;I&gt;, symbol);
map.graphics.add(polyGraphic);
&lt;/I&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;same&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 19:07:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problem-with-map-graphics-add-graphic/m-p/423013#M38912</guid>
      <dc:creator>GyeyoungChoi</dc:creator>
      <dc:date>2021-12-11T19:07:00Z</dc:date>
    </item>
    <item>
      <title>Re: problem with map.graphics.add(graphic);</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problem-with-map-graphics-add-graphic/m-p/423014#M38913</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I think you should be waiting for the queryTask to complete, not the map add layers event.&amp;nbsp; All my examples I have handy are in AMD style, but you should be able to find some examples that are something like&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
dojo.connect (queryTask, "onComplete", getLocRes);
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Then in the line to execute the query, you won't include the results handler, you'll just run queryTask.execute(query);&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 19:07:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problem-with-map-graphics-add-graphic/m-p/423014#M38913</guid>
      <dc:creator>TracySchloss</dc:creator>
      <dc:date>2021-12-11T19:07:02Z</dc:date>
    </item>
    <item>
      <title>Re: problem with map.graphics.add(graphic);</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problem-with-map-graphics-add-graphic/m-p/423015#M38914</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I think you should be waiting for the queryTask to complete, not the map add layers event.&amp;nbsp; All my examples I have handy are in AMD style, but you should be able to find some examples that are something like&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
dojo.connect (queryTask, "onComplete", getLocRes);
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;Then in the line to execute the query, you won't include the results handler, you'll just run queryTask.execute(query);&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you Tracy! I'll post the result!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 19:07:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problem-with-map-graphics-add-graphic/m-p/423015#M38914</guid>
      <dc:creator>GyeyoungChoi</dc:creator>
      <dc:date>2021-12-11T19:07:05Z</dc:date>
    </item>
  </channel>
</rss>

