The SafeGraph Developer Hub

Welcome to the SafeGraph developer hub. You'll find comprehensive guides and documentation to help you start working with SafeGraph as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    

Census Block Group Data

All data from American Community Survey (2016) by Census Block Group (CBG) joined with visit & consumer behavioral data to each CBG.

Overview

SafeGraph's open census dataset includes three main components:

  • All demographic data from the American Community Survey (2016) 5-year estimate on the Census Block Group level.
  • All census block group boundaries formatted as a GeoJSON file.
  • SafeGraph neighborhood insights for each census block group that includes answers to the following and more:
    • How many people visit this CBG?
    • What brands do people spend money in this CBG?
    • Where do people who visit this CBG travel from?

The entire dataset is available for download for free at the SafeGraph Open Census Data page.

Schema

File Structure

Neighborhood Patterns is comprised of several three directories:

  • /data/
    • Includes the CBG patterns file and all Census attribute tables.
    • All files are pipe-delimited CSVs where the Census Block Group number (census_block_group is the primary key.
    • Census attribute tables are identified by their Census table ID. For example, cbg_b01.csv contains the table IDs that begin with b01 such as B01001.
    • The SafeGraph neighborhood patterns file is entitled cbg_patterns.csv.
  • /geometry/
    • Contains one GeoJSON file entitled cbg.geojson with the polygons for all Census Block Groups.
  • /metadata/
    • cbg_field_descriptions.csv: a mapping between census attribute name and table ID
    • cbg_fips_codes.csv: a mapping between census block group numbers to cities and counties
    • cbg_geographic_data.csv: statistics about census block group geometry (land/water %, interpolated lat/long).

SafeGraph Neighborhood Patterns (/data/cbg_patterns.csv)

The SafeGraph Neighborhood Patterns dataset follows a similar format to the SafeGraph Places Patterns dataset.

Column Name Description Type Example
census_block_group The unique 12-digit FIPS code for the Census Block Group. Please note that some CBGs have leading zeroes. String 130890212151
date_range_start Start time for measurement period as a timestamp in UTC seconds. Long 1538352000
date_range_end End time for measurement period as a timestamp in UTC seconds. Long 1541030400
raw_visit_count Number of visits seen by our panel to this CBG during the date range. Integer 428840
raw_visitor_count Number of unique visitors seen by our panel to this POI during the date range. Integer 109161
visitor_home_cbgs This column lists all the origin home CBGs for devices that visited a destination in the CBG listed in the column census_block_group (the destination CBG). The number mapped to each home CBG indicates the number of visitors observed from this home CBG that visited census_block_group during this time period. Home CBGs with less than 50 visitors to census_block_group are not included. JSON {String:Int} {"130890212162":291,"131210101101":272,"131350502123":207,"131350506063":199,"130890212142":188,"131210115033":187,"130890211011":182,"130890212103":177,"131350505461":170,"131350506071":170,"130890212163":169,"131350501081":169,"131350502171":167,"131210101082":163,"130890212132":162,"130890212021":158,"130670313131":152,"131350502132":151,"131350506082":148,"130890212023":144,"132231201011":144,"131210101151":141,"131210102093":140,"131350506081":140,"131210102102":138,"130570905021":136,"131350506092":135,"132231201032":135,"131210101181":135, ..., ...,"130890222041":50}`
visitor_work_cbgs This column lists all the work-location CBGs for devices that visited a destination in the CBG listed in the column census_block_group (the destination CBG). The number mapped to each work CBG indicates the number of visitors observed with this work CBG that visited census_block_group during this time period. Work CBGs with less than 50 visitors to census_block_group are not included. JSON {String:Int} {"131210101101":987,"131210119002":450,"131210101151":447,"130890212163":396,"131210116211":300,"130670302292":282,"130590004023":278,"131350503103":261,"131210100011":251,"130890212023":247,"131210019002":246,"131210116113":230,"131350503082":207,"130890212103":206,"131210101233":201,"131210116153":198,"131210010012":185,"130890224022":185,"131350503061":183,"131210102043":182,"130890212092":182,"131210010021":177,"131210101222":169,"131210101211":167,"131210100023":166,"131350502121":156,"131210115031":143,"131210102062":142,"130670303321":141,"131210101133":138,"131210116143":137,"130890212091":136,"130670303201":136,"131350502151":131,"131210005001":129,"131210116253":124,"130670303391":124,"131210114211":122,"130670308002":120, ... , ... ,"131350502131":50}
distance_from_home Median distance from home traveled to CBG by visitors (of visitors whose home we have identified) in meters. Integer 29385
related_same_day_brand Brands that the visitors to this CBG visited on the same day as their visit to the CBG where customer overlap differs by at least 5% from the SafeGraph national average to these brands. Order by strength of difference and limited to top ten brands. Array ["QuikTrip","Chick-fil-A"]
related_same_month_brand Brands that the visitors to this CBG visited on the same month as their visit to the CBG where customer overlap differs by at least 5% from the SafeGraph national average. Order by strength of difference and limited to top ten brands. Array ["Chick-fil-A","QuikTrip","walmart","mcdonalds","starbucks","Shell Oil","Publix Super Markets","Waffle House","BP","Chevron"]
top_brands A list of the the top brands visited in the CBG during the time period. Limited to top 10 brands. Array ["Target","The Men's Wearhouse","Tommy Hilfiger","mcdonalds","T.J. Maxx","Embassy Suites Hotels","Seasons 52","Nordstrom Rack","PetSmart","Ross Stores"]
popularity_by_hour A mapping of hour of the day to the number of visits in each hour over the course of the date range in local time. Array [9877,8233,7520,7512,7992,11259,19885,29153,31278,34235,36753,41983,48438,48909,47167,48258,48485,47134,43544,37033,29193,22308,16456,12628]`
popularity_by_day A mapping of day of week to the number of visits on each day (local time) in the course of the date range. JSON {String:Integer} {"Monday":67078,"Tuesday":69055,"Wednesday":69458,"Thursday":56949,"Friday":60746,"Saturday":58506,"Sunday":47048}

Census Demographic Data

Census Attribute Tables (/data/cbg_[tableid-prefix].csv)

Every attribute table contains several Table ID columns. The specific number of Table ID columns in an attribute table depends on the table ID prefix.

Column Name Description Type Example
census_block_group The unique 12-digit FIPS code for the Census Block Group. Please note that some CBGs have leading zeroes. String 010010205002
Table ID The sample values associated with the table ID of interest. For example, if the table ID of interest was B00001e1 the value would be the Unweighted Sample Count of the Population for the Census Block Group. Integer For table ID B00001e1, a sample value would be 215 for Census Block Group 010010205002.

Field Descriptions (/metadata/cbg_field_descriptions.csv)

The field descriptions table provides a mapping between the table ID used in attribute tables and the description of the field. A full list of table definitions can be found in the American Community Survey documentation.

Column Name Description Example
TableID The Census Table ID as defined by the Census Bureau. B23007e36
field_full_name The full name of the census attribute. Presence Of Own Children Under 18 Years By Family Type By Employment: No children under 18 years: Married-couple family: Husband in labor force: Employed or in Armed Forces: Wife in labor force: Employed or in Armed Forces: Opposite-sex married-couple families and families maintained by women and men with no spouse present -- (Estimate)
field_level_1 The first level of demographic focus for the selected attribute. Presence Of Own Children Under 18 Years By Family Type By Employment Status
field_level_2 The second level of demographic focus for the selected attribute. No Children Under 18 Years
field_level_3 The third level of demographic focus for the selected attribute. Married-Couple Family
field_level_4 The fourth level of demographic focus for the selected attribute. Husband In Labor Force
field_level_5 The fifth level of demographic focus for the selected attribute. Employed Or In Armed Forces
field_level_6 The sixth level of demographic focus for the selected attribute. Wife In Labor Force
field_level_7 The seventh level of demographic focus for the selected attribute. Employed Or In Armed Forces
field_level_8 The eighth level of demographic focus for the selected attribute. Opposite-Sex Married-Couple Families And Families Maintained By Women And Men With No Spouse Present -- (Estimate)

Other Reference Data

FIPS Codes (/metadata/cbg_fips_codes.csv)

The FIPS codes file provides a reference file to derive state and county for a census block group through the state and county FIPS codes. The first two digits of a Census Block Group represent the state_fips code and the next three digits represent a county_fips code.

Column Name Description Example
state State Abbreviation AL
state_fips The state FIPS code that maps to the first 2 digits of a CBG. 01
county_fips The county FIPS code that maps to the 3rd-5th digits of a CBG. 013
county County Name Butler County
class_code Geographic Class Code representing types of geographies per Census documentation. H1

Geographic Data (/metadata/cbg_geographic_data.csv)

Column Name Description Example
census_block_group Census Block Group number 010010203001
amount_land The amount of land in the Census Block Group in square meters. 3866515
amount_water The amount of water in the Census Block Group in square meters. 9054
latitude The interpolated center latitude coordinate of the Census Block Group. 32.480175
longitude The interpolated center longitude coordinate of the Census Block Group. -86.4607925

Terms of Use

SafeGraph Open Census Data is made available under the Open Database License: http://opendatacommons.org/licenses/odbl/1.0/. Any rights in individual contents of the database are licensed under the Database Contents License: http://opendatacommons.org/licenses/dbcl/1.0/

This product uses the Census Bureau Data API but is not endorsed or certified by the Census Bureau.