<?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: Creating Logic rules with Attribute Rules in Pro in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/creating-logic-rules-with-attribute-rules-in-pro/m-p/1251944#M64664</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;P&gt;for the point fc shall I use Length or Area on line 9?&lt;/P&gt;&lt;P&gt;What about points that are on the boundary of the polygon - technically they are on the boundary of 2 polygons?&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Hmmm. If your ElectoralDivisions do not overlap each other, then a point will only be on one polygon, except when it is on the boundary, as you said.&lt;/P&gt;&lt;P&gt;So either use your original code (take the first intersecting polygon) or create a small buffer around the point and use Area(). Note that we intersect the buffer, not the $feature:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// load the other featureset
var fs = FeatureSetByName($datastore, "Highways.HIGHWAYMGR.ElectoralDivisions")
// get all features from fs that intersect the current $feature
var f_buffer = Buffer($feature, 1 "meters")
var i_fs = Intersects(fs, f_buffer)
// find the ElectDiv of the feature with the greatest intersection with $feature
var greatest = 0
var name = null
for(var i_f in i_fs) {
    var current = Area(Intersection(f_buffer, i_f))
    if(current &amp;lt;= greatest) { continue }
    greatest = current
    name = i_f.Name
}
return name&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But this will probably still return the same result as First(i_fs). You could also sort the intersecting polygons by some column and the return the First(). For example, if you have a field ElectoralDivisions.Population and you want to return the name of the polygon with the highest population when the point is on the border of 2 polygons:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// load the other featureset
var fs = FeatureSetByName($datastore, "Highways.HIGHWAYMGR.ElectoralDivisions")
// get all features from fs that intersect the current $feature
var i_fs = Intersects(fs, $feature)
// sort the intersecting features by population, descending
var sorted = OrderBy(i_fs, "Population DESC")
// return the name of the intersecting feature with the highest population
var greatest_pop = First(sorted)
if(greatest_pop == null) { return null }
return greatest_pop.Name&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;I've updated the field ElectDiv to the name field. Are the changes below ok?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;Yeah, looks good&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 26 Jan 2023 17:03:27 GMT</pubDate>
    <dc:creator>JohannesLindner</dc:creator>
    <dc:date>2023-01-26T17:03:27Z</dc:date>
    <item>
      <title>Creating Logic rules with Attribute Rules in Pro</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/creating-logic-rules-with-attribute-rules-in-pro/m-p/1250696#M64544</link>
      <description>&lt;P&gt;I have the code below which runs a spatial query against an overlaying polygon fc which gains values that are then saved into the new fc. This works fine when the feature is exactly within that fc however when working with lines &amp;amp; poly's quite often these new features go over the overlaying polygon overlay. What are the default rules of logic for the lookup below to use. I need code or be able to modify this so that the line/poly has the majority of it's area in one poly the intersect takes the majority rather than the minority area. Is that possible?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;// load the other featureset
var fs = FeatureSetByName($datastore, "Highways.HIGHWAYMGR.ElectoralDivisions")
// get the first feature from fs that intersects the current $feature
var f = First(Intersects(fs, $feature))
// abort if we didn't find something
if(f == null) { return }
// return the intersecting feature's value
return f.ElectDiv&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jan 2023 09:50:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/creating-logic-rules-with-attribute-rules-in-pro/m-p/1250696#M64544</guid>
      <dc:creator>AndrewReynoldsDevon</dc:creator>
      <dc:date>2023-01-24T09:50:31Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Logic rules with Attribute Rules in Pro</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/creating-logic-rules-with-attribute-rules-in-pro/m-p/1250706#M64545</link>
      <description>&lt;P&gt;It's possible, just a little more complicated.&lt;/P&gt;&lt;P&gt;Instead of getting the First() intersecting feature, you need to get all of them, and then get the one with the greatest intersection length / area.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// load the other featureset
