In this post, I’d like to elaborate on why you’d want to analyze demographic data spatially instead of just loading it into a plain vanilla database and querying the values from there.
Say you want to localize a customer’s address to a particular Census Tract. Using an API call, you can translate an address to a location. Now the address exists as a point. Do this for all your customers and you have a spatial table (or shapefile if you choose) of points. A simple function call using ST_Contains() will tell you which Census Tract the point falls within. You can can join that data together and create a table of customers with their corresponding Census Tracts.
At this point, you can then start looking at your customer data and compare areas based on their demographic characteristics. If you’re successful in areas with high numbers of Hispanic college students, then targeting your media buys in areas with similar demographics is better than taking a scatter shot approach across all communities. You can skip the API call by just keying off of the zip code, provided you remember the caveat about using ZCTAs from my previous post. Given the size of some zip codes, you may end up missing some of the variation within the area that you’d catch by analyzing at a lower level of granularity.
Another reason to go spatial is when you’re trying to do a different kind of spatial join than point to polygon. Suppose you had areas your company defined for itself. These could be points with buffers around them (essentially a circle centered on your point of interest), or in the case of Patch, specific boundaries delimiting the community areas each of their news sites served. In these cases, you could return all the Census Tracts that are contained or intersect that buffer, creating your own aggregation of Census data.
An easy example would be a chain store that’s looking at the demographics surrounding its existing stores. Using each store’s location as a point and buffering around it, they can then aggregate the demographic characteristics for those surrounding Census Tracts and get an idea of what the demographics look like around stores that do well and stores that don’t do so well based on their internal sales figures.
But obviously Census Tracts won’t all fit neatly into that little buffer. What if you want to use a portion of the demographics for a Census Tract? My next post will look at how you can do that.