<?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: How do I style a feature layer by object field? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-style-a-feature-layer-by-object-field/m-p/1297922#M81340</link>
    <description>&lt;P&gt;Hi &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/692319"&gt;@נוהאליה&lt;/a&gt; ,&lt;/P&gt;&lt;P&gt;I had a look a the JS Docs and I don't think there's a clear implementation currently available.&lt;/P&gt;&lt;P&gt;However, there may be some solutions to try out.&lt;/P&gt;&lt;P&gt;My first suggestion is to attempt to use an &lt;A href="https://developers.arcgis.com/javascript/latest/arcade/" target="_self"&gt;Arcade Expression&lt;/A&gt; as part of your &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-UniqueValueRenderer.html#valueExpression" target="_self"&gt;Unique Value Renderer&lt;/A&gt; to retrieve the $feature.extras.PHP_2021 value, e.g:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;let renderer = {
 ...
 valueExpression: "When($feature.extras.PHP_2021, True)"
 ...
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The second option is not very enticing. You could try flattening the extras and bringing the extras properties up one level into the properties array. Then, you can apply a renderer by each PHP_* field name.&lt;/P&gt;&lt;P&gt;Good luck!&lt;/P&gt;</description>
    <pubDate>Mon, 12 Jun 2023 05:29:29 GMT</pubDate>
    <dc:creator>LongDinh</dc:creator>
    <dc:date>2023-06-12T05:29:29Z</dc:date>
    <item>
      <title>How do I style a feature layer by object field?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-style-a-feature-layer-by-object-field/m-p/1297879#M81337</link>
      <description>&lt;P&gt;Hey , I have a geojson that in the attributes section for each feature I have an object that's called 'extras',&amp;nbsp;like so (example geojson):&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;{
	"geometry": {
		"type": "Polygon",
		"coordinates": [
			[
				
				[
					00.76486274700005,
					00.903816257000075
				]
			],
			[
				[
					00.79834464800007,
					00.89163211700003
				],
			]
		]
	},
	"properties": {
		"objectid": 187,
		"extras": {
			"PHP_2021": "false",
			"PHP_2018": "true",
			"PHP_2019": "true",
			"PHP_2020": "true",
			"PHP_2022": "true"
		}
	},
	"type": "Feature",
	"id": 187
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also have this styling:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const renderer = {
            "type": "unique-value",
            "field": "extras.PHP_2021",
            "defaultSymbol": defaultSymbol.symbol,

            "uniqueValueInfos": [{
              "value": "true",
              "symbol": {
                "type": "picture-marker",
                "url": "../../assets/images/clicked-point.png",
                "width": "34px",
                "height": "38px"
              }
            }],
          };&lt;/LI-CODE&gt;&lt;P&gt;That does not work because it can't read 'extras' as object.&lt;/P&gt;&lt;P&gt;Is there a way that I can use object (in this example 'extras' object) in order to render a feature layer?&lt;/P&gt;&lt;P&gt;thanks.&lt;/P&gt;</description>
      <pubDate>Sun, 11 Jun 2023 14:23:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-style-a-feature-layer-by-object-field/m-p/1297879#M81337</guid>
      <dc:creator>נוהאליה</dc:creator>
      <dc:date>2023-06-11T14:23:57Z</dc:date>
    </item>
    <item>
      <title>Re: How do I style a feature layer by object field?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-style-a-feature-layer-by-object-field/m-p/1297922#M81340</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/692319"&gt;@נוהאליה&lt;/a&gt; ,&lt;/P&gt;&lt;P&gt;I had a look a the JS Docs and I don't think there's a clear implementation currently available.&lt;/P&gt;&lt;P&gt;However, there may be some solutions to try out.&lt;/P&gt;&lt;P&gt;My first suggestion is to attempt to use an &lt;A href="https://developers.arcgis.com/javascript/latest/arcade/" target="_self"&gt;Arcade Expression&lt;/A&gt; as part of your &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-UniqueValueRenderer.html#valueExpression" target="_self"&gt;Unique Value Renderer&lt;/A&gt; to retrieve the $feature.extras.PHP_2021 value, e.g:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;let renderer = {
 ...
 valueExpression: "When($feature.extras.PHP_2021, True)"
 ...
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The second option is not very enticing. You could try flattening the extras and bringing the extras properties up one level into the properties array. Then, you can apply a renderer by each PHP_* field name.&lt;/P&gt;&lt;P&gt;Good luck!&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jun 2023 05:29:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-style-a-feature-layer-by-object-field/m-p/1297922#M81340</guid>
      <dc:creator>LongDinh</dc:creator>
      <dc:date>2023-06-12T05:29:29Z</dc:date>
    </item>
    <item>
      <title>Re: How do I style a feature layer by object field?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-style-a-feature-layer-by-object-field/m-p/1297942#M81341</link>
      <description>&lt;P&gt;Hey, first of all thanks for trying to help me, second I guess I should have say that my first attempt was actually&amp;nbsp; arcade expression exactly how you wrote it but it didn't work because by the docs its says that the attribute can only be string or number not even Boolean&amp;nbsp; and not an object as well:&lt;/P&gt;&lt;P&gt;"&lt;SPAN&gt;&amp;nbsp;Expressions in UniqueValueRenderer may reference field values using the&amp;nbsp;&lt;/SPAN&gt;$feature&lt;SPAN&gt;&amp;nbsp;profile variable and must return a string or a number"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I also thought about &lt;SPAN&gt;flattening&amp;nbsp;&lt;/SPAN&gt;the properties one level up, but because the 'extras' is auto generated and it happening in C# it is very hard to do at least for my skills, because I have no idea how I declare auto generated properties in C# and I can't use dictionary for all the attributes because I need to use some of them, I guess I could use each place that I want to use the other attributes 'Try and Catch' but that is not the way I would like to do it.&lt;/P&gt;&lt;P&gt;thanks anyway though (:&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jun 2023 08:49:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-style-a-feature-layer-by-object-field/m-p/1297942#M81341</guid>
      <dc:creator>נוהאליה</dc:creator>
      <dc:date>2023-06-12T08:49:27Z</dc:date>
    </item>
    <item>
      <title>Re: How do I style a feature layer by object field?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-style-a-feature-layer-by-object-field/m-p/1298106#M81344</link>
      <description>&lt;P&gt;Arbitrary object properties are not supported in GeoJSONLayer, listed under known limitations.&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-GeoJSONLayer.html" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-GeoJSONLayer.html&lt;/A&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Using Object as attribute value for GeoJSON features is not supported.&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Mon, 12 Jun 2023 15:03:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-style-a-feature-layer-by-object-field/m-p/1298106#M81344</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2023-06-12T15:03:10Z</dc:date>
    </item>
    <item>
      <title>Re: How do I style a feature layer by object field?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-style-a-feature-layer-by-object-field/m-p/1298242#M81349</link>
      <description>&lt;P&gt;The flattening option mentioned by&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/180019"&gt;@LongDinh&lt;/a&gt;&amp;nbsp;is most likely the way to go.&amp;nbsp; Perhaps you're not able to alter things on the server side, but you can on the client-side.&amp;nbsp; Check out &lt;A href="https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/geojson-layer-property-is-an-object/m-p/1249175" target="_self"&gt;this thread&lt;/A&gt;, and in particular, the second solution. Although the initial problem is somewhat different (i.e. popup content instead of rendering), the solution will still likely be along the same lines...i.e. using a &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-config.html#RequestInterceptor" target="_self"&gt;RequestInterceptor&lt;/A&gt; and flattening the attributes so that your renderer can access them.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jun 2023 18:31:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-style-a-feature-layer-by-object-field/m-p/1298242#M81349</guid>
      <dc:creator>JoelBennett</dc:creator>
      <dc:date>2023-06-12T18:31:53Z</dc:date>
    </item>
    <item>
      <title>Re: How do I style a feature layer by object field?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-style-a-feature-layer-by-object-field/m-p/1298393#M81353</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/6522"&gt;@JoelBennett&lt;/a&gt;, that RequestInterceptor is pretty cool! Like an SOI but for client-side. Thanks for sharing &lt;span class="lia-unicode-emoji" title=":grinning_face_with_big_eyes:"&gt;😃&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jun 2023 00:15:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-style-a-feature-layer-by-object-field/m-p/1298393#M81353</guid>
      <dc:creator>LongDinh</dc:creator>
      <dc:date>2023-06-13T00:15:41Z</dc:date>
    </item>
  </channel>
</rss>

