Merge branch 'develop' into default-recent-timespan-weighted-geom
This commit is contained in:
commit
011baaacd5
@ -213,13 +213,25 @@ DECLARE
|
||||
query text;
|
||||
i int;
|
||||
geoid text;
|
||||
geoid_colname text;
|
||||
data_geoid_colname text;
|
||||
geom_geoid_colname text;
|
||||
area NUMERIC;
|
||||
BEGIN
|
||||
|
||||
-- TODO we're assuming our geom_table has only one geom_ref column
|
||||
-- we *really* should pass in both geom_table_name and boundary_id
|
||||
-- TODO tablename should not be passed here (use boundary_id)
|
||||
EXECUTE
|
||||
format('SELECT ct.colname
|
||||
FROM observatory.obs_column_to_column c2c,
|
||||
observatory.obs_column_table ct,
|
||||
observatory.obs_table t
|
||||
WHERE c2c.reltype = ''geom_ref''
|
||||
AND ct.column_id = c2c.source_id
|
||||
AND ct.table_id = t.id
|
||||
AND t.tablename = %L'
|
||||
, (data_table_info)[1]->>'tablename')
|
||||
INTO data_geoid_colname;
|
||||
EXECUTE
|
||||
format('SELECT ct.colname
|
||||
FROM observatory.obs_column_to_column c2c,
|
||||
@ -230,15 +242,13 @@ BEGIN
|
||||
AND ct.table_id = t.id
|
||||
AND t.tablename = %L'
|
||||
, geom_table_name)
|
||||
INTO geoid_colname;
|
||||
RAISE NOTICE 'geom_table_name: %', geom_table_name;
|
||||
RAISE NOTICE 'colname: %', geoid_colname;
|
||||
INTO geom_geoid_colname;
|
||||
|
||||
EXECUTE
|
||||
format('SELECT %I
|
||||
FROM observatory.%I
|
||||
WHERE ST_Within($1, the_geom)',
|
||||
geoid_colname,
|
||||
geom_geoid_colname,
|
||||
geom_table_name)
|
||||
USING geom
|
||||
INTO geoid;
|
||||
@ -250,7 +260,7 @@ BEGIN
|
||||
FROM observatory.%I
|
||||
WHERE %I = %L',
|
||||
geom_table_name,
|
||||
geoid_colname,
|
||||
geom_geoid_colname,
|
||||
geoid)
|
||||
INTO area;
|
||||
|
||||
@ -289,7 +299,7 @@ BEGIN
|
||||
',
|
||||
((data_table_info)[1])->>'tablename',
|
||||
((data_table_info)[1])->>'tablename',
|
||||
geoid_colname,
|
||||
data_geoid_colname,
|
||||
geoid
|
||||
);
|
||||
|
||||
|
@ -34,6 +34,9 @@ t
|
||||
getcategories_at_null_island
|
||||
t
|
||||
(1 row)
|
||||
obs_getmeasure_zhvi_point_test
|
||||
t
|
||||
(1 row)
|
||||
obs_getmeasure_total_pop_point_test
|
||||
t
|
||||
(1 row)
|
||||
|
12
src/pg/test/fixtures/drop_fixtures.sql
vendored
12
src/pg/test/fixtures/drop_fixtures.sql
vendored
@ -6,11 +6,13 @@ DROP TABLE IF EXISTS observatory.obs_column;
|
||||
DROP TABLE IF EXISTS observatory.obs_column_tag;
|
||||
DROP TABLE IF EXISTS observatory.obs_tag;
|
||||
DROP TABLE IF EXISTS observatory.obs_column_to_column;
|
||||
DROP TABLE IF EXISTS observatory.obs_1babf5a26a1ecda5fb74963e88408f71d0364b81;
|
||||
DROP TABLE IF EXISTS observatory.obs_3e7cc9cfd403b912c57b42d5f9195af9ce2f3cdb;
|
||||
DROP TABLE IF EXISTS observatory.obs_ab038198aaab3f3cb055758638ee4de28ad70146;
|
||||
DROP TABLE IF EXISTS observatory.obs_d34555209878e8c4b37cf0b2b3d072ff129ec470;
|
||||
DROP TABLE IF EXISTS observatory.obs_fc050f0b8673cfe3c6aa1040f749eb40975691b7;
|
||||
DROP TABLE IF EXISTS observatory.obs_65f29658e096ca1485bf683f65fdbc9f05ec3c5d;
|
||||
DROP TABLE IF EXISTS observatory.obs_1a098da56badf5f32e336002b0a81708c40d29cd;
|
||||
DROP TABLE IF EXISTS observatory.obs_fc050f0b8673cfe3c6aa1040f749eb40975691b7;
|
||||
DROP TABLE IF EXISTS observatory.obs_1babf5a26a1ecda5fb74963e88408f71d0364b81;
|
||||
DROP TABLE IF EXISTS observatory.obs_3e7cc9cfd403b912c57b42d5f9195af9ce2f3cdb;
|
||||
DROP TABLE IF EXISTS observatory.obs_d34555209878e8c4b37cf0b2b3d072ff129ec470;
|
||||
DROP TABLE IF EXISTS observatory.obs_d39f7fe5959891c8296490d83c22ded31c54af13;
|
||||
DROP TABLE IF EXISTS observatory.obs_144e8b4f906885b2e057ac4842644a553ae49c6e;
|
||||
DROP TABLE IF EXISTS observatory.obs_c6fb99c47d61289fbb8e561ff7773799d3fcc308;
|
||||
DROP TABLE IF EXISTS observatory.obs_ab038198aaab3f3cb055758638ee4de28ad70146;
|
||||
|
23933
src/pg/test/fixtures/load_fixtures.sql
vendored
23933
src/pg/test/fixtures/load_fixtures.sql
vendored
File diff suppressed because one or more lines are too long
@ -133,6 +133,12 @@ WITH result as (
|
||||
select expected[0] is NULL as GetCategories_at_null_island
|
||||
from result;
|
||||
|
||||
-- Point-based OBS_GetMeasure with zillow
|
||||
SELECT abs(OBS_GetMeasure_zhvi_point - 583600) / 583600 < 0.001 AS OBS_GetMeasure_zhvi_point_test FROM cdb_observatory.OBS_GetMeasure(
|
||||
ST_SetSRID(ST_Point( -73.94602417945862, 40.6768220087458), 4326),
|
||||
'us.zillow.AllHomes_Zhvi', 'area', 'us.census.tiger.zcta5', '2014-01'
|
||||
) As t(OBS_GetMeasure_zhvi_point);
|
||||
|
||||
-- Point-based OBS_GetMeasure, default normalization (area)
|
||||
-- is result within 0.1% of expected
|
||||
SELECT abs(OBS_GetMeasure_total_pop_point - 10923.093200390833950) / 10923.093200390833950 < 0.001 As OBS_GetMeasure_total_pop_point_test FROM
|
||||
|
Loading…
Reference in New Issue
Block a user