<?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 Getting Attributes from feature layer into a Variable? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/getting-attributes-from-feature-layer-into-a/m-p/310110#M28514</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have a JSON which comprises of lat long coordinates,&amp;nbsp; hash id values, file name etc etc. I created a feature layer from this json via&amp;nbsp;&amp;nbsp; feature collection &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;{ LayerDef: {}, FeatureSet:};&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I display this feature layer as a set of points on the map &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;var pointdata = new esri.layers.FeatureLayer(featureCollection, {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; mode: esri.layers.FeatureLayer.MODE_ONDEMAND});&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What I want to do is, when I click one of these points I want to be able to grab the hash_id from the attributes and dump it into a js var for further processing, Sounds simple but I have been racking my brain on this for some time. Any input at all would be really appreciated! If you need any further info to help me solve this problem just let me know.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 19 Sep 2013 11:37:09 GMT</pubDate>
    <dc:creator>DamienButler1</dc:creator>
    <dc:date>2013-09-19T11:37:09Z</dc:date>
    <item>
      <title>Getting Attributes from feature layer into a Variable?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/getting-attributes-from-feature-layer-into-a/m-p/310110#M28514</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have a JSON which comprises of lat long coordinates,&amp;nbsp; hash id values, file name etc etc. I created a feature layer from this json via&amp;nbsp;&amp;nbsp; feature collection &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;{ LayerDef: {}, FeatureSet:};&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I display this feature layer as a set of points on the map &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;var pointdata = new esri.layers.FeatureLayer(featureCollection, {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; mode: esri.layers.FeatureLayer.MODE_ONDEMAND});&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What I want to do is, when I click one of these points I want to be able to grab the hash_id from the attributes and dump it into a js var for further processing, Sounds simple but I have been racking my brain on this for some time. Any input at all would be really appreciated! If you need any further info to help me solve this problem just let me know.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Sep 2013 11:37:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/getting-attributes-from-feature-layer-into-a/m-p/310110#M28514</guid>
      <dc:creator>DamienButler1</dc:creator>
      <dc:date>2013-09-19T11:37:09Z</dc:date>
    </item>
    <item>
      <title>Re: Getting Attributes from feature layer into a Variable?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/getting-attributes-from-feature-layer-into-a/m-p/310111#M28515</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If the feature layer, pointdata, is created correctly, the below code sample should meet your need.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;pointdata.on("click", function(evt) {
&amp;nbsp;&amp;nbsp;&amp;nbsp; var hashId = evt.graphic.attributes["hash_id"];
});&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In addition, based on the ESRI API description, the structure of the feature collection should be&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;{ layerDefinition: {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; geometryType": "esriGeometryPoint",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; objectIdField": "ObjectID",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; drawingInfo": {
&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;&amp;nbsp; "fields": [{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "name": "ObjectID",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "alias": "ObjectID",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "type": "esriFieldTypeOID"
&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; featureSet: {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; features: [],
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; geometryType: "esriGeometryPoint"
&amp;nbsp;&amp;nbsp; }
};&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is a &lt;/SPAN&gt;&lt;A href="https://developers.arcgis.com/en/javascript/jssamples/fl_featureCollection.html" rel="nofollow noopener noreferrer" target="_blank"&gt;sample &lt;/A&gt;&lt;SPAN&gt;of creating a feature layer from a feature collection.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:50:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/getting-attributes-from-feature-layer-into-a/m-p/310111#M28515</guid>
      <dc:creator>JasonZou</dc:creator>
      <dc:date>2021-12-11T14:50:11Z</dc:date>
    </item>
  </channel>
</rss>

