<?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 Label map with feature count in Mapping Questions</title>
    <link>https://community.esri.com/t5/mapping-questions/label-map-with-feature-count/m-p/338687#M3685</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a map that i need to label the total number of features(feature count) for each layer. I would like to be able to create a label expression but i can't seem to find out how to do this, the only thing that comes to mind is count[field] but that doesn't work. Similar to right clicking on a field, statistics - count but i want to able to label that layer with that count on a map on the fly. I would appreciate any help, thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 25 Nov 2019 16:23:06 GMT</pubDate>
    <dc:creator>CCWeedcontrol</dc:creator>
    <dc:date>2019-11-25T16:23:06Z</dc:date>
    <item>
      <title>Label map with feature count</title>
      <link>https://community.esri.com/t5/mapping-questions/label-map-with-feature-count/m-p/338687#M3685</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a map that i need to label the total number of features(feature count) for each layer. I would like to be able to create a label expression but i can't seem to find out how to do this, the only thing that comes to mind is count[field] but that doesn't work. Similar to right clicking on a field, statistics - count but i want to able to label that layer with that count on a map on the fly. I would appreciate any help, thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Nov 2019 16:23:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/label-map-with-feature-count/m-p/338687#M3685</guid>
      <dc:creator>CCWeedcontrol</dc:creator>
      <dc:date>2019-11-25T16:23:06Z</dc:date>
    </item>
    <item>
      <title>Re: Label map with feature count</title>
      <link>https://community.esri.com/t5/mapping-questions/label-map-with-feature-count/m-p/338688#M3686</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It looks like that function isn't available in the labeling context. I only see $layer (to use as Count($layer) to total the # of features) as a global variable under Adding an Arcade expression under Configure Popup. Unfortunately then it cannot be used in symbology or labeling.&lt;/P&gt;&lt;P&gt;More information:&amp;nbsp;&lt;A class="link-titled" href="https://developers.arcgis.com/arcade/guide/profiles/" title="https://developers.arcgis.com/arcade/guide/profiles/"&gt;Profiles | ArcGIS for Developers&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does it need to just be a webmap, like using it in Collector? Might be nice to put it in a dashboard and then use an indicator widget to display the count.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Nov 2019 19:38:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/label-map-with-feature-count/m-p/338688#M3686</guid>
      <dc:creator>ChelseaRozek</dc:creator>
      <dc:date>2019-11-25T19:38:24Z</dc:date>
    </item>
    <item>
      <title>Re: Label map with feature count</title>
      <link>https://community.esri.com/t5/mapping-questions/label-map-with-feature-count/m-p/338689#M3687</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the replay, I should have mentioned that i am working in ArcMap.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Nov 2019 19:52:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/label-map-with-feature-count/m-p/338689#M3687</guid>
      <dc:creator>CCWeedcontrol</dc:creator>
      <dc:date>2019-11-25T19:52:03Z</dc:date>
    </item>
    <item>
      <title>Re: Label map with feature count</title>
      <link>https://community.esri.com/t5/mapping-questions/label-map-with-feature-count/m-p/338690#M3688</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry about that, sounded like an Arcade question. I wasn't sure, so I just messed around in ArcMap for a bit and this worked for me:&lt;/P&gt;&lt;P&gt;- Set Text String as Expression (not a field)&lt;/P&gt;&lt;P&gt;- Set Parser to Python&lt;/P&gt;&lt;P&gt;- Check Advanced so it's ON&lt;/P&gt;&lt;P&gt;- below the def FindLabel(SOMETHING):&lt;/P&gt;&lt;P&gt;put these 2 lines of text, making sure they have one space in front of them so the first line ("def") is the furthest left.&lt;/P&gt;&lt;P&gt;mxd = arcpy.mapping.MapDocument("CURRENT")&lt;BR /&gt; return int(arcpy.GetCount_management(arcpy.mapping.ListLayers(mxd)[0]).getOutput(0))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't know if this is the most efficient way of writing it, but it worked for me. It didn't work while I was editing the layer, but once I saved and stopped editing, the labels would update with the new number. Change the 0 to the index of your layer in the table of contents (first layer = 0, second layer = 1, third layer = 2, etc.)&lt;/P&gt;&lt;P&gt;Hope that works for you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/474574_pastedImage_1.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Nov 2019 20:15:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/label-map-with-feature-count/m-p/338690#M3688</guid>
      <dc:creator>ChelseaRozek</dc:creator>
      <dc:date>2019-11-25T20:15:12Z</dc:date>
    </item>
    <item>
      <title>Re: Label map with feature count</title>
      <link>https://community.esri.com/t5/mapping-questions/label-map-with-feature-count/m-p/338691#M3689</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I came up with this but your code also works but with changing the index number or in my case the layer name, thanks for the code. I do have to check "Remove duplicate labels" in the label other options.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It would be nice to not have to put in the index number because I have about 30 layers on my map.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;def FindLabel ([OBJECTID] ):
  mxd = arcpy.mapping.MapDocument("CURRENT")
  lyr = arcpy.mapping.ListLayers(mxd,"1N3W")[0]
  with arcpy.da.SearchCursor(lyr, ["OBJECTID"]) as cursor:
    rows = {row[0] for row in cursor}

    count = 0
    for row in rows:
        count += 1
  return "%s "  % count‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 16:01:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/label-map-with-feature-count/m-p/338691#M3689</guid>
      <dc:creator>CCWeedcontrol</dc:creator>
      <dc:date>2021-12-11T16:01:32Z</dc:date>
    </item>
  </channel>
</rss>

