diff --git a/preprocessing/sql_snippets/openstreetmap/ego_pp_osm_deu_power.sql b/preprocessing/sql_snippets/openstreetmap/ego_pp_osm_deu_power.sql index 625536a5..daaee6ab 100644 --- a/preprocessing/sql_snippets/openstreetmap/ego_pp_osm_deu_power.sql +++ b/preprocessing/sql_snippets/openstreetmap/ego_pp_osm_deu_power.sql @@ -116,7 +116,6 @@ INSERT INTO sandbox.ego_pp_osm_deu_power_point_reaosm (osm_id, rea_method, geom) WHERE generator_source = 'biogas' OR generator_source = 'biomass' ORDER BY osm_id; - -- insert M2 INSERT INTO sandbox.ego_pp_osm_deu_power_point_reaosm (osm_id, rea_method, geom) SELECT osm_id, @@ -126,6 +125,16 @@ INSERT INTO sandbox.ego_pp_osm_deu_power_point_reaosm (osm_id, rea_method, geom) WHERE generator_source = 'wind' ORDER BY osm_id; +-- insert M5 +INSERT INTO sandbox.ego_pp_osm_deu_power_point_reaosm (osm_id, rea_method, geom) + SELECT osm_id, + 'M5', + geom + FROM sandbox.ego_pp_osm_deu_power_point_mview + WHERE generator_source = 'solar' + ORDER BY osm_id; + + /* -- insert M3 INSERT INTO sandbox.ego_pp_osm_deu_power_point_reaosm (osm_id, rea_method, geom) @@ -156,49 +165,74 @@ INSERT INTO sandbox.ego_pp_osm_deu_power_point_reaosm (osm_id, rea_method, geom) */ --- extract solar from oedb osm -DROP MATERIALIZED VIEW IF EXISTS openstreetmap.osm_deu_point_solar_mview CASCADE; -CREATE MATERIALIZED VIEW openstreetmap.osm_deu_point_solar_mview AS +-- extract wind from oedb osm +DROP MATERIALIZED VIEW IF EXISTS openstreetmap.osm_deu_point_wind_mview CASCADE; +CREATE MATERIALIZED VIEW openstreetmap.osm_deu_point_wind_mview AS SELECT osm_id, gid, tags, ST_TRANSFORM(geom, 3035) ::geometry(Point,3035) AS geom FROM openstreetmap.osm_deu_point - WHERE tags @> '"generator:source"=>"solar"' ::hstore; + WHERE tags @> '"generator:source"=>"wind"'::hstore; -- index GIST (geom) -CREATE INDEX osm_deu_point_solar_mview_geom_idx - ON openstreetmap.osm_deu_point_solar_mview +CREATE INDEX osm_deu_point_wind_mview_geom_idx + ON openstreetmap.osm_deu_point_wind_mview USING GIST (geom); -- grant (oeuser) -ALTER TABLE openstreetmap.osm_deu_point_solar_mview OWNER TO oeuser; +ALTER TABLE openstreetmap.osm_deu_point_wind_mview OWNER TO oeuser; -- metadata -COMMENT ON MATERIALIZED VIEW openstreetmap.osm_deu_point_solar_mview IS '{ +COMMENT ON MATERIALIZED VIEW openstreetmap.osm_deu_point_wind_mview IS '{ "comment": "eGoPP - REA OSM - Temporary Table", "version": "v0.4.2" }' ; --- extract wind from oedb osm -DROP MATERIALIZED VIEW IF EXISTS openstreetmap.osm_deu_point_wind_mview CASCADE; -CREATE MATERIALIZED VIEW openstreetmap.osm_deu_point_wind_mview AS +-- extract biomass from oedb osm +DROP MATERIALIZED VIEW IF EXISTS openstreetmap.osm_deu_point_biogas_mview CASCADE; +CREATE MATERIALIZED VIEW openstreetmap.osm_deu_point_biogas_mview AS SELECT osm_id, gid, tags, ST_TRANSFORM(geom, 3035) ::geometry(Point,3035) AS geom FROM openstreetmap.osm_deu_point - WHERE tags @> '"generator:source"=>"wind"'::hstore; + WHERE tags @> '"generator:source"=>"biogas"' ::hstore + OR tags @> '"generator:source"=>"biomass"' ::hstore ; -- index GIST (geom) -CREATE INDEX osm_deu_point_wind_mview_geom_idx - ON openstreetmap.osm_deu_point_wind_mview +CREATE INDEX osm_deu_point_biogas_mview_geom_idx + ON openstreetmap.osm_deu_point_biogas_mview USING GIST (geom); -- grant (oeuser) -ALTER TABLE openstreetmap.osm_deu_point_wind_mview OWNER TO oeuser; +ALTER TABLE openstreetmap.osm_deu_point_biogas_mview OWNER TO oeuser; -- metadata -COMMENT ON MATERIALIZED VIEW openstreetmap.osm_deu_point_wind_mview IS '{ +COMMENT ON MATERIALIZED VIEW openstreetmap.osm_deu_point_biogas_mview IS '{ + "comment": "eGoPP - REA OSM - Temporary Table", + "version": "v0.4.2" }' ; + + +-- extract solar from oedb osm +DROP MATERIALIZED VIEW IF EXISTS openstreetmap.osm_deu_point_solar_mview CASCADE; +CREATE MATERIALIZED VIEW openstreetmap.osm_deu_point_solar_mview AS + SELECT osm_id, + gid, + tags, + ST_TRANSFORM(geom, 3035) ::geometry(Point,3035) AS geom + FROM openstreetmap.osm_deu_point + WHERE tags @> '"generator:source"=>"solar"' ::hstore; + +-- index GIST (geom) +CREATE INDEX osm_deu_point_solar_mview_geom_idx + ON openstreetmap.osm_deu_point_solar_mview + USING GIST (geom); + +-- grant (oeuser) +ALTER TABLE openstreetmap.osm_deu_point_solar_mview OWNER TO oeuser; + +-- metadata +COMMENT ON MATERIALIZED VIEW openstreetmap.osm_deu_point_solar_mview IS '{ "comment": "eGoPP - REA OSM - Temporary Table", "version": "v0.4.2" }' ;