<?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 How to change Picture marker symbol on click dynamically in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-change-picture-marker-symbol-on-click/m-p/1180550#M77616</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I want to know how can I change the &lt;STRONG&gt;picture marker symbol after &lt;/STRONG&gt;on click dynamically. When the user click on the symbol it will change to a dark red symbol.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="NEERAJNASWA_0-1654594580562.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/42874iB029F9B77CDD825F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="NEERAJNASWA_0-1654594580562.png" alt="NEERAJNASWA_0-1654594580562.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 07 Jun 2022 09:37:25 GMT</pubDate>
    <dc:creator>NEERAJNASWA</dc:creator>
    <dc:date>2022-06-07T09:37:25Z</dc:date>
    <item>
      <title>How to change Picture marker symbol on click dynamically</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-change-picture-marker-symbol-on-click/m-p/1180550#M77616</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I want to know how can I change the &lt;STRONG&gt;picture marker symbol after &lt;/STRONG&gt;on click dynamically. When the user click on the symbol it will change to a dark red symbol.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="NEERAJNASWA_0-1654594580562.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/42874iB029F9B77CDD825F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="NEERAJNASWA_0-1654594580562.png" alt="NEERAJNASWA_0-1654594580562.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jun 2022 09:37:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-change-picture-marker-symbol-on-click/m-p/1180550#M77616</guid>
      <dc:creator>NEERAJNASWA</dc:creator>
      <dc:date>2022-06-07T09:37:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to change Picture marker symbol on click dynamically</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-change-picture-marker-symbol-on-click/m-p/1180575#M77620</link>
      <description>&lt;P&gt;You can replace the symbol with a new one, with a new url. graphic.symbol = newSymbol&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jun 2022 13:13:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-change-picture-marker-symbol-on-click/m-p/1180575#M77620</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2022-06-07T13:13:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to change Picture marker symbol on click dynamically</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-change-picture-marker-symbol-on-click/m-p/1180580#M77624</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;This is my code. Can you please help me in adding the new symbol/image on click of a location pin. I am new to this Arcgis Api.&lt;/P&gt;&lt;P&gt;let centroidRenderer = {&lt;BR /&gt;type: "simple",&lt;BR /&gt;symbol: {&lt;BR /&gt;type: "picture-marker",&lt;BR /&gt;// url: "&lt;A href="https://static.vecteezy.com/system/resources/previews/000/582/855/original/vector-location-pin-icon.jpg" target="_blank"&gt;https://static.vecteezy.com/system/resources/previews/000/582/855/original/vector-location-pin-icon.jpg&lt;/A&gt;",&lt;BR /&gt;url: "images/Location-map.png",&lt;BR /&gt;width: "26",&lt;BR /&gt;height: "26"&lt;BR /&gt;}&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;let locationpin = new FeatureLayer({&lt;BR /&gt;&lt;BR /&gt;url:&lt;BR /&gt;"&lt;A href="https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/Centroids/FeatureServer/0" target="_blank"&gt;https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/Centroids/FeatureServer/0&lt;/A&gt;",&lt;BR /&gt;&lt;BR /&gt;renderer: centroidRenderer&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;view&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;when&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;function&lt;/SPAN&gt;&lt;SPAN&gt;() {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;map&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;addMany&lt;/SPAN&gt;&lt;SPAN&gt;([&lt;/SPAN&gt;&lt;SPAN&gt;locationpin&lt;/SPAN&gt;&lt;SPAN&gt;]);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; });&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 07 Jun 2022 13:33:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-change-picture-marker-symbol-on-click/m-p/1180580#M77624</guid>
      <dc:creator>NEERAJNASWA</dc:creator>
      <dc:date>2022-06-07T13:33:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to change Picture marker symbol on click dynamically</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-change-picture-marker-symbol-on-click/m-p/1180609#M77626</link>
      <description>&lt;P&gt;The story is a little different when using a FeatureLayer, changing the symbol on click requires you to edit the attributes in some way to distinguish it from other features on the map.&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/visualization/data-driven-styles/unique-types/" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/javascript/latest/visualization/data-driven-styles/unique-types/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;You may not want that, since you can't or don't want to edit the data. Best option in that case is to create a new Graphic with the symbol you want, add it to a GraphicsLayer, and then use a filter via LayerView filter or Layer definitionExpression to hide the target feature.&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/query-filter/#layer-and-layerview" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/javascript/latest/query-filter/#layer-and-layerview&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jun 2022 14:27:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-change-picture-marker-symbol-on-click/m-p/1180609#M77626</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2022-06-07T14:27:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to change Picture marker symbol on click dynamically</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-change-picture-marker-symbol-on-click/m-p/1180919#M77637</link>
      <description>&lt;P&gt;Hi, I tried to use the click event for the images. That approach was also not working. I will share the code once that I tried to implement but it just highlights the symbol.It's not changing the image.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;let centroidRenderer = {&lt;BR /&gt;type: "simple",&lt;BR /&gt;symbol: {&lt;BR /&gt;type: "picture-marker",&lt;BR /&gt;// url: "&lt;A href="https://static.vecteezy.com/system/resources/previews/000/582/855/original/vector-location-pin-icon.jpg" target="_blank"&gt;https://static.vecteezy.com/system/resources/previews/000/582/855/original/vector-location-pin-icon.jpg&lt;/A&gt;",&lt;BR /&gt;url: "images/Location-map.png",&lt;BR /&gt;width: "26",&lt;BR /&gt;height: "26"&lt;BR /&gt;}&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;let locationpin = new FeatureLayer({&lt;BR /&gt;&lt;BR /&gt;url:&lt;BR /&gt;"&lt;A href="https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/Centroids/FeatureServer/0" target="_blank"&gt;https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/Centroids/FeatureServer/0&lt;/A&gt;",&lt;BR /&gt;&lt;BR /&gt;renderer: centroidRenderer&lt;BR /&gt;});&lt;BR /&gt;// var privateSchoolsPoly = new FeatureLayer({&lt;BR /&gt;// url:&lt;BR /&gt;// "&lt;A href="https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/PrivateSchoolEnrollmentNoRendering/FeatureServer/0" target="_blank"&gt;https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/PrivateSchoolEnrollmentNoRendering/FeatureServer/0&lt;/A&gt;",&lt;BR /&gt;// outFields: ["*"],&lt;BR /&gt;// opacity: 0.8,&lt;BR /&gt;// renderer: renderer,&lt;BR /&gt;&lt;BR /&gt;// });&lt;/P&gt;&lt;P&gt;let symbol;&lt;/P&gt;&lt;P&gt;view.when(async () =&amp;gt; {&lt;BR /&gt;const layerView = await view.whenLayerView(locationpin);&lt;BR /&gt;view.on('click', async (e) =&amp;gt; {&lt;BR /&gt;const {results} = await view.hitTest(e);&lt;BR /&gt;try {&lt;BR /&gt;const { graphic } = results.find(x =&amp;gt; x.graphic.attributes.OBJECTID);&lt;BR /&gt;if(symbol.url=="images/Location-map.png"){&lt;BR /&gt;(symbol.url==" &lt;A href="https://static.vecteezy.com/system/resources/previews/000/582/855/original/vector-location-pin-icon.jpg" target="_blank"&gt;https://static.vecteezy.com/system/resources/previews/000/582/855/original/vector-location-pin-icon.jpg&lt;/A&gt;")&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;else{&lt;BR /&gt;symbol.url==" images/Location-map.png"&lt;BR /&gt;}&lt;BR /&gt;// fWidget.graphic = graphic;&lt;BR /&gt;symbol = layerView.highlight(graphic);&lt;BR /&gt;} catch(err) {}&lt;BR /&gt;});&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;view.when(function() {&lt;BR /&gt;map.addMany([locationpin]);&lt;BR /&gt;});&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jun 2022 06:37:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-change-picture-marker-symbol-on-click/m-p/1180919#M77637</guid>
      <dc:creator>NEERAJNASWA</dc:creator>
      <dc:date>2022-06-08T06:37:56Z</dc:date>
    </item>
  </channel>
</rss>

