syntax fixes / function name fix

This commit is contained in:
Andy Eschbacher 2018-01-08 16:30:03 -05:00
parent e28f00d98b
commit 92becac280
4 changed files with 54 additions and 31 deletions

View File

@ -37,8 +37,10 @@ SELECT
aoi.quads, aoi.quads,
aoi.significance, aoi.significance,
c.num_cyclists_per_total_population c.num_cyclists_per_total_population
FROM cdb_crankshaft.CDB_AreasOfInterestLocal('SELECT * FROM commute_data' FROM
'num_cyclists_per_total_population') As aoi cdb_crankshaft.CDB_AreasOfInterestLocal(
'SELECT * FROM commute_data'
'num_cyclists_per_total_population') As aoi
JOIN commute_data As c JOIN commute_data As c
ON c.cartodb_id = aoi.rowid; ON c.cartodb_id = aoi.rowid;
``` ```
@ -71,8 +73,12 @@ A table with the following columns.
#### Examples #### Examples
```sql ```sql
SELECT * SELECT
FROM cdb_crankshaft.CDB_AreasOfInterestGlobal('SELECT * FROM commute_data', 'num_cyclists_per_total_population') *
FROM
cdb_crankshaft.CDB_AreasOfInterestGlobal(
'SELECT * FROM commute_data',
'num_cyclists_per_total_population')
``` ```
### CDB_AreasOfInterestLocalRate(subquery text, numerator_column text, denominator_column text) ### CDB_AreasOfInterestLocalRate(subquery text, numerator_column text, denominator_column text)
@ -113,9 +119,11 @@ SELECT
aoi.quads, aoi.quads,
aoi.significance, aoi.significance,
c.cyclists_per_total_population c.cyclists_per_total_population
FROM cdb_crankshaft.CDB_AreasOfInterestLocalRate('SELECT * FROM commute_data' FROM
'num_cyclists', cdb_crankshaft.CDB_AreasOfInterestLocalRate(
'total_population') As aoi 'SELECT * FROM commute_data'
'num_cyclists',
'total_population') As aoi
JOIN commute_data As c JOIN commute_data As c
ON c.cartodb_id = aoi.rowid; ON c.cartodb_id = aoi.rowid;
``` ```
@ -149,10 +157,13 @@ A table with the following columns.
#### Examples #### Examples
```sql ```sql
SELECT * SELECT
FROM cdb_crankshaft.CDB_AreasOfInterestGlobalRate('SELECT * FROM commute_data', *
'num_cyclists', FROM
'total_population') cdb_crankshaft.CDB_AreasOfInterestGlobalRate(
'SELECT * FROM commute_data',
'num_cyclists',
'total_population')
``` ```
## Hotspot, Coldspot, and Outlier Functions ## Hotspot, Coldspot, and Outlier Functions

View File

@ -40,8 +40,12 @@ SELECT
m.trend_up, m.trend_up,
m.trend_down, m.trend_down,
m.volatility m.volatility
FROM cdb_crankshaft.CDB_SpatialMarkovTrend('SELECT * FROM nyc_real_estate' FROM
Array['m03y2009','m03y2010','m03y2011','m03y2012','m03y2013','m03y2014','m03y2015','m03y2016']) As m cdb_crankshaft.CDB_SpatialMarkovTrend(
'SELECT * FROM nyc_real_estate'
Array['m03y2009', 'm03y2010', 'm03y2011',
'm03y2012', 'm03y2013', 'm03y2014',
'm03y2015','m03y2016']) As m
JOIN nyc_real_estate As c JOIN nyc_real_estate As c
ON c.cartodb_id = m.rowid; ON c.cartodb_id = m.rowid;
``` ```

View File

@ -1,6 +1,6 @@
## K-Means Functions ## K-Means Functions
### CDB_KMeans(subquery text, no_clusters INTEGER) ### CDB_KMeans(subquery text, no_clusters integer)
This function attempts to find n clusters within the input data. It will return a table to CartoDB ids and This function attempts to find n clusters within the input data. It will return a table to CartoDB ids and
the number of the cluster each point in the input was assigend to. the number of the cluster each point in the input was assigend to.
@ -29,8 +29,10 @@ A table with the following columns.
SELECT SELECT
customers.*, customers.*,
km.cluster_no km.cluster_no
FROM cdb_crankshaft.CDB_Kmeans('SELECT * from customers' , 6) km, customers_3 FROM
WHERE customers.cartodb_id = km.cartodb_id cdb_crankshaft.CDB_Kmeans('SELECT * from customers' , 6) km, customers_3
WHERE
customers.cartodb_id = km.cartodb_id
``` ```
### CDB_WeightedMean(subquery text, weight_column text, category_column text) ### CDB_WeightedMean(subquery text, weight_column text, category_column text)
@ -57,6 +59,12 @@ A table with the following columns.
### Example Usage ### Example Usage
```sql ```sql
SELECT ST_TRANSFORM(the_geom, 3857) as the_geom_webmercator, class SELECT
FROM cdb_crankshaft.cdb_weighted_mean('SELECT *, customer_value FROM customers','customer_value','cluster_no') ST_Transform(m.the_geom, 3857) AS the_geom_webmercator,
m.class
FROM
cdb_crankshaft.cdb_WeightedMean(
'SELECT * FROM customers',
'customer_value',
'cluster_no') AS m
``` ```