<?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: Query Demographic data to get the location with the highest population in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/query-demographic-data-to-get-the-location-with/m-p/464927#M43048</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you just need to get some data, you could load the file gdb from the Census into ArcMap. Since you can't do "top n"/subqueries in a file gdb (you can in a personal gdb), I created a script that should get what you need:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;fc = "ACS_11_5YR_BG_36_NEW_YORK"
popField = "B01001e1"

fl = arcpy.MakeFeatureLayer_management(fc, "top10pre", "STATEFP = '36' AND COUNTYFP IN ('005','047','061','081','085')")

records = [row[0] for row in arcpy.da.SearchCursor(fl, popField)]
topTen = sorted(records)[-10:]
query = "\"{0}\" in {1}".format(popField, tuple(topTen))&amp;nbsp; 

arcpy.MakeFeatureLayer_management(fl, "top10population", query)&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will output two layers - the last one will have what you need "top10population":&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="154015" class="image-1 jive-image" height="342" src="https://community.esri.com/legacyfs/online/154015_pastedImage_3.png" style="width: 510px; height: 342.194px;" width="510" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will give you the top ten block groups, considering only those block groups that are within NYC (the five NYC boroughs - see the COUNTYFP for the fips values).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 20:38:35 GMT</pubDate>
    <dc:creator>ChrisSmith7</dc:creator>
    <dc:date>2021-12-11T20:38:35Z</dc:date>
    <item>
      <title>Query Demographic data to get the location with the highest population</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/query-demographic-data-to-get-the-location-with/m-p/464922#M43043</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How to use demographics data in ArcGIS JavaScript APIs to get the locations with the highest population in a pre-defined area.&lt;/P&gt;&lt;P&gt;i.e. I want to get the top 10 locations with the highest population inside New York City&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Dec 2015 10:38:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/query-demographic-data-to-get-the-location-with/m-p/464922#M43043</guid>
      <dc:creator>MohamedNabil</dc:creator>
      <dc:date>2015-12-09T10:38:47Z</dc:date>
    </item>
    <item>
      <title>Re: Query Demographic data to get the location with the highest population</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/query-demographic-data-to-get-the-location-with/m-p/464923#M43044</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, that's a loaded question. What is your pre-defined area type? County? Zip? Census Block/Tract? Do you just need to know the fips codes/names for the top 10 areas and their population and/or do you need to see it on a map?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Dec 2015 15:31:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/query-demographic-data-to-get-the-location-with/m-p/464923#M43044</guid>
      <dc:creator>ChrisSmith7</dc:creator>
      <dc:date>2015-12-09T15:31:16Z</dc:date>
    </item>
    <item>
      <title>Re: Query Demographic data to get the location with the highest population</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/query-demographic-data-to-get-the-location-with/m-p/464924#M43045</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Chris.&lt;/P&gt;&lt;P&gt;My area is a custom Block layer (Polygon layer) and I need with somehow intersect this layer with demographic data then get the top 10 blocks from the population perspective. &lt;/P&gt;&lt;P&gt;I just want to get the names or IDs of the blocks without drawing them on map.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Dec 2015 15:55:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/query-demographic-data-to-get-the-location-with/m-p/464924#M43045</guid>
      <dc:creator>MohamedNabil</dc:creator>
      <dc:date>2015-12-09T15:55:29Z</dc:date>
    </item>
    <item>
      <title>Re: Query Demographic data to get the location with the highest population</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/query-demographic-data-to-get-the-location-with/m-p/464925#M43046</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When you say custom blocks - are you not using the blocks provided by the Census? You can easily get this info from them:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www2.census.gov/geo/tiger/TIGER_DP/2011ACS/2011_ACS_5YR_BG_36.gdb.zip" title="http://www2.census.gov/geo/tiger/TIGER_DP/2011ACS/2011_ACS_5YR_BG_36.gdb.zip"&gt;http://www2.census.gov/geo/tiger/TIGER_DP/2011ACS/2011_ACS_5YR_BG_36.gdb.zip&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's the metdata:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www2.census.gov/geo/docs/maps-data/data/tiger/prejoined/ACSMetadata2011.txt" title="http://www2.census.gov/geo/docs/maps-data/data/tiger/prejoined/ACSMetadata2011.txt"&gt;http://www2.census.gov/geo/docs/maps-data/data/tiger/prejoined/ACSMetadata2011.txt&lt;/A&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You would want to look at &lt;STRONG&gt;B01001e1&lt;/STRONG&gt;, which is total population.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Dec 2015 16:09:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/query-demographic-data-to-get-the-location-with/m-p/464925#M43046</guid>
      <dc:creator>ChrisSmith7</dc:creator>
      <dc:date>2015-12-09T16:09:45Z</dc:date>
    </item>
    <item>
      <title>Re: Query Demographic data to get the location with the highest population</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/query-demographic-data-to-get-the-location-with/m-p/464926#M43047</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Chris.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Dec 2015 16:19:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/query-demographic-data-to-get-the-location-with/m-p/464926#M43047</guid>
      <dc:creator>MohamedNabil</dc:creator>
      <dc:date>2015-12-09T16:19:13Z</dc:date>
    </item>
    <item>
      <title>Re: Query Demographic data to get the location with the highest population</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/query-demographic-data-to-get-the-location-with/m-p/464927#M43048</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you just need to get some data, you could load the file gdb from the Census into ArcMap. Since you can't do "top n"/subqueries in a file gdb (you can in a personal gdb), I created a script that should get what you need:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;fc = "ACS_11_5YR_BG_36_NEW_YORK"
popField = "B01001e1"

fl = arcpy.MakeFeatureLayer_management(fc, "top10pre", "STATEFP = '36' AND COUNTYFP IN ('005','047','061','081','085')")

records = [row[0] for row in arcpy.da.SearchCursor(fl, popField)]
topTen = sorted(records)[-10:]
query = "\"{0}\" in {1}".format(popField, tuple(topTen))&amp;nbsp; 

arcpy.MakeFeatureLayer_management(fl, "top10population", query)&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will output two layers - the last one will have what you need "top10population":&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="154015" class="image-1 jive-image" height="342" src="https://community.esri.com/legacyfs/online/154015_pastedImage_3.png" style="width: 510px; height: 342.194px;" width="510" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will give you the top ten block groups, considering only those block groups that are within NYC (the five NYC boroughs - see the COUNTYFP for the fips values).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 20:38:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/query-demographic-data-to-get-the-location-with/m-p/464927#M43048</guid>
      <dc:creator>ChrisSmith7</dc:creator>
      <dc:date>2021-12-11T20:38:35Z</dc:date>
    </item>
  </channel>
</rss>

