Update methods.md

added OBS_GetUSCensusCategory(point, category)
This commit is contained in:
Andrew W. Hill 2016-04-25 10:59:59 -04:00
parent eda10dfa61
commit 1d9e37fd60

View File

@ -45,7 +45,7 @@ Should add the SQL API call here too
## OBS_GetUSCensusMeasure(polygon_geometry, measure_name);
The ```OBS_GetUSCensusMeasure(point_geometry, measure_name)``` method returns a measure based on a subset of the US Census variables within a given polygon. The ```OBS_GetUSCensusMeasure``` method is limited to only a subset of all measures that are available in the Data Observatory, to access the full list, use the ```OBS_GetMeasure``` method below.
The ```OBS_GetUSCensusMeasure(point_geometry, measure_name)``` method returns a measure based on a subset of the US Census variables within a given polygon. The ```OBS_GetUSCensusMeasure``` method is limited to only a subset of all measures that are available in the Data Observatory, to access the full list, use the ```OBS_GetUSCensusMeasure``` method below.
#### Arguments
@ -81,6 +81,43 @@ SELECT OBS_GetMeasure(ST_Buffer(CDB_LatLng(40.7, -73.9),0.001), 'Male Population
Should add the SQL API call here too
-->
## OBS_GetUSCensusCategory(point_geometry, measure_name);
The ```OBS_GetUSCensusCategory(point_geometry, category_name)``` method returns a categorical measure based on a subset of the US Census variables at a point location. It requires a different function from ```OBS_GetUSCensusMeasure``` because this function will always return TEXT, whereas ```OBS_GetUSCensusMeasure``` will always returna NUMERIC value.
#### Arguments
Name |Description
--- | ---
point_geometry | a WGS84 point geometry (the_geom)
measure_name | a human readable string name of a US Census variable. The glossary of measure_names is [available below]('measure_name table').
#### Returns
A NUMERIC value containing the following properties
Key | Description
--- | ---
value | the raw or normalized measure
#### Example
Add a Measure to an empty column based on point locations in your table
```SQL
UPDATE tablename SET local_male_population = OBS_GetUSCensusCategory(the_geom, 'Spielman Singleton Category 10')
```
Get a measure at a single point location
```SQL
SELECT OBS_GetUSCensusCategory(CDB_LatLng(40.7, -73.9), 'Spielman Singleton Category 10')
```
<!--
Should add the SQL API call here too
-->
## OBS_GetMeasure(point_geometry, measure_id);
The ```OBS_GetMeasure(point_geometry, measure_id)``` method returns any Data Observatory measure at a point location.