puts in data_geoid
This commit is contained in:
@@ -525,6 +525,17 @@ BEGIN
|
|||||||
-- TODO we're assuming our geom_table has only one geom_ref column
|
-- 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
|
-- we *really* should pass in both geom_table_name and boundary_id
|
||||||
-- TODO tablename should not be passed here (use 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
|
EXECUTE
|
||||||
format('SELECT ct.colname
|
format('SELECT ct.colname
|
||||||
FROM observatory.obs_column_to_column c2c,
|
FROM observatory.obs_column_to_column c2c,
|
||||||
@@ -537,7 +548,7 @@ BEGIN
|
|||||||
, geom_table_name)
|
, geom_table_name)
|
||||||
INTO geom_geoid_colname;
|
INTO geom_geoid_colname;
|
||||||
|
|
||||||
q_select := format('SELECT %I, ', geom_geoid_colname);
|
q_select := format('SELECT %I, ', data_geoid_colname);
|
||||||
q_sum := 'SELECT Array[';
|
q_sum := 'SELECT Array[';
|
||||||
|
|
||||||
FOR i IN 1..array_upper(data_table_info, 1)
|
FOR i IN 1..array_upper(data_table_info, 1)
|
||||||
@@ -558,7 +569,7 @@ BEGIN
|
|||||||
END IF;
|
END IF;
|
||||||
END LOOP;
|
END LOOP;
|
||||||
|
|
||||||
q = format('
|
q := format('
|
||||||
WITH _overlaps As (
|
WITH _overlaps As (
|
||||||
SELECT ST_Area(
|
SELECT ST_Area(
|
||||||
ST_Intersection($1, a.the_geom)
|
ST_Intersection($1, a.the_geom)
|
||||||
|
|||||||
Reference in New Issue
Block a user