<?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: Using arcade to rank polygons in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/using-arcade-to-rank-polygons/m-p/1259978#M65749</link>
    <description>&lt;P&gt;I know absolutely nothing about SQL lol but I gave it a try and searched the internet about it a bit. I came up with only this from the esri website:&lt;/P&gt;&lt;P&gt;OrderBy($layer, 'Rank ASC')&lt;/P&gt;&lt;P&gt;However, it doesn't return anything, because I think it doesn't know what to rank? How do I tell it to rank a specific expression or field?&lt;/P&gt;</description>
    <pubDate>Tue, 21 Feb 2023 05:25:24 GMT</pubDate>
    <dc:creator>junocs</dc:creator>
    <dc:date>2023-02-21T05:25:24Z</dc:date>
    <item>
      <title>Using arcade to rank polygons</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/using-arcade-to-rank-polygons/m-p/1259876#M65728</link>
      <description>&lt;P&gt;I have a layer of national parks polygons with differing numbers of train stations near each one. I'm trying to rank them in my pop-ups according to which is the most accessible (Count of Points / Shape_Area), but I don't know the correct functions in arcade. Could someone please advise me on how to proceed?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(picture for context)&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Using arcade to rank polygons.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/63253iF449F9121C198ACF/image-size/large?v=v2&amp;amp;px=999" role="button" title="Using arcade to rank polygons.png" alt="Using arcade to rank polygons.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Feb 2023 17:19:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/using-arcade-to-rank-polygons/m-p/1259876#M65728</guid>
      <dc:creator>junocs</dc:creator>
      <dc:date>2023-02-20T17:19:00Z</dc:date>
    </item>
    <item>
      <title>Re: Using arcade to rank polygons</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/using-arcade-to-rank-polygons/m-p/1259894#M65737</link>
      <description>&lt;P&gt;maybe orderby&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/arcade/function-reference/featureset_functions/#orderbyfeatures-sqlexpression---featureset" target="_self"&gt;order by in Arcade expressions&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Feb 2023 18:02:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/using-arcade-to-rank-polygons/m-p/1259894#M65737</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2023-02-20T18:02:34Z</dc:date>
    </item>
    <item>
      <title>Re: Using arcade to rank polygons</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/using-arcade-to-rank-polygons/m-p/1259978#M65749</link>
      <description>&lt;P&gt;I know absolutely nothing about SQL lol but I gave it a try and searched the internet about it a bit. I came up with only this from the esri website:&lt;/P&gt;&lt;P&gt;OrderBy($layer, 'Rank ASC')&lt;/P&gt;&lt;P&gt;However, it doesn't return anything, because I think it doesn't know what to rank? How do I tell it to rank a specific expression or field?&lt;/P&gt;</description>
      <pubDate>Tue, 21 Feb 2023 05:25:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/using-arcade-to-rank-polygons/m-p/1259978#M65749</guid>
      <dc:creator>junocs</dc:creator>
      <dc:date>2023-02-21T05:25:24Z</dc:date>
    </item>
    <item>
      <title>Re: Using arcade to rank polygons</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/using-arcade-to-rank-polygons/m-p/1259989#M65750</link>
      <description>&lt;LI-CODE lang="javascript"&gt;// order the layer
var ordered = OrderBy($layer, "(PointCount/Shape_Area) DESC")

