TigerWeb Census Data - how to lookup actual latitude and longitude details

976
4
07-27-2021 06:18 AM
ChitraKrishnan
New Contributor III

Hi,

I downloaded 2020 Pennsylvania census blocks data from https://www.census.gov/cgi-bin/geo/shapefiles/index.php and exported it to csv file to understand the block details for a particular lat long value. 

We have only lat long values using which I have to highlight the blocks on the maps in our website. I could not locate few lat long values when I looked up in the csv file. 

For instance, I cannot find the lat long 40.78084694073474, -76.59403161070207 which points to a Walmart location in PA.

My understanding is that tigeweb census data are lat long ranges and not actual lat long values. In this case what is the best option to find the GEOID for an actual lat long values from tigerweb census data? Any other suggestion is highly appreciated.

Thanks

Chitra

0 Kudos
4 Replies
jcarlson
MVP Esteemed Contributor

If you want to see the GEOID for a given lat/lon pair, this is something better suited to a REST query rather than an exported CSV. Using the 2020 Census Blocks service URL, we can submit a query with the following parameters:

  • geometry = <your lon>,<your lat>
  • geometryType = esriGeometryPoint
  • inSR = 4326
  • spatialRel = esriSpatialRelIntersects
  • outFields = GEOID
  • returnGeometry = false
  • f = json

Put together in a single URL request, it would look like this (-88,44 as example point).

https://tigerweb.geo.census.gov/arcgis/rest/services/TIGERweb/tigerWMS_Census2020/MapServer/10/query?geometry=-88%2C44&geometryType=esriGeometryPoint&inSR=4326&spatialRel=esriSpatialRelIntersects&outFields=GEOID&returnGeometry=false&f=json

 Which returns

{
"displayFieldName": "BASENAME",
"fieldAliases": {
"GEOID": "GEOID"
},
"fields": [
{
"name": "GEOID",
"type": "esriFieldTypeString",
"alias": "GEOID",
"length": 16
}
],
"features": [
{
"attributes": {
"GEOID": "550710104004039"
}
}
]
}
- Josh Carlson
Kendall County GIS
0 Kudos
ChitraKrishnan
New Contributor III

Hi

Thank you very much for the reply.

My requirement is to group the blocks in a given state from highest incident rate to lowest incident rate and plot it on the map with color intensity.

So I started with https://tigerweb.geo.census.gov/arcgis/rest/services/TIGERweb/Tracts_Blocks/MapServer/2 to get the block details and found that I have to hit the webservice for every lat long value as we have only lat long values.
Then did some research and downloaded ohio shapefile, split the shapefile blockwise, queried using fetch(..) to understand how shapefiles work.
In that process I thought of using the CSV file to do a look-up of lat long and calculate the lat-long count per block. But my bad csv does not hold all the lat long values.
I understood from your reply that webservice is the best way to query any lat long.

I had below plans:

Plan 1
1. Run a nightly job that hits the restful service to fetch GEOID for every new location added to our db and update that location with the GEOID.
2. Then while loading the map on the website
- group the GEOIDs stored in the db and take top 1000.
- Split the shape file tract wise and store it locally.
- Query all the shape files and plot those 1000 blocks(GEOID) on the map.

Is this approach doable?
Will there be a change in the GEOID for a lat long later since the job updates for new location only?

Plan 2
If not using a nightly job, then I see some delay in getting the block details from the shapefiles during mapload. I am also concerned about performance.

Are there any other best approaches?

Thanks again!!.
Chitra

0 Kudos
jcarlson
MVP Esteemed Contributor

The web service will handle step 1 of your "Plan 1".

For the second step, what do you envision the end product looking like? Do you actually want to see the block polygons? It should be doable, but would either require you to already have the polygon layer locally, or make requests to the same service, but requesting geometry for specific GEOIDs.

- Josh Carlson
Kendall County GIS
0 Kudos
ChitraKrishnan
New Contributor III

Thank you very much for the reply. 

Yes I would like to see colored block polygons on the map. Would like to explore the option of having  readily available polygon layers locally. Could you please share me sample codes or links to try this out?

Thanks again!!

Chitra

 

0 Kudos