<?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 Re: Adding points to graphicsLayer using feature's coordinates stored in attributes in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/adding-points-to-graphicslayer-using-feature-s/m-p/653692#M60908</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I figured out part of my problem. I did not capitalize my attribute so that it matches the field name - CentroidLongitude vs centroidLongitude. Now I can at least see the value in console.log.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Still can't figure out how to add graphic markers to a graphicsLayer using this information.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 30 Apr 2013 18:11:38 GMT</pubDate>
    <dc:creator>MikeOnzay</dc:creator>
    <dc:date>2013-04-30T18:11:38Z</dc:date>
    <item>
      <title>Adding points to graphicsLayer using feature's coordinates stored in attributes</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/adding-points-to-graphicslayer-using-feature-s/m-p/653691#M60907</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Is it possible to add graphic points to the map or graphicsLayer using coordinates stored in the feature? I'm using a query to collect the features I'm interested in. The function addToMap will display those polygons on a the map graphics layer or another graphics Layer (I did that just to test it). I want to add a point marker on top using the coordinates in the feature. The coordinate fields type are double. I haven't been able to retrieve those coordinates even to show them through console.log much less create a graphic point. Various attempts show undefined. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;function addToMap(featureSet) { &amp;nbsp;&amp;nbsp; &amp;nbsp; //initialize symbology &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; defaultSymbol = new esri.symbol.SimpleMarkerSymbol().setColor(new dojo.Color([255,0,255])); &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var iconSymbol = new esri.symbol.PictureMarkerSymbol({ &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "angle":0, &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "xoffset":0, &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "yoffset":10, &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "type":"esriPMS", &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "url":"http://static.arcgis.com/images/Symbols/Shapes/BluePin1LargeB.png", &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "contentType":"image/png", &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "width":24, &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "height":24 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }); &amp;nbsp;&amp;nbsp; &amp;nbsp; var gLayer = new esri.layers.GraphicsLayer(); &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; iTemplate = new esri.InfoTemplate("Sitename", "&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;${Sitename}&amp;lt;/tr&amp;gt;&amp;lt;/td&amp;gt;"); &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map.addLayer(gLayer);&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dojo.forEach(featureSet.features,function(feature){ &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map.graphics.add(feature.setSymbol(defaultSymbol).setInfoTemplate(iTemplate)); &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //gLayer.add(feature.setSymbol(defaultSymbol).setInfoTemplate(iTemplate)); &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //var ptX = feature.attributes.centroidLongitude; // returns undefined &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //var ptX = feature.centroidLongitude; // returns undefined &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //var ptY = feature.attributes.centroidLatitude; &amp;nbsp;&amp;nbsp; console.log(ptX); &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gLayer.add(new esri.geometry.Point(ptX,ptY,map.spatialReference).setSymbol(iconSymbol)); &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Apr 2013 14:58:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/adding-points-to-graphicslayer-using-feature-s/m-p/653691#M60907</guid>
      <dc:creator>MikeOnzay</dc:creator>
      <dc:date>2013-04-30T14:58:26Z</dc:date>
    </item>
    <item>
      <title>Re: Adding points to graphicsLayer using feature's coordinates stored in attributes</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/adding-points-to-graphicslayer-using-feature-s/m-p/653692#M60908</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I figured out part of my problem. I did not capitalize my attribute so that it matches the field name - CentroidLongitude vs centroidLongitude. Now I can at least see the value in console.log.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Still can't figure out how to add graphic markers to a graphicsLayer using this information.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Apr 2013 18:11:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/adding-points-to-graphicslayer-using-feature-s/m-p/653692#M60908</guid>
      <dc:creator>MikeOnzay</dc:creator>
      <dc:date>2013-04-30T18:11:38Z</dc:date>
    </item>
    <item>
      <title>Re: Adding points to graphicsLayer using feature's coordinates stored in attributes</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/adding-points-to-graphicslayer-using-feature-s/m-p/653693#M60909</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Finally figured it out. I needed to add &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;esri.geometry.geographicToWebMercator(new esri.geometry.Point&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;SPAN&gt; to this line &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;var pt = new esri.geometry.Point(ptX,ptY,map.spatialReference);&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;SPAN&gt; to make&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;var pt = new esri.geometry.Point(esri.geometry.geographicToWebMercator(new esri.geometry.Point(ptX,ptY,map.spatialReference)));&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and it worked.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I still don't quite understand why I had to do this but I will leave that to a discussion post.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 May 2013 13:50:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/adding-points-to-graphicslayer-using-feature-s/m-p/653693#M60909</guid>
      <dc:creator>MikeOnzay</dc:creator>
      <dc:date>2013-05-01T13:50:54Z</dc:date>
    </item>
  </channel>
</rss>