var fs = FeatureSetByName($datastore, "Highways.HIGHWAYMGR.ElectoralDivisions")
// get all features from fs that intersect the current $feature
var i_fs = Intersects(fs, $feature)
// find the ElectDiv of the feature with the greatest intersection with $feature
var greatest = 0
var electdiv = null
for(var i_f in i_fs) {
    var current = Length(Intersection($feature, i_f))
    if(current &amp;lt;= greatest) { continue }
    greatest = current
    electdiv = i_f.ElectDiv
}
return electdiv&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If both featuresets ($featureset and fs) are polygon fcs, you should use Area() instead of Length() in line 9.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jan 2023 10:44:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/creating-logic-rules-with-attribute-rules-in-pro/m-p/1250706#M64545</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2023-01-24T10:44:05Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Logic rules with Attribute Rules in Pro</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/creating-logic-rules-with-attribute-rules-in-pro/m-p/1251828#M64640</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/294341"&gt;@JohannesLindner&lt;/a&gt;&amp;nbsp; for the point fc shall I use Length or Area on line 9?&lt;/P&gt;&lt;P&gt;What about points that are on the boundary of the polygon - technically they are on the boundary of 2 polygons?&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jan 2023 15:04:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/creating-logic-rules-with-attribute-rules-in-pro/m-p/1251828#M64640</guid>
      <dc:creator>AndrewReynoldsDevon</dc:creator>
      <dc:date>2023-01-26T15:04:48Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Logic rules with Attribute Rules in Pro</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/creating-logic-rules-with-attribute-rules-in-pro/m-p/1251835#M64641</link>
      <description>&lt;P&gt;For the next 2 fields that use the lookup is the code going to be something like this.&lt;/P&gt;&lt;P&gt;I've updated the field ElectDiv to the name field. Are the changes below ok?&lt;/P&gt;&lt;LI-CODE lang="c"&gt;// load the other featureset
var fs = FeatureSetByName($datastore, "Highways.HIGHWAYMGR.ElectoralDivisions")
// get all features from fs that intersect the current $feature
var i_fs = Intersects(fs, $feature)
// find the ElectDiv of the feature with the greatest intersection with $feature
var greatest = 0
var name = null
for(var i_f in i_fs) {
    var current = Length(Intersection($feature, i_f))
    if(current &amp;lt;= greatest) { continue }
    greatest = current
    name = i_f.Name
}
return name&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jan 2023 13:29:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/creating-logic-rules-with-attribute-rules-in-pro/m-p/1251835#M64641</guid>
      <dc:creator>AndrewReynoldsDevon</dc:creator>
      <dc:date>2023-01-26T13:29:41Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Logic rules with Attribute Rules in Pro</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/creating-logic-rules-with-attribute-rules-in-pro/m-p/1251944#M64664</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;P&gt;for the point fc shall I use Length or Area on line 9?&lt;/P&gt;&lt;P&gt;What about points that are on the boundary of the polygon - technically they are on the boundary of 2 polygons?&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Hmmm. If your ElectoralDivisions do not overlap each other, then a point will only be on one polygon, except when it is on the boundary, as you said.&lt;/P&gt;&lt;P&gt;So either use your original code (take the first intersecting polygon) or create a small buffer around the point and use Area(). Note that we intersect the buffer, not the $feature:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// load the other featureset
var fs = FeatureSetByName($datastore, "Highways.HIGHWAYMGR.ElectoralDivisions")
// get all features from fs that intersect the current $feature
var f_buffer = Buffer($feature, 1 "meters")
var i_fs = Intersects(fs, f_buffer)
// find the ElectDiv of the feature with the greatest intersection with $feature
var greatest = 0
var name = null
for(var i_f in i_fs) {
    var current = Area(Intersection(f_buffer, i_f))
    if(current &amp;lt;= greatest) { continue }
    greatest = current
    name = i_f.Name
}
return name&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But this will probably still return the same result as First(i_fs). You could also sort the intersecting polygons by some column and the return the First(). For example, if you have a field ElectoralDivisions.Population and you want to return the name of the polygon with the highest population when the point is on the border of 2 polygons:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// load the other featureset
var fs = FeatureSetByName($datastore, "Highways.HIGHWAYMGR.ElectoralDivisions")
// get all features from fs that intersect the current $feature
var i_fs = Intersects(fs, $feature)
// sort the intersecting features by population, descending
var sorted = OrderBy(i_fs, "Population DESC")
// return the name of the intersecting feature with the highest population
var greatest_pop = First(sorted)
if(greatest_pop == null) { return null }
return greatest_pop.Name&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;I've updated the field ElectDiv to the name field. Are the changes below ok?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;Yeah, looks good&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jan 2023 17:03:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/creating-logic-rules-with-attribute-rules-in-pro/m-p/1251944#M64664</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2023-01-26T17:03:27Z</dc:date>
    </item>
  </channel>
</rss>

