<?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: Arcade - Look for a matching value by iterating through overlapping polygons in a reference layer in ArcGIS Field Maps Questions</title>
    <link>https://community.esri.com/t5/arcgis-field-maps-questions/arcade-look-for-a-matching-value-by-iterating/m-p/1482163#M8767</link>
    <description>&lt;P&gt;Perfect!&amp;nbsp; That's exactly what I was trying to do...and I was half-way there, just didn't know it.&amp;nbsp; So, I presume that this would execute in Field Maps only:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;When a new spatial feature is created, or is subsequently updated and/or&lt;/LI&gt;&lt;LI&gt;When the new feature's plant code is specified, or is subsequently changed&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
    <pubDate>Fri, 31 May 2024 17:28:21 GMT</pubDate>
    <dc:creator>CarlBeyerhelm</dc:creator>
    <dc:date>2024-05-31T17:28:21Z</dc:date>
    <item>
      <title>Arcade - Look for a matching value by iterating through overlapping polygons in a reference layer</title>
      <link>https://community.esri.com/t5/arcgis-field-maps-questions/arcade-look-for-a-matching-value-by-iterating/m-p/1482087#M8764</link>
      <description>&lt;P&gt;I’m trying to develop an Arcade expression that determines if a newly created plant occurrence feature intersects, or is near, a known plant occurrence of the same species in an underlying reference layer…keeping in mind that there could be multiple overlapping polygons in that reference layer of many different plant species.&lt;/P&gt;&lt;P&gt;I’ve found many examples to pull an attribute from an underlying layer, but haven't come across any that drill down through a reference layer’s multiple overlapping polygons to see if any of those have a matching plant code.&amp;nbsp; Essentially, I don't know how to iterate through a series of polygons in search of a match.&lt;/P&gt;&lt;P&gt;See the attached image for an example of those multiple overlapping plant polygons in a reference layer.&lt;/P&gt;&lt;P&gt;Any references or examples would be appreciated.&amp;nbsp; Thank you.&lt;/P&gt;</description>
      <pubDate>Fri, 31 May 2024 14:59:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-field-maps-questions/arcade-look-for-a-matching-value-by-iterating/m-p/1482087#M8764</guid>
      <dc:creator>CarlBeyerhelm</dc:creator>
      <dc:date>2024-05-31T14:59:29Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade - Look for a matching value by iterating through overlapping polygons in a reference layer</title>
      <link>https://community.esri.com/t5/arcgis-field-maps-questions/arcade-look-for-a-matching-value-by-iterating/m-p/1482097#M8765</link>
      <description>&lt;P&gt;It's not terribly difficult, and if you already know how to grab underlying layer attributes, you're halfway there. When we call &lt;STRONG&gt;Intersects&lt;/STRONG&gt;, the result is a set of features we can loop through and look for your code. Here's how it might look:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var fs = FeatureSetByName($map, 'species_zones', ['plant_code_field'], true)

// get underlying areas
var xs = Intersects(fs, $feature)

// loop through
for (var x in xs) {
  // check if plant code matches our feature
  if (x['plant_code_field'] == $feature['plant_code_field']) {
    return 'Match!'
  }
}

// fallback if no matches
return 'No Matches!'&lt;/LI-CODE&gt;&lt;P&gt;Some of this depends on what you want to &lt;EM&gt;do &lt;/EM&gt;with the information, of course. Maybe you want to access a specific attribute of the matching zone? Maybe you want to count how many matching zones intersect?&lt;/P&gt;&lt;P&gt;Since the first &lt;STRONG&gt;return&lt;/STRONG&gt; line is inside of the conditional block, it will end the expression as &lt;EM&gt;soon &lt;/EM&gt;as it encounters a match, and won't get to the "no matches" result unless there truly are none.&lt;/P&gt;&lt;P&gt;Alternatively, you could do this without a loop. You &lt;EM&gt;could &lt;/EM&gt;just stick a &lt;STRONG&gt;Filter&lt;/STRONG&gt; on the intersection and see how many match that way. This has the benefit of being a bit faster in situations where there are lots of overlaps, but then you'd still need to use a loop or First to access actual attributes of the matching features.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var fs = FeatureSetByName($map, 'species_zones', ['plant_code_field'], true)

// get underlying areas
var xs = Intersects(fs, $feature)

// filter for code
var filt = Filter(xs, `plant_code_field = '${feature['plant_code_field']}'`)

// if any features are left in the filtered set, there was a match
return Iif(
  Count(filt) &amp;gt; 0,
  'Match!',
  'No Matches!'
)&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 31 May 2024 15:12:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-field-maps-questions/arcade-look-for-a-matching-value-by-iterating/m-p/1482097#M8765</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2024-05-31T15:12:51Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade - Look for a matching value by iterating through overlapping polygons in a reference layer</title>
      <link>https://community.esri.com/t5/arcgis-field-maps-questions/arcade-look-for-a-matching-value-by-iterating/m-p/1482163#M8767</link>
      <description>&lt;P&gt;Perfect!&amp;nbsp; That's exactly what I was trying to do...and I was half-way there, just didn't know it.&amp;nbsp; So, I presume that this would execute in Field Maps only:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;When a new spatial feature is created, or is subsequently updated and/or&lt;/LI&gt;&lt;LI&gt;When the new feature's plant code is specified, or is subsequently changed&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Fri, 31 May 2024 17:28:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-field-maps-questions/arcade-look-for-a-matching-value-by-iterating/m-p/1482163#M8767</guid>
      <dc:creator>CarlBeyerhelm</dc:creator>
      <dc:date>2024-05-31T17:28:21Z</dc:date>
    </item>
  </channel>
</rss>

