<?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: Get value of an attribute from GraphicsLayer in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-value-of-an-attribute-from-graphicslayer/m-p/1054227#M72875</link>
    <description>&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#hitTest" target="_self"&gt;hitTest()&lt;/A&gt; will return features from an intersecting GraphicsLayer, from which you can &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html#getAttribute" target="_self"&gt;getAttribute()&lt;/A&gt;&amp;nbsp;or browse with the &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html#attributes" target="_self"&gt;attributes&lt;/A&gt; property.&lt;/P&gt;&lt;P&gt;Here are some &lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/?tagged=hitTest" target="_self"&gt;hitTest() samples&lt;/A&gt; to check out.&lt;/P&gt;</description>
    <pubDate>Tue, 04 May 2021 14:55:47 GMT</pubDate>
    <dc:creator>BlakeTerhune</dc:creator>
    <dc:date>2021-05-04T14:55:47Z</dc:date>
    <item>
      <title>Get value of an attribute from GraphicsLayer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-value-of-an-attribute-from-graphicslayer/m-p/1054218#M72874</link>
      <description>&lt;P&gt;I am adding a GraphicsLayer with markers on the map and need to know which marker was clicked. How do I get a value of an attribute when I click on the marker? Thank you&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const Layer1 = new GraphicsLayer({id: 'Layer1ID'});
map.add(Layer1);
const point = {
type: "point",
longitude: -80,
latitude: 25
};
const attributes = { "MarkerType": "Type1" }
const pointGraphic = new Graphic({
geometry: point,
symbol: simpleMarkerSymbol,
attributes: attributes
});
Layer1.add(pointGraphic);

view.on(""click"", e =&amp;gt; {
alert(need to access the above attribute MarkerType);
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 May 2021 14:37:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-value-of-an-attribute-from-graphicslayer/m-p/1054218#M72874</guid>
      <dc:creator>iepshteyn</dc:creator>
      <dc:date>2021-05-04T14:37:34Z</dc:date>
    </item>
    <item>
      <title>Re: Get value of an attribute from GraphicsLayer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-value-of-an-attribute-from-graphicslayer/m-p/1054227#M72875</link>
      <description>&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#hitTest" target="_self"&gt;hitTest()&lt;/A&gt; will return features from an intersecting GraphicsLayer, from which you can &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html#getAttribute" target="_self"&gt;getAttribute()&lt;/A&gt;&amp;nbsp;or browse with the &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html#attributes" target="_self"&gt;attributes&lt;/A&gt; property.&lt;/P&gt;&lt;P&gt;Here are some &lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/?tagged=hitTest" target="_self"&gt;hitTest() samples&lt;/A&gt; to check out.&lt;/P&gt;</description>
      <pubDate>Tue, 04 May 2021 14:55:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-value-of-an-attribute-from-graphicslayer/m-p/1054227#M72875</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2021-05-04T14:55:47Z</dc:date>
    </item>
    <item>
      <title>Re: Get value of an attribute from GraphicsLayer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-value-of-an-attribute-from-graphicslayer/m-p/1054232#M72876</link>
      <description>&lt;P&gt;You can use this code to get your Markertype&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;view.on('click',(event) =&amp;gt;{
  view.hitTest(event)
    .then((response) =&amp;gt;{
      console.log(response.results[0].graphic.attributes.MarkerType); //or attributes['MarkerType'];
    });
});&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 04 May 2021 15:11:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-value-of-an-attribute-from-graphicslayer/m-p/1054232#M72876</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2021-05-04T15:11:23Z</dc:date>
    </item>
    <item>
      <title>Re: Get value of an attribute from GraphicsLayer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-value-of-an-attribute-from-graphicslayer/m-p/1054237#M72878</link>
      <description>&lt;P&gt;Thank you Ken.&lt;/P&gt;</description>
      <pubDate>Tue, 04 May 2021 15:20:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-value-of-an-attribute-from-graphicslayer/m-p/1054237#M72878</guid>
      <dc:creator>iepshteyn</dc:creator>
      <dc:date>2021-05-04T15:20:12Z</dc:date>
    </item>
  </channel>
</rss>

