Skip to content

Commit

Permalink
Merge pull request #142 from QGEP/fix_swmm_geometries
Browse files Browse the repository at this point in the history
Fix geometry types for swmm views
  • Loading branch information
m-kuhn authored Jun 23, 2020
2 parents fb6e5b8 + e31f44c commit 29664c1
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 25 deletions.
20 changes: 0 additions & 20 deletions scripts/db_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -93,23 +93,3 @@ pum baseline -p ${PGSERVICE} -t qgep_sys.pum_info -d ${DIR}/delta/ -b ${VERSION}


psql "service=${PGSERVICE}" -v ON_ERROR_STOP=1 -v SRID=$SRID -f ${DIR}/14_geometry_functions.sql

## SWMM Views

psql "service=${PGSERVICE}" -v ON_ERROR_STOP=1 -v SRID=$SRID -f ${DIR}/swmm_views/01_vw_swmm_create_schema.sql
psql "service=${PGSERVICE}" -v ON_ERROR_STOP=1 -v SRID=$SRID -f ${DIR}/swmm_views/02_vw_swmm_junctions.sql
psql "service=${PGSERVICE}" -v ON_ERROR_STOP=1 -v SRID=$SRID -f ${DIR}/swmm_views/03_vw_swmm_aquifers.sql
psql "service=${PGSERVICE}" -v ON_ERROR_STOP=1 -v SRID=$SRID -f ${DIR}/swmm_views/04_vw_swmm_conduits.sql
psql "service=${PGSERVICE}" -v ON_ERROR_STOP=1 -v SRID=$SRID -f ${DIR}/swmm_views/05_vw_swmm_dividers.sql
psql "service=${PGSERVICE}" -v ON_ERROR_STOP=1 -v SRID=$SRID -f ${DIR}/swmm_views/06_vw_swmm_landuses.sql
psql "service=${PGSERVICE}" -v ON_ERROR_STOP=1 -v SRID=$SRID -f ${DIR}/swmm_views/07_vw_swmm_losses.sql
psql "service=${PGSERVICE}" -v ON_ERROR_STOP=1 -v SRID=$SRID -f ${DIR}/swmm_views/08_vw_swmm_outfalls.sql
psql "service=${PGSERVICE}" -v ON_ERROR_STOP=1 -v SRID=$SRID -f ${DIR}/swmm_views/09_vw_swmm_subcatchments.sql
psql "service=${PGSERVICE}" -v ON_ERROR_STOP=1 -v SRID=$SRID -f ${DIR}/swmm_views/10_vw_swmm_vertices.sql
psql "service=${PGSERVICE}" -v ON_ERROR_STOP=1 -v SRID=$SRID -f ${DIR}/swmm_views/11_vw_swmm_pumps.sql
psql "service=${PGSERVICE}" -v ON_ERROR_STOP=1 -v SRID=$SRID -f ${DIR}/swmm_views/12_vw_swmm_polygons.sql
psql "service=${PGSERVICE}" -v ON_ERROR_STOP=1 -v SRID=$SRID -f ${DIR}/swmm_views/13_vw_swmm_storages.sql
psql "service=${PGSERVICE}" -v ON_ERROR_STOP=1 -v SRID=$SRID -f ${DIR}/swmm_views/14_vw_swmm_xsections.sql
psql "service=${PGSERVICE}" -v ON_ERROR_STOP=1 -v SRID=$SRID -f ${DIR}/swmm_views/15_vw_swmm_coordinates.sql
psql "service=${PGSERVICE}" -v ON_ERROR_STOP=1 -v SRID=$SRID -f ${DIR}/swmm_views/16_vw_swmm_tags.sql

2 changes: 1 addition & 1 deletion swmm_views/04_vw_swmm_conduits.sql
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ SELECT
0 as MaxFlow,
ne.identifier || ', ' || ne.remark as description,
ne.fk_wastewater_structure as tag,
ST_Simplify(ST_CurveToLine(progression_geometry), 20, TRUE) as geom
ST_Simplify(ST_CurveToLine(progression_geometry), 20, TRUE)::geometry(LineString, %(SRID)s) as geom
FROM qgep_od.reach as re
LEFT JOIN qgep_od.wastewater_networkelement ne ON ne.obj_id::text = re.obj_id::text

Expand Down
6 changes: 3 additions & 3 deletions swmm_views/09_vw_swmm_subcatchments.sql
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ SELECT
NULL::varchar as SnowPack, -- default value
ca.identifier || ', ' || ca.remark as description,
ca.obj_id as tag,
ST_Simplify(ST_CurveToLine(perimeter_geometry), 5, TRUE) as geom
ST_Simplify(ST_CurveToLine(perimeter_geometry), 5, TRUE)::geometry(LineString, %(SRID)s) as geom
FROM qgep_od.catchment_area as ca
LEFT JOIN qgep_od.wastewater_networkelement we on we.obj_id = ca.fk_wastewater_networkelement_rw_current
LEFT JOIN qgep_od.wastewater_node wn on wn.obj_id = we.obj_id
Expand Down Expand Up @@ -86,7 +86,7 @@ SELECT
'0:15'::varchar as Interval,
'1.0'::varchar as SCF,
'TIMESERIES default_qgep_raingage_timeserie'::varchar as Source,
st_centroid(perimeter_geometry) as geom
st_centroid(perimeter_geometry)::geometry(Point, %(SRID)s) as geom
FROM qgep_od.catchment_area as ca
WHERE fk_wastewater_networkelement_rw_current IS NOT NULL; -- to avoid unconnected catchments

Expand Down Expand Up @@ -115,4 +115,4 @@ FROM qgep_od.catchment_area ca, qgep_od.planning_zone pz
LEFT JOIN qgep_vl.planning_zone_kind pzk on pz.kind = pzk.code
WHERE st_intersects(ca.perimeter_geometry, pz.perimeter_geometry)
AND st_isvalid(ca.perimeter_geometry) AND st_isvalid(pz.perimeter_geometry)
ORDER BY ca.obj_id, percent DESC;
ORDER BY ca.obj_id, percent DESC;
2 changes: 1 addition & 1 deletion view/drop_views.sql
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ DROP VIEW IF EXISTS qgep_od.vw_file;
DROP VIEW IF EXISTS qgep_od.vw_change_points;
DROP VIEW IF EXISTS qgep_od.vw_catchment_area_connections;

-- qgep_wmm views
-- qgep_swmm views
DROP VIEW IF EXISTS qgep_swmm.vw_aquifers CASCADE;
DROP VIEW IF EXISTS qgep_swmm.vw_conduits CASCADE;
DROP VIEW IF EXISTS qgep_swmm.vw_coordinates CASCADE;
Expand Down

0 comments on commit 29664c1

Please sign in to comment.