Query Demographic data to get the location with the highest population

3043
5
Jump to solution
12-09-2015 02:38 AM
MohamedNabil
New Contributor

Hi,

How to use demographics data in ArcGIS JavaScript APIs to get the locations with the highest population in a pre-defined area.

i.e. I want to get the top 10 locations with the highest population inside New York City

Many Thanks.

0 Kudos
1 Solution

Accepted Solutions
ChrisSmith7
Frequent Contributor

When you say custom blocks - are you not using the blocks provided by the Census? You can easily get this info from them:

http://www2.census.gov/geo/tiger/TIGER_DP/2011ACS/2011_ACS_5YR_BG_36.gdb.zip

Here's the metdata:

http://www2.census.gov/geo/docs/maps-data/data/tiger/prejoined/ACSMetadata2011.txt 

You would want to look at B01001e1, which is total population.

View solution in original post

5 Replies
ChrisSmith7
Frequent Contributor

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?

0 Kudos
MohamedNabil
New Contributor

Thanks Chris.

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.

I just want to get the names or IDs of the blocks without drawing them on map.

0 Kudos
ChrisSmith7
Frequent Contributor

When you say custom blocks - are you not using the blocks provided by the Census? You can easily get this info from them:

http://www2.census.gov/geo/tiger/TIGER_DP/2011ACS/2011_ACS_5YR_BG_36.gdb.zip

Here's the metdata:

http://www2.census.gov/geo/docs/maps-data/data/tiger/prejoined/ACSMetadata2011.txt 

You would want to look at B01001e1, which is total population.

MohamedNabil
New Contributor

Thanks Chris.

0 Kudos
ChrisSmith7
Frequent Contributor

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:

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))  

arcpy.MakeFeatureLayer_management(fl, "top10population", query)

This will output two layers - the last one will have what you need "top10population":

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).