Merge branch 'QLIK' of github.com:CartoDB/observatory-extension into QLIK
This commit is contained in:
@@ -39,11 +39,11 @@ __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__
|
||||
__Get the Demographic Snapshot in the Upper West Side__
|
||||
|
||||
```text
|
||||
https://example_account.cartodb.com/api/v2/sql?q=SELECT * FROM
|
||||
OBS_GetDemographicSnapshot(CDB_LatLng(40.810201, -73.956601))
|
||||
OBS_GetDemographicSnapshot(CDB_LatLng(40.80, -73.960))
|
||||
```
|
||||
|
||||
### API Response
|
||||
|
||||
@@ -95,7 +95,6 @@ $$ LANGUAGE plpgsql;
|
||||
|
||||
|
||||
--Test point cause Stuart always seems to make random points in the water
|
||||
-- Old: _TEST_POINT
|
||||
CREATE OR REPLACE FUNCTION _TestPoint()
|
||||
RETURNS geometry
|
||||
AS $$
|
||||
@@ -119,7 +118,6 @@ $$ LANGUAGE plpgsql;
|
||||
|
||||
--Used to expand a column based response to a table based one. Give it the desired
|
||||
--columns and it will return a partial query for rolling them out to a table.
|
||||
-- Old: OBS_BUILD_SNAPSHOT_QUERY
|
||||
CREATE OR REPLACE FUNCTION OBS_BuildSnapshotQuery(names text[])
|
||||
RETURNS TEXT
|
||||
AS $$
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
----DECLARE
|
||||
----target_cols text[];
|
||||
----names text[];
|
||||
----vals numeric[];-
|
||||
----vals NUMERIC[];-
|
||||
----q text;
|
||||
----BEGIN
|
||||
----target_cols := Array[<%=get_dimensions_for_tag(tag_name)%>],
|
||||
@@ -21,7 +21,6 @@
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
-- Creates a table of demographic snapshot
|
||||
-- TODO: Remove since it does address geocoding?
|
||||
|
||||
CREATE OR REPLACE FUNCTION OBS_GetDemographicSnapshot(geom geometry, time_span text default '2009 - 2013', geometry_level text default '"us.census.tiger".block_group' )
|
||||
RETURNS TABLE(
|
||||
@@ -37,24 +36,24 @@ RETURNS TABLE(
|
||||
other_race_pop NUMERIC,
|
||||
two_or_more_races_pop NUMERIC,
|
||||
not_hispanic_pop NUMERIC,
|
||||
not_us_citizen_pop NUMERIC,
|
||||
workers_16_and_over NUMERIC,
|
||||
commuters_by_car_truck_van NUMERIC,
|
||||
commuters_drove_alone NUMERIC,
|
||||
commuters_by_carpool NUMERIC,
|
||||
commuters_by_public_transportation NUMERIC,
|
||||
commuters_by_bus NUMERIC,
|
||||
commuters_by_subway_or_elevated NUMERIC,
|
||||
walked_to_work NUMERIC,
|
||||
worked_at_home NUMERIC,
|
||||
children NUMERIC,
|
||||
--not_us_citizen_pop NUMERIC,
|
||||
--workers_16_and_over NUMERIC,
|
||||
--commuters_by_car_truck_van NUMERIC,
|
||||
--commuters_drove_alone NUMERIC,
|
||||
--commuters_by_carpool NUMERIC,
|
||||
--commuters_by_public_transportation NUMERIC,
|
||||
--commuters_by_bus NUMERIC,
|
||||
--commuters_by_subway_or_elevated NUMERIC,
|
||||
--walked_to_work NUMERIC,
|
||||
--worked_at_home NUMERIC,
|
||||
--children NUMERIC, -- TODO we should be able to get this at BG
|
||||
households NUMERIC,
|
||||
population_3_years_over NUMERIC,
|
||||
in_school NUMERIC,
|
||||
in_grades_1_to_4 NUMERIC,
|
||||
in_grades_5_to_8 NUMERIC,
|
||||
in_grades_9_to_12 NUMERIC,
|
||||
in_undergrad_college NUMERIC,
|
||||
--population_3_years_over NUMERIC,
|
||||
--in_school NUMERIC,
|
||||
--in_grades_1_to_4 NUMERIC,
|
||||
--in_grades_5_to_8 NUMERIC,
|
||||
--in_grades_9_to_12 NUMERIC,
|
||||
--in_undergrad_college NUMERIC,
|
||||
pop_25_years_over NUMERIC,
|
||||
high_school_diploma NUMERIC,
|
||||
less_one_year_college NUMERIC,
|
||||
@@ -63,10 +62,10 @@ RETURNS TABLE(
|
||||
bachelors_degree NUMERIC,
|
||||
masters_degree NUMERIC,
|
||||
pop_5_years_over NUMERIC,
|
||||
speak_only_english_at_home NUMERIC,
|
||||
speak_spanish_at_home NUMERIC,
|
||||
pop_determined_poverty_status NUMERIC,
|
||||
poverty NUMERIC,
|
||||
--speak_only_english_at_home NUMERIC,
|
||||
--speak_spanish_at_home NUMERIC,
|
||||
--pop_determined_poverty_status NUMERIC,
|
||||
--poverty NUMERIC,
|
||||
median_income NUMERIC,
|
||||
gini_index NUMERIC,
|
||||
income_per_capita NUMERIC,
|
||||
@@ -79,12 +78,12 @@ RETURNS TABLE(
|
||||
owner_occupied_housing_units NUMERIC,
|
||||
million_dollar_housing_units NUMERIC,
|
||||
mortgaged_housing_units NUMERIC,
|
||||
pop_15_and_over NUMERIC,
|
||||
pop_never_married NUMERIC,
|
||||
pop_now_married NUMERIC,
|
||||
pop_separated NUMERIC,
|
||||
pop_widowed NUMERIC,
|
||||
pop_divorced NUMERIC,
|
||||
--pop_15_and_over NUMERIC,
|
||||
--pop_never_married NUMERIC,
|
||||
--pop_now_married NUMERIC,
|
||||
--pop_separated NUMERIC,
|
||||
--pop_widowed NUMERIC,
|
||||
--pop_divorced NUMERIC,
|
||||
commuters_16_over NUMERIC,
|
||||
commute_less_10_mins NUMERIC,
|
||||
commute_10_14_mins NUMERIC,
|
||||
@@ -110,14 +109,15 @@ RETURNS TABLE(
|
||||
income_75000_99999 NUMERIC,
|
||||
income_100000_124999 NUMERIC,
|
||||
income_125000_149999 NUMERIC,
|
||||
income_150000_199999 NUMERIC)
|
||||
income_150000_199999 NUMERIC,
|
||||
income_200000_or_more NUMERIC)
|
||||
AS $$
|
||||
DECLARE
|
||||
target_cols text[];
|
||||
names text[];
|
||||
vals numeric[];
|
||||
vals NUMERIC[];
|
||||
q text;
|
||||
BEGIN
|
||||
BEGIN
|
||||
target_cols := Array['total_pop',
|
||||
'male_pop',
|
||||
'female_pop',
|
||||
@@ -130,24 +130,24 @@ DECLARE
|
||||
'other_race_pop',
|
||||
'two_or_more_races_pop',
|
||||
'not_hispanic_pop',
|
||||
'not_us_citizen_pop',
|
||||
'workers_16_and_over',
|
||||
'commuters_by_car_truck_van',
|
||||
'commuters_drove_alone',
|
||||
'commuters_by_carpool',
|
||||
'commuters_by_public_transportation',
|
||||
'commuters_by_bus',
|
||||
'commuters_by_subway_or_elevated',
|
||||
'walked_to_work',
|
||||
'worked_at_home',
|
||||
'children',
|
||||
--'not_us_citizen_pop',
|
||||
--'workers_16_and_over',
|
||||
--'commuters_by_car_truck_van',
|
||||
--'commuters_drove_alone',
|
||||
--'commuters_by_carpool',
|
||||
--'commuters_by_public_transportation',
|
||||
--'commuters_by_bus',
|
||||
--'commuters_by_subway_or_elevated',
|
||||
--'walked_to_work',
|
||||
--'worked_at_home',
|
||||
--'children',
|
||||
'households',
|
||||
'population_3_years_over',
|
||||
'in_school',
|
||||
'in_grades_1_to_4',
|
||||
'in_grades_5_to_8',
|
||||
'in_grades_9_to_12',
|
||||
'in_undergrad_college',
|
||||
--'population_3_years_over',
|
||||
--'in_school',
|
||||
--'in_grades_1_to_4',
|
||||
--'in_grades_5_to_8',
|
||||
--'in_grades_9_to_12',
|
||||
--'in_undergrad_college',
|
||||
'pop_25_years_over',
|
||||
'high_school_diploma',
|
||||
'less_one_year_college',
|
||||
@@ -156,10 +156,10 @@ DECLARE
|
||||
'bachelors_degree',
|
||||
'masters_degree',
|
||||
'pop_5_years_over',
|
||||
'speak_only_english_at_home',
|
||||
'speak_spanish_at_home',
|
||||
'pop_determined_poverty_status',
|
||||
'poverty',
|
||||
--'speak_only_english_at_home',
|
||||
--'speak_spanish_at_home',
|
||||
--'pop_determined_poverty_status',
|
||||
--'poverty',
|
||||
'median_income',
|
||||
'gini_index',
|
||||
'income_per_capita',
|
||||
@@ -172,12 +172,12 @@ DECLARE
|
||||
'owner_occupied_housing_units',
|
||||
'million_dollar_housing_units',
|
||||
'mortgaged_housing_units',
|
||||
'pop_15_and_over',
|
||||
'pop_never_married',
|
||||
'pop_now_married',
|
||||
'pop_separated',
|
||||
'pop_widowed',
|
||||
'pop_divorced',
|
||||
--'pop_15_and_over',
|
||||
--'pop_never_married',
|
||||
--'pop_now_married',
|
||||
--'pop_separated',
|
||||
--'pop_widowed',
|
||||
--'pop_divorced',
|
||||
'commuters_16_over',
|
||||
'commute_less_10_mins',
|
||||
'commute_10_14_mins',
|
||||
@@ -203,17 +203,17 @@ DECLARE
|
||||
'income_75000_99999',
|
||||
'income_100000_124999',
|
||||
'income_125000_149999',
|
||||
'income_150000_199999'
|
||||
];
|
||||
'income_150000_199999',
|
||||
'income_200000_or_more'];
|
||||
|
||||
q = 'WITH a As (
|
||||
q := 'WITH a As (
|
||||
SELECT
|
||||
dimension As names,
|
||||
dimension_value As vals
|
||||
FROM OBS_GetCensus($1,$2,$3,$4)
|
||||
)' ||
|
||||
OBS_BuildSnapshotQuery(target_cols) ||
|
||||
' FROM a';
|
||||
' FROM a';
|
||||
|
||||
RETURN QUERY
|
||||
EXECUTE
|
||||
@@ -235,15 +235,15 @@ CREATE OR REPLACE FUNCTION OBS_GetCensus(
|
||||
geom geometry,
|
||||
dimension_names text[],
|
||||
time_span text DEFAULT '2009 - 2013',
|
||||
geometry_level text DEFAULT '"us.census.tiger".census_tract'
|
||||
geometry_level text DEFAULT '"us.census.tiger".block_group'
|
||||
)
|
||||
RETURNS TABLE(dimension text[], dimension_value numeric[])
|
||||
RETURNS TABLE(dimension text[], dimension_value NUMERIC[])
|
||||
AS $$
|
||||
DECLARE
|
||||
ids text[];
|
||||
BEGIN
|
||||
|
||||
ids = OBS_LookupCensusHuman(dimension_names);
|
||||
ids := OBS_LookupCensusHuman(dimension_names);
|
||||
|
||||
RETURN QUERY SELECT names, vals
|
||||
FROM OBS_Get(geom, ids, time_span, geometry_level);
|
||||
@@ -262,7 +262,7 @@ CREATE OR REPLACE FUNCTION OBS_Get(
|
||||
RETURNS TABLE(names text[], vals NUMERIC[])
|
||||
AS $$
|
||||
DECLARE
|
||||
results numeric[];
|
||||
results NUMERIC[];
|
||||
geom_table_name text;
|
||||
names text[];
|
||||
query text;
|
||||
@@ -273,7 +273,8 @@ BEGIN
|
||||
|
||||
IF geom_table_name IS NULL
|
||||
THEN
|
||||
RAISE EXCEPTION 'Point % is outside of the data region', geom;
|
||||
RAISE NOTICE 'Point % is outside of the data region', geom;
|
||||
RETURN QUERY SELECT '{}'::text[], '{}'::NUMERIC[];
|
||||
END IF;
|
||||
|
||||
data_table_info := OBS_GetColumnData(geometry_level,
|
||||
@@ -301,7 +302,7 @@ BEGIN
|
||||
results := Array[];
|
||||
END IF;
|
||||
|
||||
RETURN QUERY (SELECT names, results);
|
||||
RETURN QUERY SELECT names, results;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
@@ -313,15 +314,18 @@ CREATE OR REPLACE FUNCTION OBS_GetPoints(
|
||||
geom_table_name text,
|
||||
data_table_info OBS_ColumnData[]
|
||||
|
||||
) RETURNS NUMERIC[] AS $$
|
||||
)
|
||||
RETURNS NUMERIC[]
|
||||
AS $$
|
||||
DECLARE
|
||||
result NUMERIC[];
|
||||
query text;
|
||||
i int;
|
||||
geoid text;
|
||||
area numeric;
|
||||
area NUMERIC;
|
||||
BEGIN
|
||||
|
||||
-- TODO: does 'geoid' need to be generalized to geom_ref??
|
||||
EXECUTE
|
||||
format('SELECT geoid
|
||||
FROM observatory.%I
|
||||
@@ -330,7 +334,7 @@ BEGIN
|
||||
USING geom
|
||||
INTO geoid;
|
||||
|
||||
RAISE NOTICE 'geoid is % geometry table is % ', geoid, geom_table_name;
|
||||
RAISE NOTICE 'geoid is %, geometry table is % ', geoid, geom_table_name;
|
||||
|
||||
EXECUTE
|
||||
format('SELECT ST_Area(the_geom::geography) / (1000 * 1000)
|
||||
@@ -353,13 +357,13 @@ BEGIN
|
||||
area);
|
||||
END IF;
|
||||
|
||||
IF i < array_upper(data_table_info, 1)
|
||||
IF i < array_upper(data_table_info, 1)
|
||||
THEN
|
||||
query = query || ',';
|
||||
query := query || ',';
|
||||
END IF;
|
||||
END LOOP;
|
||||
|
||||
query = query || format(' ]
|
||||
query := query || format(' ]
|
||||
FROM observatory.%I
|
||||
WHERE %I.geoid = %L
|
||||
',
|
||||
@@ -374,21 +378,22 @@ BEGIN
|
||||
USING geom;
|
||||
|
||||
RETURN result;
|
||||
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
CREATE OR REPLACE FUNCTION OBS_GetPolygons (
|
||||
CREATE OR REPLACE FUNCTION OBS_GetPolygons(
|
||||
geom geometry,
|
||||
geom_table_name text,
|
||||
data_table_info OBS_ColumnData[]
|
||||
) returns numeric[] AS $$
|
||||
)
|
||||
RETURNS NUMERIC[]
|
||||
AS $$
|
||||
DECLARE
|
||||
result numeric[];
|
||||
result NUMERIC[];
|
||||
q_select text;
|
||||
q_sum text;
|
||||
q text;
|
||||
i numeric;
|
||||
i NUMERIC;
|
||||
BEGIN
|
||||
|
||||
q_select := 'select geoid, ';
|
||||
@@ -396,19 +401,19 @@ BEGIN
|
||||
|
||||
FOR i IN 1..array_upper(data_table_info, 1)
|
||||
LOOP
|
||||
q_select = q_select || format( '%I ', ((data_table_info)[i]).colname);
|
||||
q_select := q_select || format( '%I ', ((data_table_info)[i]).colname);
|
||||
|
||||
IF ((data_table_info)[i]).aggregate ='sum'
|
||||
THEN
|
||||
q_sum = q_sum || format('sum(overlap_fraction * COALESCE(%I, 0)) ',((data_table_info)[i]).colname,((data_table_info)[i]).colname);
|
||||
q_sum := q_sum || format('sum(overlap_fraction * COALESCE(%I, 0)) ',((data_table_info)[i]).colname,((data_table_info)[i]).colname);
|
||||
ELSE
|
||||
q_sum = q_sum || ' null ';
|
||||
q_sum := q_sum || ' null ';
|
||||
END IF;
|
||||
|
||||
IF i < array_upper(data_table_info,1)
|
||||
THEN
|
||||
q_select = q_select || format(',');
|
||||
q_sum = q_sum || format(',');
|
||||
q_select := q_select || format(',');
|
||||
q_sum := q_sum || format(',');
|
||||
END IF;
|
||||
END LOOP;
|
||||
|
||||
@@ -424,9 +429,9 @@ BEGIN
|
||||
values As (
|
||||
', geom_table_name);
|
||||
|
||||
q = q || q_select || format('FROM observatory.%I ', ((data_table_info)[1].tablename));
|
||||
q := q || q_select || format('FROM observatory.%I ', ((data_table_info)[1].tablename));
|
||||
|
||||
q = q || ' ) ' || q_sum || ' ] FROM _overlaps, values
|
||||
q := q || ' ) ' || q_sum || ' ] FROM _overlaps, values
|
||||
WHERE values.geoid = _overlaps.geoid';
|
||||
|
||||
EXECUTE
|
||||
@@ -440,54 +445,54 @@ $$ LANGUAGE plpgsql;
|
||||
|
||||
CREATE OR REPLACE FUNCTION OBS_GetSegmentSnapshot(
|
||||
geom geometry,
|
||||
geometry_level text DEFAULT '"us.census.tiger".census_tract'
|
||||
geometry_level text DEFAULT '"us.census.tiger".block_group'
|
||||
)
|
||||
RETURNS TABLE(
|
||||
segment_name TEXT,
|
||||
total_pop_quantile Numeric,
|
||||
male_pop_quantile Numeric,
|
||||
female_pop_quantile Numeric,
|
||||
median_age_quantile Numeric,
|
||||
white_pop_quantile Numeric,
|
||||
black_pop_quantile Numeric,
|
||||
asian_pop_quantile Numeric,
|
||||
hispanic_pop_quantile Numeric,
|
||||
not_us_citizen_pop_quantile Numeric,
|
||||
workers_16_and_over_quantile Numeric,
|
||||
commuters_by_car_truck_van_quantile Numeric,
|
||||
commuters_by_public_transportation_quantile Numeric,
|
||||
commuters_by_bus_quantile Numeric,
|
||||
commuters_by_subway_or_elevated_quantile Numeric,
|
||||
walked_to_work_quantile Numeric,
|
||||
worked_at_home_quantile Numeric,
|
||||
children_quantile Numeric,
|
||||
households_quantile Numeric,
|
||||
population_3_years_over_quantile Numeric,
|
||||
in_school_quantile Numeric,
|
||||
in_grades_1_to_4_quantile Numeric,
|
||||
in_grades_5_to_8_quantile Numeric,
|
||||
in_grades_9_to_12_quantile Numeric,
|
||||
in_undergrad_college_quantile Numeric,
|
||||
pop_25_years_over_quantile Numeric,
|
||||
high_school_diploma_quantile Numeric,
|
||||
bachelors_degree_quantile Numeric,
|
||||
masters_degree_quantile Numeric,
|
||||
pop_5_years_over_quantile Numeric,
|
||||
speak_only_english_at_home_quantile Numeric,
|
||||
speak_spanish_at_home_quantile Numeric,
|
||||
pop_determined_poverty_status_quantile Numeric,
|
||||
poverty_quantile Numeric,
|
||||
median_income_quantile Numeric,
|
||||
gini_index_quantile Numeric,
|
||||
income_per_capita_quantile Numeric,
|
||||
housing_units_quantile Numeric,
|
||||
vacant_housing_units_quantile Numeric,
|
||||
vacant_housing_units_for_rent_quantile Numeric,
|
||||
vacant_housing_units_for_sale_quantile Numeric,
|
||||
median_rent_quantile Numeric,
|
||||
percent_income_spent_on_rent_quantile Numeric,
|
||||
owner_occupied_housing_units_quantile Numeric,
|
||||
million_dollar_housing_units_quantile Numeric
|
||||
total_pop_quantile NUMERIC,
|
||||
male_pop_quantile NUMERIC,
|
||||
female_pop_quantile NUMERIC,
|
||||
median_age_quantile NUMERIC,
|
||||
white_pop_quantile NUMERIC,
|
||||
black_pop_quantile NUMERIC,
|
||||
asian_pop_quantile NUMERIC,
|
||||
hispanic_pop_quantile NUMERIC,
|
||||
not_us_citizen_pop_quantile NUMERIC,
|
||||
workers_16_and_over_quantile NUMERIC,
|
||||
commuters_by_car_truck_van_quantile NUMERIC,
|
||||
commuters_by_public_transportation_quantile NUMERIC,
|
||||
commuters_by_bus_quantile NUMERIC,
|
||||
commuters_by_subway_or_elevated_quantile NUMERIC,
|
||||
walked_to_work_quantile NUMERIC,
|
||||
worked_at_home_quantile NUMERIC,
|
||||
children_quantile NUMERIC,
|
||||
households_quantile NUMERIC,
|
||||
population_3_years_over_quantile NUMERIC,
|
||||
in_school_quantile NUMERIC,
|
||||
in_grades_1_to_4_quantile NUMERIC,
|
||||
in_grades_5_to_8_quantile NUMERIC,
|
||||
in_grades_9_to_12_quantile NUMERIC,
|
||||
in_undergrad_college_quantile NUMERIC,
|
||||
pop_25_years_over_quantile NUMERIC,
|
||||
high_school_diploma_quantile NUMERIC,
|
||||
bachelors_degree_quantile NUMERIC,
|
||||
masters_degree_quantile NUMERIC,
|
||||
pop_5_years_over_quantile NUMERIC,
|
||||
speak_only_english_at_home_quantile NUMERIC,
|
||||
speak_spanish_at_home_quantile NUMERIC,
|
||||
pop_determined_poverty_status_quantile NUMERIC,
|
||||
poverty_quantile NUMERIC,
|
||||
median_income_quantile NUMERIC,
|
||||
gini_index_quantile NUMERIC,
|
||||
income_per_capita_quantile NUMERIC,
|
||||
housing_units_quantile NUMERIC,
|
||||
vacant_housing_units_quantile NUMERIC,
|
||||
vacant_housing_units_for_rent_quantile NUMERIC,
|
||||
vacant_housing_units_for_sale_quantile NUMERIC,
|
||||
median_rent_quantile NUMERIC,
|
||||
percent_income_spent_on_rent_quantile NUMERIC,
|
||||
owner_occupied_housing_units_quantile NUMERIC,
|
||||
million_dollar_housing_units_quantile NUMERIC
|
||||
|
||||
) AS $$
|
||||
DECLARE
|
||||
@@ -545,48 +550,49 @@ target_cols := Array[
|
||||
|
||||
EXECUTE
|
||||
$query$
|
||||
select (categories)[1]
|
||||
from OBS_GetCategories($1,Array['"us.census.spielman_singleton_segments".X10'])
|
||||
limit 1
|
||||
SELECT (categories)[1]
|
||||
FROM OBS_GetCategories($1,
|
||||
Array['"us.census.spielman_singleton_segments".X10'])
|
||||
LIMIT 1
|
||||
$query$
|
||||
INTO segment_name
|
||||
|
||||
USING geom;
|
||||
|
||||
q =
|
||||
q :=
|
||||
format( $query$
|
||||
WITH a As (
|
||||
SELECT
|
||||
names As names,
|
||||
vals As vals
|
||||
FROM OBS_Get($1,
|
||||
$2,
|
||||
'2009 - 2013',
|
||||
$3)
|
||||
FROM OBS_Get($1,
|
||||
$2,
|
||||
'2009 - 2013',
|
||||
$3)
|
||||
|
||||
), percentiles as (
|
||||
), percentiles As (
|
||||
%s
|
||||
FROM a)
|
||||
select $4, percentiles.*
|
||||
from percentiles
|
||||
$query$, OBS_BuildSnapshotQuery(target_cols) );
|
||||
SELECT $4, percentiles.*
|
||||
FROM percentiles
|
||||
$query$, OBS_BuildSnapshotQuery(target_cols));
|
||||
|
||||
RETURN QUERY
|
||||
EXECUTE
|
||||
q
|
||||
USING geom, target_cols, geometry_level, segment_name ;
|
||||
USING geom, target_cols, geometry_level, segment_name;
|
||||
|
||||
END $$ LANGUAGE plpgsql ;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
--Get categorical variables from point
|
||||
|
||||
CREATE OR REPLACE FUNCTION OBS_GetCategories(
|
||||
geom geometry,
|
||||
dimension_names text[],
|
||||
geometry_level text DEFAULT '"us.census.tiger".census_tract',
|
||||
geometry_level text DEFAULT '"us.census.tiger".block_group',
|
||||
time_span text DEFAULT '2009 - 2013'
|
||||
)
|
||||
returns TABLE(names text[], categories text[]) as $$
|
||||
RETURNS TABLE(names text[], categories text[]) as $$
|
||||
DECLARE
|
||||
geom_table_name text;
|
||||
geoid text;
|
||||
@@ -597,9 +603,11 @@ DECLARE
|
||||
BEGIN
|
||||
|
||||
geom_table_name := OBS_GeomTable(geom, geometry_level);
|
||||
|
||||
IF geom_table_name IS NULL
|
||||
THEN
|
||||
RAISE EXCEPTION 'Point % is outside of the data region', geom;
|
||||
RAISE NOTICE 'Point % is outside of the data region', ST_AsText(geom);
|
||||
RETURN QUERY SELECT '{}'::text[], '{}'::text[];
|
||||
END IF;
|
||||
|
||||
data_table_info := OBS_GetColumnData(geometry_level,
|
||||
@@ -625,11 +633,11 @@ BEGIN
|
||||
query = query || format('%I ', lower(((data_table_info)[i]).colname));
|
||||
IF i < array_upper(data_table_info, 1)
|
||||
THEN
|
||||
query = query || ',';
|
||||
query := query || ',';
|
||||
END IF;
|
||||
END LOOP;
|
||||
|
||||
query = query || format(' ]
|
||||
query := query || format(' ]
|
||||
FROM observatory.%I
|
||||
WHERE %I.geoid = %L
|
||||
',
|
||||
@@ -644,8 +652,8 @@ BEGIN
|
||||
USING geom;
|
||||
|
||||
RETURN QUERY
|
||||
select names,results
|
||||
SELECT names,results
|
||||
RETURN;
|
||||
|
||||
END
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
1756
src/pg/test/fixtures/obs_column.sql
vendored
1756
src/pg/test/fixtures/obs_column.sql
vendored
File diff suppressed because it is too large
Load Diff
2289
src/pg/test/fixtures/obs_column_table.sql
vendored
2289
src/pg/test/fixtures/obs_column_table.sql
vendored
File diff suppressed because it is too large
Load Diff
69
src/pg/test/fixtures/obs_table.sql
vendored
69
src/pg/test/fixtures/obs_table.sql
vendored
@@ -1,40 +1,37 @@
|
||||
--
|
||||
-- PostgreSQL database dump
|
||||
--
|
||||
|
||||
CREATE TABLE obs_table(cartodb_id bigint, the_geom geometry, the_geom_webmercator geometry, id text, tablename text, timespan text, bounds text, description text, version text);
|
||||
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (1, NULL, NULL, '"us.census.spielman_singleton_segments".spielman_singleton_table_99914b932b', 'obs_65f29658e096ca1485bf683f65fdbc9f05ec3c5d', '2009 - 2013', 'BOX(0 0,0 0)', NULL, '5');
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (2, NULL, NULL, '"us.census.acs".extract_block_group_5yr_2013_69b156927c', 'obs_3e7cc9cfd403b912c57b42d5f9195af9ce2f3cdb', '2009 - 2013', 'BOX(-179.231086 -14.601813,179.859681 71.441059)', NULL, '1');
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (3, NULL, NULL, '"us.census.tiger".sum_level_false_block_group_2013_5c764f39d2', 'obs_85328201013baa14e8e8a4a57a01e6f6fbc5f9b1', '2013', 'BOX(-179.231086 -14.601813,179.859681 71.441059)', NULL, '4');
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (4, NULL, NULL, '"us.census.acs".quantiles_census_tract_5yr_2013_a0eee6bf1a', 'obs_d34555209878e8c4b37cf0b2b3d072ff129ec470', '2009 - 2013', 'BOX(0 0,0 0)', NULL, '0');
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (5, NULL, NULL, '"us.census.tiger".sum_level_false_census_tract_2013_c489085a44', 'obs_a92e1111ad3177676471d66bb8036e6d057f271b', '2013', 'BOX(-179.231086 -14.601813,179.859681 71.441059)', NULL, '4');
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (6, NULL, NULL, '"us.ny.nyc.opendata".acris_master_99914b932b', 'obs_811c938d1307530a3db53fc69f11a2499174d224', '1966 - present', 'BOX(0 0,0 0)', NULL, '0');
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (7, NULL, NULL, '"us.census.tiger".sum_level_false_state_2013_0b919d8984', 'obs_f3f0912fe24bc0c976e837b5a116d0c803cc01ce', '2013', 'BOX(-179.231086 -14.601813,179.859681 71.441059)', NULL, '4');
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (8, NULL, NULL, '"us.census.tiger".sum_level_false_county_2013_66804ade17', 'obs_b0ef6dd68d5faddbf231fd7f02916b3d00ec43c4', '2013', 'BOX(-179.231086 -14.601813,179.859681 71.441059)', NULL, '4');
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (9, NULL, NULL, '"us.census.tiger".sum_level_false_puma_2013_4a11a4ba96', 'obs_0008b162b516c295d7204c9ba043ab5dbc67c59c', '2013', 'BOX(-179.231086 13.182335,179.859681 71.441059)', NULL, '4');
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (10, NULL, NULL, '"us.census.tiger".sum_level_true_state_2013_f1ab8fce27', 'obs_a20f5260b618a2fe2eb95fc1e23febe0db7db096', '2013', 'BOX(-179.231086 -14.601813,179.859681 71.441059)', NULL, '4');
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (11, NULL, NULL, '"us.census.tiger".sum_level_true_county_2013_39133ea7a1', 'obs_23da37d4e66e9de2f525572967f8618bde99a8c0', '2013', 'BOX(-179.231086 -14.601813,179.859681 71.441059)', NULL, '4');
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (12, NULL, NULL, '"us.census.tiger".sum_level_false_zcta5_2013_bf420fa8c1', 'obs_d483723c5cc76c107d9e0af279d1e7056df3c2be', '2013', 'BOX(-176.684744 -14.373765,145.830505 71.341324)', NULL, '4');
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (20, NULL, NULL, '"us.bls".raw_qcew_2013_dd20d99063', 'obs_530081a407e8793b7fef6666ebc46db0fcc9db2c', '2013', 'BOX(0 0,0 0)', NULL, '0');
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (13, NULL, NULL, '"us.census.tiger".sum_level_true_census_tract_2013_6a2cf9dee9', 'obs_d125aeef87aaa23287a40b454519ece22ee25acf', '2013', 'BOX(-179.231086 -14.601813,179.859681 71.441059)', NULL, '4');
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (14, NULL, NULL, '"us.census.tiger".sum_level_true_block_group_2013_5ecb940395', 'obs_d610cb3225f282693b8d4dcd98d2c2e2078354c6', '2013', 'BOX(-179.231086 -14.601813,179.859681 71.441059)', NULL, '4');
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (15, NULL, NULL, '"us.census.acs".extract_state_5yr_2013_c6cc7dd346', 'obs_92bdae84ae8d41fabca52500e4e1f55c394b696e', '2009 - 2013', 'BOX(-179.231086 -14.601813,179.859681 71.441059)', NULL, '1');
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (16, NULL, NULL, '"us.census.acs".extract_puma_5yr_2013_e9f0d7bc6c', 'obs_a875390344c7e36b72a8d6a3d25ae0f2bb41eaee', '2009 - 2013', 'BOX(-179.231086 13.182335,179.859681 71.441059)', NULL, '1');
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (17, NULL, NULL, '"us.census.acs".extract_county_5yr_2013_5d7844896c', 'obs_75edf4ed5271a95f13755e9d06b80740b2fde0ba', '2009 - 2013', 'BOX(-179.231086 -14.601813,179.859681 71.441059)', NULL, '1');
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (18, NULL, NULL, '"us.census.acs".extract_zcta5_5yr_2013_dc39ebe0d5', 'obs_e99034a8fff4654142aed05d887f745a32cedc9f', '2009 - 2013', 'BOX(-176.684744 -14.373765,145.830505 71.341324)', NULL, '1');
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (19, NULL, NULL, '"us.census.acs".extract_census_tract_5yr_2013_a0eee6bf1a', 'obs_ab038198aaab3f3cb055758638ee4de28ad70146', '2009 - 2013', 'BOX(-179.231086 -14.601813,179.859681 71.441059)', NULL, '1');
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (21, NULL, NULL, '"us.bls".naics_99914b932b', 'obs_609c848c80950261032da680294bb1e3ddcf43b6', NULL, 'BOX(0 0,0 0)', NULL, '0');
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (22, NULL, NULL, '"us.bls".simple_qcew_4_2013_94c2fc9ef1', 'obs_4560238b6b0050979ad151becc37c6eecfb7e6ad', '2013Q4', 'BOX(0 0,0 0)', NULL, '1');
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (23, NULL, NULL, '"us.census.lodes".workplace_area_characteristics_2013_dd20d99063', 'obs_5bc83d67ea2863b1712078813a730eee753cf316', '2013', 'BOX(0 0,0 0)', NULL, '0');
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (24, NULL, NULL, '"us.bls".qcew_4_2013_94c2fc9ef1', 'obs_5ed30fab78289e09c30cfd16981b8143ca8fdaa4', '2013Q4', 'BOX(0 0,0 0)', NULL, '1');
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (25, NULL, NULL, '"us.ny.nyc.opendata".acris_legals_99914b932b', 'obs_fd0a697088f5ffcbe4641fb62ad6e2c74eed55d5', '', 'BOX(0 0,0 0)', NULL, '0');
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (26, NULL, NULL, '"us.census.spielman_singleton_segments".create_spielman_singleton_table_99914b932b', 'obs_11ee8b82c877c073438bc935a91d3dfccef875d1', '2009 - 2013', 'BOX(0 0,0 0)', NULL, '3');
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (27, NULL, NULL, '"us.census.acs".quantiles_county_5yr_2013_5d7844896c', 'obs_98cefd377c2ff17a2d60b9a6fe090af629073ec4', '2009 - 2013', 'BOX(0 0,0 0)', NULL, '0');
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (28, NULL, NULL, '"us.census.acs".quantiles_puma_5yr_2013_e9f0d7bc6c', 'obs_032792417d754aa7708d6ba716eb446904f12c46', '2009 - 2013', 'BOX(0 0,0 0)', NULL, '0');
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (29, NULL, NULL, '"us.census.acs".quantiles_state_5yr_2013_c6cc7dd346', 'obs_90e9293f578fab0bf2dabf5e387a57d9a2739a08', '2009 - 2013', 'BOX(0 0,0 0)', NULL, '0');
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (30, NULL, NULL, '"us.census.acs".quantiles_zcta5_5yr_2013_dc39ebe0d5', 'obs_a31255ed256a27d69a9ea777621ad218f6f1f030', '2009 - 2013', 'BOX(0 0,0 0)', NULL, '0');
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (31, NULL, NULL, '"us.census.acs".quantiles_block_group_5yr_2013_69b156927c', 'obs_0932dc0392ca14a6b43e6e131943de9af2ee46b2', '2009 - 2013', 'BOX(0 0,0 0)', NULL, '2');
|
||||
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (1, NULL, NULL, '"us.census.spielman_singleton_segments".spielman_singleton_table_99914b932b', 'obs_65f29658e096ca1485bf683f65fdbc9f05ec3c5d', '2009 - 2013', 'BOX(0 0,0 0)', NULL, 5);
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (2, NULL, NULL, '"us.census.acs".extract_block_group_5yr_2013_69b156927c', 'obs_3e7cc9cfd403b912c57b42d5f9195af9ce2f3cdb', '2009 - 2013', 'BOX(-179.231086 -14.601813,179.859681 71.441059)', NULL, 1);
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (3, NULL, NULL, '"us.census.tiger".sum_level_false_block_group_2013_5c764f39d2', 'obs_85328201013baa14e8e8a4a57a01e6f6fbc5f9b1', '2013', 'BOX(-179.231086 -14.601813,179.859681 71.441059)', NULL, 4);
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (4, NULL, NULL, '"us.census.tiger".sum_level_false_census_tract_2013_c489085a44', 'obs_a92e1111ad3177676471d66bb8036e6d057f271b', '2013', 'BOX(-179.231086 -14.601813,179.859681 71.441059)', NULL, 4);
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (5, NULL, NULL, '"us.ny.nyc.opendata".acris_master_99914b932b', 'obs_811c938d1307530a3db53fc69f11a2499174d224', '1966 - present', 'BOX(0 0,0 0)', NULL, 0);
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (6, NULL, NULL, '"us.census.tiger".sum_level_false_county_2013_66804ade17', 'obs_b0ef6dd68d5faddbf231fd7f02916b3d00ec43c4', '2013', 'BOX(-179.231086 -14.601813,179.859681 71.441059)', NULL, 4);
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (7, NULL, NULL, '"us.census.tiger".sum_level_false_puma_2013_4a11a4ba96', 'obs_0008b162b516c295d7204c9ba043ab5dbc67c59c', '2013', 'BOX(-179.231086 13.182335,179.859681 71.441059)', NULL, 4);
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (8, NULL, NULL, '"us.census.tiger".sum_level_true_state_2013_f1ab8fce27', 'obs_a20f5260b618a2fe2eb95fc1e23febe0db7db096', '2013', 'BOX(-179.231086 -14.601813,179.859681 71.441059)', NULL, 4);
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (9, NULL, NULL, '"us.census.tiger".sum_level_true_county_2013_39133ea7a1', 'obs_23da37d4e66e9de2f525572967f8618bde99a8c0', '2013', 'BOX(-179.231086 -14.601813,179.859681 71.441059)', NULL, 4);
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (10, NULL, NULL, '"us.census.tiger".sum_level_false_zcta5_2013_bf420fa8c1', 'obs_d483723c5cc76c107d9e0af279d1e7056df3c2be', '2013', 'BOX(-176.684744 -14.373765,145.830505 71.341324)', NULL, 4);
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (11, NULL, NULL, '"us.census.tiger".sum_level_true_census_tract_2013_6a2cf9dee9', 'obs_d125aeef87aaa23287a40b454519ece22ee25acf', '2013', 'BOX(-179.231086 -14.601813,179.859681 71.441059)', NULL, 4);
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (12, NULL, NULL, '"us.census.tiger".sum_level_true_block_group_2013_5ecb940395', 'obs_d610cb3225f282693b8d4dcd98d2c2e2078354c6', '2013', 'BOX(-179.231086 -14.601813,179.859681 71.441059)', NULL, 4);
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (13, NULL, NULL, '"us.census.acs".extract_state_5yr_2013_c6cc7dd346', 'obs_92bdae84ae8d41fabca52500e4e1f55c394b696e', '2009 - 2013', 'BOX(-179.231086 -14.601813,179.859681 71.441059)', NULL, 1);
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (14, NULL, NULL, '"us.census.acs".extract_puma_5yr_2013_e9f0d7bc6c', 'obs_a875390344c7e36b72a8d6a3d25ae0f2bb41eaee', '2009 - 2013', 'BOX(-179.231086 13.182335,179.859681 71.441059)', NULL, 1);
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (15, NULL, NULL, '"us.census.acs".extract_county_5yr_2013_5d7844896c', 'obs_75edf4ed5271a95f13755e9d06b80740b2fde0ba', '2009 - 2013', 'BOX(-179.231086 -14.601813,179.859681 71.441059)', NULL, 1);
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (16, NULL, NULL, '"us.census.acs".extract_zcta5_5yr_2013_dc39ebe0d5', 'obs_e99034a8fff4654142aed05d887f745a32cedc9f', '2009 - 2013', 'BOX(-176.684744 -14.373765,145.830505 71.341324)', NULL, 1);
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (17, NULL, NULL, '"us.census.acs".extract_census_tract_5yr_2013_a0eee6bf1a', 'obs_ab038198aaab3f3cb055758638ee4de28ad70146', '2009 - 2013', 'BOX(-179.231086 -14.601813,179.859681 71.441059)', NULL, 1);
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (18, NULL, NULL, '"us.bls".raw_qcew_2013_dd20d99063', 'obs_530081a407e8793b7fef6666ebc46db0fcc9db2c', '2013', 'BOX(0 0,0 0)', NULL, 0);
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (19, NULL, NULL, '"us.bls".naics_99914b932b', 'obs_609c848c80950261032da680294bb1e3ddcf43b6', NULL, 'BOX(0 0,0 0)', NULL, 0);
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (20, NULL, NULL, '"us.bls".simple_qcew_4_2013_94c2fc9ef1', 'obs_4560238b6b0050979ad151becc37c6eecfb7e6ad', '2013Q4', 'BOX(0 0,0 0)', NULL, 1);
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (21, NULL, NULL, '"us.census.lodes".workplace_area_characteristics_2013_dd20d99063', 'obs_5bc83d67ea2863b1712078813a730eee753cf316', '2013', 'BOX(0 0,0 0)', NULL, 0);
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (22, NULL, NULL, '"us.bls".qcew_4_2013_94c2fc9ef1', 'obs_5ed30fab78289e09c30cfd16981b8143ca8fdaa4', '2013Q4', 'BOX(0 0,0 0)', NULL, 1);
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (23, NULL, NULL, '"us.ny.nyc.opendata".acris_legals_99914b932b', 'obs_fd0a697088f5ffcbe4641fb62ad6e2c74eed55d5', '', 'BOX(0 0,0 0)', NULL, 0);
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (24, NULL, NULL, '"us.census.spielman_singleton_segments".create_spielman_singleton_table_99914b932b', 'obs_11ee8b82c877c073438bc935a91d3dfccef875d1', '2009 - 2013', 'BOX(0 0,0 0)', NULL, 3);
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (25, NULL, NULL, '"us.census.acs".quantiles_block_group_5yr_2013_69b156927c', 'obs_0932dc0392ca14a6b43e6e131943de9af2ee46b2', '2009 - 2013', 'BOX(0 0,0 0)', NULL, 5);
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (26, NULL, NULL, '"us.census.acs".quantiles_puma_5yr_2013_e9f0d7bc6c', 'obs_032792417d754aa7708d6ba716eb446904f12c46', '2009 - 2013', 'BOX(0 0,0 0)', NULL, 5);
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (27, NULL, NULL, '"us.census.acs".quantiles_census_tract_5yr_2013_a0eee6bf1a', 'obs_d34555209878e8c4b37cf0b2b3d072ff129ec470', '2009 - 2013', 'BOX(0 0,0 0)', NULL, 5);
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (28, NULL, NULL, '"us.census.tiger".sum_level_false_state_2013_0b919d8984', 'obs_f3f0912fe24bc0c976e837b5a116d0c803cc01ce', '2013', 'BOX(-179.231086 -14.601813,179.859681 71.441059)', NULL, 4);
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (29, NULL, NULL, '"us.census.acs".quantiles_zcta5_5yr_2013_dc39ebe0d5', 'obs_a31255ed256a27d69a9ea777621ad218f6f1f030', '2009 - 2013', 'BOX(0 0,0 0)', NULL, 5);
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (30, NULL, NULL, '"us.census.acs".quantiles_state_5yr_2013_c6cc7dd346', 'obs_90e9293f578fab0bf2dabf5e387a57d9a2739a08', '2009 - 2013', 'BOX(0 0,0 0)', NULL, 5);
|
||||
INSERT INTO obs_table (cartodb_id, the_geom, the_geom_webmercator, id, tablename, timespan, bounds, description, version) VALUES (31, NULL, NULL, '"us.census.acs".quantiles_county_5yr_2013_5d7844896c', 'obs_98cefd377c2ff17a2d60b9a6fe090af629073ec4', '2009 - 2013', 'BOX(0 0,0 0)', NULL, 5);
|
||||
|
||||
CREATE SCHEMA IF NOT EXISTS observatory;
|
||||
ALTER TABLE obs_table SET SCHEMA observatory;
|
||||
ALTER TABLE obs_table SET SCHEMA observatory;
|
||||
Reference in New Issue
Block a user