<?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 Javascript label graphic points in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-label-graphic-points/m-p/639088#M59678</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;I have successfully been able to query my results and put them in a table and show them as points on my map thanks to a lot of help from these forums. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now what I would like to do is create another graphics layer that just has labeling for these points but I am struggling with this.&amp;nbsp; I've searched endlessly for a way to do this.&amp;nbsp; I've looked through the samples I've found something called a labellayer but I don't know how to apply that.&amp;nbsp; I would think I would be able to use something like what I did for the graphics below but instead of a symbol use text.&amp;nbsp; I created a StoresResultsLayer_Labels as you can see below.&amp;nbsp; I'm sure this is simple but it is not for me for some reason.&amp;nbsp; Any help is greatly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//My layers loaded at the start of the application but blank&lt;/P&gt;&lt;P&gt;StoresResultsLayer = new GraphicsLayer();&lt;BR /&gt;StoresResultsLayer.id = 'StoresResults';&amp;nbsp;&amp;nbsp; &lt;BR /&gt;map.addLayer(StoresResultsLayer,0);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;StoresResultsLayer_Labels = new GraphicsLayer();&lt;BR /&gt;StoresResultsLayer_Labels.id = 'StoresResults_Labels';&amp;nbsp;&amp;nbsp; &lt;BR /&gt;map.addLayer(StoresResultsLayer_Labels,0);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//Some of my code from my function&lt;/P&gt;&lt;P&gt;var symbol = new esri.symbol.SimpleMarkerSymbol({&amp;nbsp; &lt;/P&gt;&lt;P&gt;"color": [255,255,0,255],&amp;nbsp; &lt;/P&gt;&lt;P&gt;"size": 11,&amp;nbsp; &lt;/P&gt;&lt;P&gt;"xoffset": 1,&amp;nbsp; &lt;/P&gt;&lt;P&gt;"yoffset": -2,&amp;nbsp; &lt;/P&gt;&lt;P&gt;"type": "esriSMS",&amp;nbsp; &lt;/P&gt;&lt;P&gt;"style": "esriSMSCircle",&amp;nbsp; &lt;/P&gt;&lt;P&gt;"outline": {&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;"color": [0,0,0,255],&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;"width": 3,&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;"type": "esriSLS",&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;"style": "esriSLSSolid"&amp;nbsp; }});&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; var dataForGrid = [];&lt;BR /&gt; var temp = "";&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //remove all graphics on the maps graphics layer&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; StoresResultsLayer.clear(); &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Performance enhancer - assign featureSet array to a single variable.&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var resultFeatures = featureSet.features;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Loop through each feature returned&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (var i=0, il=resultFeatures.length; i&amp;lt;il; i++) {&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Get the current feature from the featureSet.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Feature is a graphic&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var graphic = resultFeatures&lt;I&gt;;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; resultFeatures&lt;I&gt;.setSymbol(symbol); &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp; StoresResultsLayer.add(resultFeatures&lt;I&gt;);&lt;BR /&gt;&amp;nbsp; StoresResultsLayer.show();&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 29 Sep 2014 14:32:21 GMT</pubDate>
    <dc:creator>deleted-user-yA_w_FC9FKe5</dc:creator>
    <dc:date>2014-09-29T14:32:21Z</dc:date>
    <item>
      <title>Javascript label graphic points</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-label-graphic-points/m-p/639088#M59678</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;I have successfully been able to query my results and put them in a table and show them as points on my map thanks to a lot of help from these forums. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now what I would like to do is create another graphics layer that just has labeling for these points but I am struggling with this.&amp;nbsp; I've searched endlessly for a way to do this.&amp;nbsp; I've looked through the samples I've found something called a labellayer but I don't know how to apply that.&amp;nbsp; I would think I would be able to use something like what I did for the graphics below but instead of a symbol use text.&amp;nbsp; I created a StoresResultsLayer_Labels as you can see below.&amp;nbsp; I'm sure this is simple but it is not for me for some reason.&amp;nbsp; Any help is greatly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//My layers loaded at the start of the application but blank&lt;/P&gt;&lt;P&gt;StoresResultsLayer = new GraphicsLayer();&lt;BR /&gt;StoresResultsLayer.id = 'StoresResults';&amp;nbsp;&amp;nbsp; &lt;BR /&gt;map.addLayer(StoresResultsLayer,0);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;StoresResultsLayer_Labels = new GraphicsLayer();&lt;BR /&gt;StoresResultsLayer_Labels.id = 'StoresResults_Labels';&amp;nbsp;&amp;nbsp; &lt;BR /&gt;map.addLayer(StoresResultsLayer_Labels,0);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//Some of my code from my function&lt;/P&gt;&lt;P&gt;var symbol = new esri.symbol.SimpleMarkerSymbol({&amp;nbsp; &lt;/P&gt;&lt;P&gt;"color": [255,255,0,255],&amp;nbsp; &lt;/P&gt;&lt;P&gt;"size": 11,&amp;nbsp; &lt;/P&gt;&lt;P&gt;"xoffset": 1,&amp;nbsp; &lt;/P&gt;&lt;P&gt;"yoffset": -2,&amp;nbsp; &lt;/P&gt;&lt;P&gt;"type": "esriSMS",&amp;nbsp; &lt;/P&gt;&lt;P&gt;"style": "esriSMSCircle",&amp;nbsp; &lt;/P&gt;&lt;P&gt;"outline": {&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;"color": [0,0,0,255],&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;"width": 3,&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;"type": "esriSLS",&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;"style": "esriSLSSolid"&amp;nbsp; }});&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; var dataForGrid = [];&lt;BR /&gt; var temp = "";&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //remove all graphics on the maps graphics layer&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; StoresResultsLayer.clear(); &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Performance enhancer - assign featureSet array to a single variable.&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var resultFeatures = featureSet.features;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Loop through each feature returned&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (var i=0, il=resultFeatures.length; i&amp;lt;il; i++) {&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Get the current feature from the featureSet.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Feature is a graphic&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var graphic = resultFeatures&lt;I&gt;;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; resultFeatures&lt;I&gt;.setSymbol(symbol); &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp; StoresResultsLayer.add(resultFeatures&lt;I&gt;);&lt;BR /&gt;&amp;nbsp; StoresResultsLayer.show();&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Sep 2014 14:32:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-label-graphic-points/m-p/639088#M59678</guid>
      <dc:creator>deleted-user-yA_w_FC9FKe5</dc:creator>
      <dc:date>2014-09-29T14:32:21Z</dc:date>
    </item>
    <item>
      <title>Re: Javascript label graphic points</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-label-graphic-points/m-p/639089#M59679</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Michael -&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It should in fact be pretty simple for you since you already have dealt with adding the graphics. You need to do 3 things: create a label renderer, create a label layer, and then add the features to the label layer. A lot of the information is here: &lt;A href="https://developers.arcgis.com/javascript/jsapi/labellayer-amd.html" title="https://developers.arcgis.com/javascript/jsapi/labellayer-amd.html"&gt;labellayer-amd | API Reference | ArcGIS API for JavaScript.&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="javascript" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14120051015212423" jivemacro_uid="_14120051015212423" modifiedtitle="true"&gt;
