Merge branch 'develop' into get_segment_snapshot_fix
This commit is contained in:
@@ -39,7 +39,7 @@ AS $$
|
||||
boundary_id = 'us.census.tiger.block_group';
|
||||
END IF;
|
||||
|
||||
target_cols := Array['us.census.acs.B01001001',
|
||||
target_cols := Array['us.census.acs.B01003001',
|
||||
'us.census.acs.B01001002',
|
||||
'us.census.acs.B01001026',
|
||||
'us.census.acs.B01002001',
|
||||
@@ -172,6 +172,7 @@ BEGIN
|
||||
RAISE NOTICE 'Point % is outside of the data region', ST_AsText(geom);
|
||||
-- TODO this should return JSON
|
||||
RETURN QUERY SELECT '{}'::text[], '{}'::NUMERIC[];
|
||||
RETURN;
|
||||
END IF;
|
||||
|
||||
IF data_table_info IS NULL THEN
|
||||
@@ -198,6 +199,7 @@ BEGIN
|
||||
SELECT unnest($1)
|
||||
$query$
|
||||
USING results;
|
||||
RETURN;
|
||||
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
@@ -356,11 +358,11 @@ BEGIN
|
||||
' INTO denominator_id
|
||||
USING measure_id;
|
||||
measure_ids := ARRAY[measure_id, denominator_id];
|
||||
ELSIF normalize IS NULL OR normalize ILIKE 'none' THEN
|
||||
ELSIF normalize ILIKE 'none' THEN
|
||||
-- TODO we need a switch on obs_get to disable area normalization
|
||||
RAISE EXCEPTION 'No normalization not yet supported.';
|
||||
ELSE
|
||||
RAISE EXCEPTION 'Only valid inputs for "normalize" are "area" (default), "denominator", or "none".';
|
||||
RAISE EXCEPTION 'Only valid inputs for "normalize" are "area" (default) and "denominator".';
|
||||
END IF;
|
||||
|
||||
EXECUTE '
|
||||
@@ -398,7 +400,7 @@ BEGIN
|
||||
|
||||
IF time_span IS NULL THEN
|
||||
-- TODO we should determine latest timespan for this measure
|
||||
time_span := '2009 - 2013';
|
||||
time_span := '2010 - 2014';
|
||||
END IF;
|
||||
|
||||
EXECUTE '
|
||||
@@ -492,7 +494,7 @@ DECLARE
|
||||
result NUMERIC;
|
||||
BEGIN
|
||||
-- TODO use a super-column for global pop
|
||||
population_measure_id := 'us.census.acs.B01001001';
|
||||
population_measure_id := 'us.census.acs.B01003001';
|
||||
|
||||
EXECUTE format('SELECT cdb_observatory.OBS_GetMeasure(
|
||||
%L, %L, %L, %L, %L
|
||||
@@ -602,7 +604,7 @@ IF boundary_id IS NULL THEN
|
||||
boundary_id = 'us.census.tiger.census_tract';
|
||||
END IF;
|
||||
target_cols := Array[
|
||||
'us.census.acs.B01001001_quantile',
|
||||
'us.census.acs.B01003001_quantile',
|
||||
'us.census.acs.B01001002_quantile',
|
||||
'us.census.acs.B01001026_quantile',
|
||||
'us.census.acs.B01002001_quantile',
|
||||
@@ -667,7 +669,7 @@ target_cols := Array[
|
||||
array_agg(_OBS_GET->>'value') As vals
|
||||
FROM cdb_observatory._OBS_Get($1,
|
||||
$2,
|
||||
'2009 - 2013',
|
||||
'2010 - 2014',
|
||||
$3)
|
||||
|
||||
), percentiles As (
|
||||
@@ -708,7 +710,7 @@ DECLARE
|
||||
BEGIN
|
||||
|
||||
IF time_span IS NULL THEN
|
||||
time_span = '2009 - 2013';
|
||||
time_span = '2010 - 2014';
|
||||
END IF;
|
||||
|
||||
IF boundary_id IS NULL THEN
|
||||
@@ -721,6 +723,7 @@ BEGIN
|
||||
THEN
|
||||
RAISE NOTICE 'Point % is outside of the data region', ST_AsText(geom);
|
||||
RETURN QUERY SELECT '{}'::text[], '{}'::text[];
|
||||
RETURN;
|
||||
END IF;
|
||||
|
||||
EXECUTE '
|
||||
@@ -734,6 +737,7 @@ BEGIN
|
||||
THEN
|
||||
RAISE NOTICE 'No data table found for this location';
|
||||
RETURN QUERY SELECT NULL::json;
|
||||
RETURN;
|
||||
END IF;
|
||||
|
||||
EXECUTE
|
||||
@@ -748,6 +752,7 @@ BEGIN
|
||||
THEN
|
||||
RAISE NOTICE 'No geometry id for this location';
|
||||
RETURN QUERY SELECT NULL::json;
|
||||
RETURN;
|
||||
END IF;
|
||||
|
||||
query := 'SELECT ARRAY[';
|
||||
|
||||
Reference in New Issue
Block a user