4.2 KiB
Data Observatory Access
This file is for reference purposes only. It is intended for tracking the Data Observatory API functions that should be displayed from the Docs site. Like all API doc, the golden source of the code will live in this repo. I will pull the list of files below into the docs for the output.
Documentation
OBS_GetDemographicSnapshot
The Demographic Snapshot API call enables you to collect demographic details around a point location. For example, you can take the coordinates of a bus stop and find the average population characteristics in that location. If you need help creating coordinates from addresses, [see our geocoding documentation].
Fields returned include information about income, education, transportation, race, and more. Not all fields will have information for every coordinate queried.
API Syntax
https://{{account name}}.cartodb.com/api/v2/sql?q=SELECT * FROM
OBS_GetDemographicSnapshot({{point geometry}})
Parameters
Parameter | Description | Example |
---|---|---|
account name | The name of your CartoDB account where the Data Observatory has been enabled | example_account |
point geometry | A WKB point geometry. You can use the helper function, CDB_LatLng to quickly generate one from latitude and longitude | CDB_LatLng(40.760410,-73.964242) |
Geographic Scope
The Demographic Snapshot API is available for the following countries:
- United States
API Examples
Get the Demographic Snapshot at Camp David
https://example_account.cartodb.com/api/v2/sql?q=SELECT * FROM
OBS_GetDemographicSnapshot(CDB_LatLng(39.648333, -77.465))
Get the Demographic Snapshot at Morning Side Heights
https://example_account.cartodb.com/api/v2/sql?q=SELECT * FROM
OBS_GetDemographicSnapshot(CDB_LatLng(40.810201, -73.956601))
API Response
Available fields
The Demographic Snapshot contains a broad subset of demographic measures in the Data Observatory. Over 80 measurements are returned by a single API request.
todo: turn this spreadsheet into a markdown table
OBS_GetSegmentationSnapshot
The Segmentation Snapshot API call enables you to determine the pre-calculated population segment for a location. For example, you can take the location of a store location and determine what classification of population exists around that location. If you need help creating coordinates from addresses, [see our geocoding documentation].
API Syntax
https://{{account name}}.cartodb.com/api/v2/sql?q=SELECT * FROM
OBS_GetSegmentationSnapshot({{point geometry}})
Parameters
Parameter | Description | Example |
---|---|---|
account name | The name of your CartoDB account where the Data Observatory has been enabled | example_account |
point geometry | A WKB point geometry. You can use the helper function, CDB_LatLng to quickly generate one from latitude and longitude | CDB_LatLng(40.760410,-73.964242) |
Geographic Scope
The Segmentation Snapshot API is available for the following countries:
- United States
API Examples
Get the Segmentation Snapshot around the MGM Grand
https://example_account.cartodb.com/api/v2/sql?q=SELECT * FROM
OBS_GetSegmentationSnapshot(CDB_LatLng(36.10222, -115.169516))
Get the Segmentation Snapshot at CartoDB's NYC HQ
https://example_account.cartodb.com/api/v2/sql?q=SELECT * FROM
OBS_GetSegmentationSnapshot(CDB_LatLng(40.704512, -73.936669))
API Response
todo
Available segments
todo
Methodology
Segmentation is a method that divides a target market into subgroups based on shared common traits. While we plan to make many different segmentation methods available, our first release includes a segmentation profile first defined in a paper, Understanding America's Neighborhoods Using Uncertain Data from the American Community Survey: Output Data: US_tract_clusters_new. See here for further information on the work in that paper.