&lt;P&gt;// Make sure you include all of the modules here in your JavaScript 'require' function (e.g. 'esri/layers/LabelLayer', &lt;/P&gt;
&lt;P&gt;// 'esri/symbols/TextSymbols' etc)&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;// Create label renderer&lt;/P&gt;
&lt;P&gt;var labelParams = new TextSymbol({&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "type" : "esriTS",&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "color" : [0, 0, 153, 255],&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "font" : {&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "size" : 12,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "style" : "normal",&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "weight" : "normal"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;/P&gt;
&lt;P&gt;var labelRenderer = new SimpleRenderer(labelParams);&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;// Create the empty label layer&lt;/P&gt;
&lt;P&gt;graphicsLabelLayer = new LabelLayer({&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; id : "graphicsLabels"&lt;/P&gt;
&lt;P&gt; });&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;// Associate the label layer with the graphics you want to label&lt;/P&gt;
&lt;P&gt;// Substitute in the field name you want to use to label your features&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: rgba(0, 0, 0, 0); font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px;"&gt;graphicsLabelLayer&lt;/SPAN&gt;.addFeatureLayer(&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;StoresResultsLayer &lt;/SPAN&gt;, labelRenderer, '{field_name}');&lt;/P&gt;
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Sep 2014 15:46:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-label-graphic-points/m-p/639089#M59679</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2014-09-29T15:46:44Z</dc:date>
    </item>
    <item>
      <title>Re: Javascript label graphic points</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-label-graphic-points/m-p/639090#M59680</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sarah and thanks for the quick reply.&amp;nbsp; I've tried messing around with your code&amp;nbsp; and this example:&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/jssamples/layers_label.html" title="https://developers.arcgis.com/javascript/jssamples/layers_label.html"&gt;Label Layer | ArcGIS API for JavaScript&lt;/A&gt; but for the life of me I can't get it working.&amp;nbsp; I wonder if it is because I am using a graphics layer and not a feature layer?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basically I am filtering out a layer and then presenting the results as graphics.&amp;nbsp; I would then like to have labels for each of the graphics so they know the points name.&amp;nbsp; (StoreName) in this case. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Sep 2014 11:19:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-label-graphic-points/m-p/639090#M59680</guid>
      <dc:creator>deleted-user-yA_w_FC9FKe5</dc:creator>
      <dc:date>2014-09-30T11:19:48Z</dc:date>
    </item>
    <item>
      <title>Re: Javascript label graphic points</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-label-graphic-points/m-p/639091#M59681</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This lead me in the right direction.&amp;nbsp; I just created another feature layer with opacity set to 00 and then used that to label.&amp;nbsp; Not the best of solutions but hey it works.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Sep 2014 12:17:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-label-graphic-points/m-p/639091#M59681</guid>
      <dc:creator>deleted-user-yA_w_FC9FKe5</dc:creator>
      <dc:date>2014-09-30T12:17:51Z</dc:date>
    </item>
    <item>
      <title>Re: Javascript label graphic points</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-label-graphic-points/m-p/639092#M59682</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You know, in looking at the documentation it does seem to require a feature layer! I hadn't noticed that before, and I didn't test it, but I think you made the right call there.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Sep 2014 16:07:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-label-graphic-points/m-p/639092#M59682</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2014-09-30T16:07:17Z</dc:date>
    </item>
  </channel>
</rss>

