Skip to content

Commit

Permalink
osm farmyards as mview #311
Browse files Browse the repository at this point in the history
  • Loading branch information
Ludee committed Aug 15, 2018
1 parent fb61c4c commit da7b8c8
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 4 deletions.
4 changes: 2 additions & 2 deletions dataprocessing/sql_snippets/rea/reaosm/ego_dp_reaosm_m1.sql
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ BEGIN
+ row_number() over (ORDER BY area_ha DESC) AS reaosm_sort,
id,
subst_id,
ST_CENTROID(geom) ::geometry(Point,3035)
FROM model_draft.ego_osm_sector_per_griddistrict_4_agricultural
geom
FROM sandbox.ego_osm_sector_per_griddistrict_4_agricultural_mview
WHERE subst_id =' || gd || ';
INSERT INTO sandbox.ego_reaosm_m1_1_jnt_temp
Expand Down
33 changes: 31 additions & 2 deletions dataprocessing/sql_snippets/rea/reaosm/ego_dp_reaosm_setup.sql
Original file line number Diff line number Diff line change
Expand Up @@ -283,13 +283,42 @@ COMMENT ON TABLE sandbox.ego_dp_res_powerplant_reaosm IS '{
"comment": "eGoPP - REA OSM - Temporary Table",
"version": "v0.1" }' ;



-- scenario log (project,version,io,schema_name,table_name,script_name,comment)
SELECT scenario_log('eGo_REAOSM','v0.1','input','supply','ego_dp_res_powerplant','ego_pp_osm_deu_power.sql',' ');
SELECT scenario_log('eGo_REAOSM','v0.1','output','sandbox','ego_dp_res_powerplant_reaosm','ego_pp_osm_deu_power.sql',' ');


-- eGoDP OSM Farmyards
DROP MATERIALIZED VIEW IF EXISTS sandbox.ego_osm_sector_per_griddistrict_4_agricultural_mview CASCADE;
CREATE MATERIALIZED VIEW sandbox.ego_osm_sector_per_griddistrict_4_agricultural_mview AS
SELECT id,
subst_id,
area_ha,
ST_CENTROID(geom) ::geometry(Point,3035) AS geom
FROM model_draft.ego_osm_sector_per_griddistrict_4_agricultural;

-- index (id)
CREATE UNIQUE INDEX ego_osm_sector_per_griddistrict_4_agricultural_mview_idx
ON sandbox.ego_osm_sector_per_griddistrict_4_agricultural_mview (id);

-- index GIST (geom)
CREATE INDEX ego_osm_sector_per_griddistrict_4_agricultural_mview_geom_idx
ON sandbox.ego_osm_sector_per_griddistrict_4_agricultural_mview
USING GIST (geom);

-- grant (oeuser)
ALTER TABLE sandbox.ego_osm_sector_per_griddistrict_4_agricultural_mview OWNER TO oeuser;

-- metadata
COMMENT ON MATERIALIZED VIEW sandbox.ego_osm_sector_per_griddistrict_4_agricultural_mview IS '{
"comment": "eGoPP - REA OSM - Temporary Table",
"version": "v0.1" }' ;

-- scenario log (project,version,io,schema_name,table_name,script_name,comment)
SELECT scenario_log('eGo_REAOSM','v0.1','input','model_draft','ego_osm_sector_per_griddistrict_4_agricultural','ego_pp_osm_deu_power.sql',' ');
SELECT scenario_log('eGo_REAOSM','v0.1','output','sandbox','ego_osm_sector_per_griddistrict_4_agricultural_mview','ego_pp_osm_deu_power.sql',' ');





Expand Down

0 comments on commit da7b8c8

Please sign in to comment.