use data_geoid_colname for data, geom_geoid_colname for geom
This commit is contained in:
parent
56f4d2f256
commit
aab24d00dd
@ -213,12 +213,24 @@ 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
|
||||
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,
|
||||
@ -229,15 +241,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;
|
||||
@ -249,7 +259,7 @@ BEGIN
|
||||
FROM observatory.%I
|
||||
WHERE %I = %L',
|
||||
geom_table_name,
|
||||
geoid_colname,
|
||||
geom_geoid_colname,
|
||||
geoid)
|
||||
INTO area;
|
||||
|
||||
@ -288,7 +298,7 @@ BEGIN
|
||||
',
|
||||
((data_table_info)[1])->>'tablename',
|
||||
((data_table_info)[1])->>'tablename',
|
||||
geoid_colname,
|
||||
data_geoid_colname,
|
||||
geoid
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user