observatory-extension/doc/api_docs.md

53 lines
1.8 KiB
Markdown
Raw Normal View History

2016-04-12 03:49:53 +08:00
# 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.
2016-04-12 03:56:01 +08:00
## Documentation
2016-04-12 03:49:53 +08:00
## OBS_GetDemographicSnapshot
2016-04-12 04:02:57 +08:00
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 your 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
```html
https://{{account name}}.cartodb.com/api/v2/sql?q=SELECT * FROM
OBS_GetDemographicSnapshot({{point geometry}})
2016-04-12 03:49:53 +08:00
```
2016-04-12 04:02:57 +08:00
#### Parameters
2016-04-12 03:49:53 +08:00
2016-04-12 04:02:57 +08:00
| Parameter | Description | Example |
|---|:-:|:-:|
| account name | The name of your CartoDB account where the Data Observatory has been enabled | example_account |
2016-04-12 04:07:01 +08:00
| 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) |
2016-04-12 03:49:53 +08:00
2016-04-12 04:15:32 +08:00
### API Examples
__Get the Demographic Snapshot at Camp David__
2016-04-12 03:49:53 +08:00
2016-04-12 03:54:42 +08:00
```text
2016-04-12 04:02:57 +08:00
https://example_account.cartodb.com/api/v2/sql?q=SELECT * FROM
2016-04-12 04:15:32 +08:00
OBS_GetDemographicSnapshot(CDB_LatLng(39.648333, -77.465))
2016-04-12 04:02:57 +08:00
```
### API Response
2016-04-12 03:49:53 +08:00
[Click to expand](https://gist.github.com/ohasselblad/c9e59a6e8da35728d0d81dfed131ed17)
2016-04-12 04:08:00 +08:00
2016-04-12 04:08:42 +08:00
### Available fields
__todo__
2016-04-12 04:08:00 +08:00
### OBS_GetSegmentationSnapshot
API Example:
```text
https://observatory.cartodb.com/api/v2/sql?q=SELECT%20*%20FROM%20OBS_GetSegmentationSnapshot(CDB_LatLng(40.760410,-73.964242))
```