var rank = 0
// iterate over the ordered layer
for(var f in ordered) {
    // increase the rank
    rank++
    // if the feature we're looking at is the feature we clicked on, return the current rank
    if(f.OBJECTID == $feature.OBJECTID) {
        return rank
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you use this expression in the popup, it will recalculate the rank each time you click on a feature. This is good for dynamic data, but it will slow down the popup somewhat.&lt;/P&gt;&lt;P&gt;If you have static data (train stations and national parks sound pretty static), it might be better to use the expression to calculate a new field and show that in the popup.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Feb 2023 07:39:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/using-arcade-to-rank-polygons/m-p/1259989#M65750</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2023-02-21T07:39:54Z</dc:date>
    </item>
    <item>
      <title>Re: Using arcade to rank polygons</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/using-arcade-to-rank-polygons/m-p/1260146#M65772</link>
      <description>&lt;P&gt;Thank you so much! This code has helped me a lot, but I've run into one problem while using it. I've tried OBJECTID and almost every field (alias and name) that my layer has that could match, but I keep getting the error message that the field is not found.&lt;/P&gt;&lt;P&gt;It's this line:&lt;/P&gt;&lt;P&gt;if(f.OBJECTID == $feature.OBJECTID)&lt;/P&gt;&lt;P&gt;I've found that I can double click the field for the $feature.OBJECTID part and the code fills in with my field, but the f. part just won't work. How do I fix this?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Error message.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/63318iB072F65E091AC29E/image-size/large?v=v2&amp;amp;px=999" role="button" title="Error message.png" alt="Error message.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;btw layer information is from here: &lt;A href="https://naturalengland-defra.opendata.arcgis.com/datasets/national-parks-england/explore?location=52.137785%2C-1.007237%2C5.78" target="_blank" rel="noopener"&gt;https://naturalengland-defra.opendata.arcgis.com/datasets/national-parks-england/explore?location=52.137785%2C-1.007237%2C5.78&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I've joined mine with another layer so it's not exactly the same&lt;/P&gt;</description>
      <pubDate>Tue, 21 Feb 2023 17:55:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/using-arcade-to-rank-polygons/m-p/1260146#M65772</guid>
      <dc:creator>junocs</dc:creator>
      <dc:date>2023-02-21T17:55:41Z</dc:date>
    </item>
    <item>
      <title>Re: Using arcade to rank polygons</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/using-arcade-to-rank-polygons/m-p/1260175#M65776</link>
      <description>&lt;P&gt;Ah, joins.&lt;/P&gt;&lt;P&gt;When you add a join to a table, the full name of the field is used: &lt;STRONG&gt;Tablename.Fieldname &lt;/STRONG&gt;(you can see that in your screenshot, too).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Clean solution: Instead of adding a join, use &lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/join-field.htm" target="_blank" rel="noopener"&gt;Join Field&lt;/A&gt; to permanently join the point count field to the polygons. This will change the polygon feature class, so it might not be possible for you.&lt;/P&gt;&lt;P&gt;Messy solution: use the full field names.&lt;/P&gt;&lt;P&gt;I downloaded the polygons and replicated your workflow: run the Summarize Nearby tool on the polygons and a point fc, join the output to the National Parks.&lt;/P&gt;&lt;P&gt;My feature class names are "National_Parks__England____Natural_England" for the original polygons and "parks_near" for the parks with summarized points.&lt;/P&gt;&lt;P&gt;This expression works for me:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// order the layer
var ordered = OrderBy($layer, "(parks_near.Point_Count / National_Parks__England____Natural_England.Shape_Area) DESC")

var rank = 0
// iterate over the ordered layer
for(var f in ordered) {
    // increase the rank
    rank++
    // if the feature we're looking at is the feature we clicked on, return the current rank
    if(f['National_Parks__England____Natural_England.OBJECTID'] == $feature['National_Parks__England____Natural_England.OBJECTID']) {
        return rank
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Feb 2023 18:32:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/using-arcade-to-rank-polygons/m-p/1260175#M65776</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2023-02-21T18:32:36Z</dc:date>
    </item>
    <item>
      <title>Re: Using arcade to rank polygons</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/using-arcade-to-rank-polygons/m-p/1260335#M65795</link>
      <description>&lt;P&gt;Oh, I had no idea that join field was so different. I tried it the clean way and it worked! Thanks so much for your help&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2023 03:01:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/using-arcade-to-rank-polygons/m-p/1260335#M65795</guid>
      <dc:creator>junocs</dc:creator>
      <dc:date>2023-02-22T03:01:57Z</dc:date>
    </item>
  </channel>
</rss>

