removing geoid from obs_getpolygons
This commit is contained in:
@@ -518,8 +518,25 @@ DECLARE
|
||||
q_sum text;
|
||||
q text;
|
||||
i NUMERIC;
|
||||
data_geoid_colname text;
|
||||
geom_geoid_colname text;
|
||||
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'
|
||||
, geom_table_name)
|
||||
INTO geom_geoid_colname;
|
||||
|
||||
q_select := 'SELECT geoid, ';
|
||||
q_sum := 'SELECT Array[';
|
||||
|
||||
@@ -555,8 +572,8 @@ BEGIN
|
||||
|
||||
q := q || q_select || format('FROM observatory.%I ', ((data_table_info)[1]->>'tablename'));
|
||||
|
||||
q := q || ' ) ' || q_sum || ' ]::numeric[] FROM _overlaps, values
|
||||
WHERE values.geoid = _overlaps.geoid';
|
||||
q := format(q || ' ) ' || q_sum || ' ]::numeric[] FROM _overlaps, values
|
||||
WHERE values.%I = _overlaps.%I', geom_geoid_colname, geom_geoid_colname);
|
||||
|
||||
EXECUTE
|
||||
q
|
||||
|
||||
Reference in New Issue
Block a user