sascha@1046: sascha@1046: sascha@1046: rrenkert@5015: rrenkert@5015: Statement to load data from wsts. rrenkert@5015: rrenkert@5015: felix@4894: felix@4894: SELECT wst_columns.id AS prot_column_id, felix@4894: wst_columns.name AS prot_column_name, felix@4894: wst_columns.position AS prot_rel_pos, felix@4895: wst_columns.description AS info, felix@4895: wst_ranges.a AS deffrom, felix@4895: wst_ranges.b AS defto felix@4895: FROM wst_columns, wst_ranges rrenkert@5015: WHERE wst_columns.wst_id = ${prot_id} rrenkert@5015: AND wst_ranges.wst_column_id = wst_columns.id rrenkert@5015: AND (${fromkm} BETWEEN wst_ranges.a AND wst_ranges.b rrenkert@5015: OR ${tokm} BETWEEN wst_ranges.a AND wst_ranges.b rrenkert@5015: OR wst_ranges.a BETWEEN ${fromkm} AND ${tokm} rrenkert@5015: OR wst_ranges.b BETWEEN ${fromkm} AND ${tokm}) felix@4894: ORDER by wst_columns.position felix@4894: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: Load user specific distance information from artifact. rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: SELECT COALESCE(ld_mode, '') AS ldm, rrenkert@5015: COALESCE(ld_locations, '') AS ldl, rrenkert@5015: COALESCE(ld_from, '') AS ldf, rrenkert@5015: COALESCE(ld_to, '') AS ldt rrenkert@5015: FROM master_artifacts_range rrenkert@5015: WHERE gid = CAST(${artifact-id} as uuid) rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: System part. Load data for the given river. rrenkert@5015: ingo@1181: ingo@1181: ingo@1181: ingo@1181: SELECT id AS river_id, name as river_name FROM rivers ingo@1181: WHERE lower(name) LIKE lower(${river}) ingo@1181: ingo@1181: rrenkert@5015: felix@1790: rrenkert@5015: Base-data macros (mostly data imported from wst-files). felix@1790: felix@1790: rrenkert@5015: felix@1790: felix@1790: rrenkert@5015: felix@1790: felix@1790: SELECT id AS prot_id, felix@1790: description AS prot_description felix@1790: FROM wsts WHERE kind = 0 AND river_id = ${river_id} felix@1790: felix@1790: felix@1790: felix@1790: felix@1790: felix@4894: felix@1790: felix@1790: felix@1790: felix@1790: felix@1790: felix@4895: felix@1790: felix@1790: felix@1790: felix@1790: felix@1790: felix@1790: felix@1790: rrenkert@5015: felix@1790: rrenkert@5015: felix@1916: rrenkert@5015: felix@1916: felix@1916: rrenkert@5015: felix@1916: felix@1916: SELECT id AS prot_id, felix@1916: description AS prot_description felix@1916: FROM wsts WHERE kind = 0 AND river_id = ${river_id} felix@1916: felix@1916: felix@1916: felix@1916: felix@1916: felix@4894: felix@1916: felix@1916: felix@1916: felix@1916: felix@1916: felix@4895: felix@1916: felix@1916: felix@1916: felix@1916: felix@1916: felix@1916: felix@1916: rrenkert@5015: felix@1916: felix@1916: felix@4143: rrenkert@5015: felix@4143: felix@4143: rrenkert@5015: felix@4143: felix@4143: SELECT id AS prot_id, felix@4143: description AS prot_description felix@4143: FROM wsts WHERE kind = 1 AND river_id = ${river_id} felix@4143: felix@4143: felix@4143: felix@4143: felix@4143: felix@4894: felix@4143: felix@4143: felix@4143: felix@4143: felix@4143: felix@4895: felix@4143: felix@4143: felix@4143: felix@4143: felix@4143: felix@4143: felix@4143: rrenkert@5015: felix@4143: felix@4143: felix@1790: rrenkert@5015: felix@1790: felix@2085: rrenkert@5015: felix@1790: felix@1790: SELECT id AS prot_id, felix@1790: description AS prot_description felix@1790: FROM wsts WHERE kind = 1 AND river_id = ${river_id} felix@1790: felix@1790: felix@1790: felix@1790: felix@1790: felix@4894: felix@1790: felix@1790: felix@1790: felix@1790: felix@1790: felix@4895: felix@1790: felix@1790: felix@1790: felix@1790: felix@1790: felix@1790: felix@2085: rrenkert@5015: felix@1790: felix@1764: felix@2761: rrenkert@5015: felix@2761: felix@2761: rrenkert@5015: felix@1728: felix@1728: SELECT id AS prot_id, felix@1728: description AS prot_description felix@1731: FROM wsts WHERE kind = 1 AND river_id = ${river_id} felix@1731: felix@1731: felix@2761: felix@2761: felix@2761: felix@4894: felix@2761: felix@2761: felix@2761: felix@2761: felix@2761: felix@4895: felix@2761: felix@2761: felix@2761: felix@2761: felix@1731: felix@1731: felix@2761: rrenkert@5015: felix@2761: felix@2761: felix@1905: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: SELECT id AS prot_id, rrenkert@5015: description AS prot_description rrenkert@5015: FROM wsts WHERE kind = 2 AND river_id = ${river_id} rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: felix@1905: felix@1905: felix@1905: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: SELECT id AS prot_id, rrenkert@5015: description AS prot_description rrenkert@5015: FROM wsts WHERE kind = 2 AND river_id = ${river_id} rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: felix@1905: felix@1905: felix@1872: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: SELECT id AS prot_id, rrenkert@5015: description AS prot_description rrenkert@5015: FROM wsts WHERE kind = 2 AND river_id = ${river_id} rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: felix@1872: felix@1872: felix@2749: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: SELECT id AS prot_id, rrenkert@5015: description AS prot_description rrenkert@5015: FROM wsts WHERE kind = 2 AND river_id = ${river_id} rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: felix@2749: felix@2751: felix@3283: rrenkert@5015: felix@3283: felix@3283: rrenkert@5015: felix@3283: felix@3283: SELECT id AS prot_id, felix@3283: description AS prot_description felix@3283: FROM wsts WHERE kind = 3 AND river_id = ${river_id} felix@3283: felix@3283: felix@3283: felix@3283: felix@3283: felix@4894: felix@3283: felix@3283: felix@3283: felix@3283: felix@4124: felix@4895: felix@3283: felix@3283: felix@3283: felix@3283: felix@3283: felix@3283: felix@3283: rrenkert@5015: felix@3283: felix@3283: felix@2751: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: SELECT id AS prot_id, rrenkert@5015: description AS prot_description rrenkert@5015: FROM wsts WHERE kind = 4 AND river_id = ${river_id} rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: felix@2751: felix@2751: felix@1869: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: SELECT id AS prot_id, rrenkert@5015: description AS prot_description rrenkert@5015: FROM wsts WHERE kind = 4 AND river_id = ${river_id} rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: felix@1869: felix@1978: felix@1916: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: SELECT id AS prot_id, rrenkert@5015: description AS prot_description rrenkert@5015: FROM wsts WHERE kind = 4 AND river_id = ${river_id} rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: felix@1916: felix@1869: felix@2751: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: SELECT id AS prot_id, rrenkert@5015: description AS prot_description rrenkert@5015: FROM wsts WHERE kind = 5 AND river_id = ${river_id} rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: SELECT id AS prot_id, rrenkert@5015: description AS prot_description rrenkert@5015: FROM wsts WHERE kind = 5 AND river_id = ${river_id} rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: felix@2751: felix@4894: felix@2751: felix@2751: felix@2751: felix@2751: felix@2751: felix@4895: felix@2751: felix@2751: felix@2751: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: felix@1905: felix@1905: felix@1851: felix@1851: felix@1851: felix@1851: felix@1851: felix@4126: felix@4126: felix@4126: felix@4126: felix@4126: felix@4126: felix@4126: felix@4126: felix@1851: felix@1865: felix@3574: felix@3574: felix@3574: felix@3574: felix@3574: felix@3574: felix@3574: felix@1865: felix@1865: felix@1865: felix@1865: felix@1865: felix@1865: felix@1865: felix@4014: felix@4014: felix@4014: felix@4122: felix@4125: felix@4122: felix@4122: felix@4122: felix@4014: felix@4014: SELECT id AS anno_id, felix@4014: name AS anno_description felix@4014: FROM annotation_types felix@4014: felix@4014: felix@4014: felix@4014: felix@4014: felix@4014: felix@4014: felix@4014: felix@4014: felix@4014: felix@4014: felix@4014: felix@1978: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5164: SELECT DISTINCT rrenkert@5015: cs.id AS prot_id, rrenkert@5015: cs.description AS prot_description rrenkert@5015: FROM cross_sections cs rrenkert@5015: JOIN cross_section_lines csl ON csl.cross_section_id = cs.id rrenkert@5015: WHERE cs.river_id = ${river_id} rrenkert@5015: AND csl.km BETWEEN ${fromkm} AND ${tokm} rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: felix@1978: felix@1978: felix@2140: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5164: SELECT DISTINCT rrenkert@5015: h.id AS hyk_id, rrenkert@5015: h.description AS hyk_description rrenkert@5015: FROM hyks h rrenkert@5015: JOIN hyk_entries he ON he.hyk_id = h.id rrenkert@5015: WHERE river_id = ${river_id} rrenkert@5015: AND he.km BETWEEN ${fromkm} AND ${tokm} rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: felix@2140: felix@1869: felix@4455: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: SELECT id AS fvmid, rrenkert@5015: description AS fvmd rrenkert@5015: FROM flow_velocity_measurements WHERE river_id = ${river_id} rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: SELECT id, description, station, datetime, v, w, q rrenkert@5015: FROM flow_velocity_measure_values rrenkert@5015: WHERE measurements_id = ${fvmid} rrenkert@5015: AND station BETWEEN ${fromkm} AND ${tokm} rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: felix@4455: felix@4455: felix@4455: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: SELECT id AS bedh_id, rrenkert@5015: year AS bedh_year, rrenkert@5015: description AS bedh_descr rrenkert@5015: FROM bed_height_single WHERE river_id = ${river_id} rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: felix@4455: felix@4455: felix@4595: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: felix@4595: felix@4595: felix@1869: felix@1869: + River-Node felix@1869: aheinecke@5405: felix@1865: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: Recommendations (client shall load immediately). aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: Non - Recommendations. aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: felix@4123: felix@4123: felix@4123: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: MINFO bedheight middle aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: felix@1872: felix@1764: aheinecke@5405: felix@1905: aheinecke@5405: aheinecke@5405: felix@3585: aheinecke@5405: aheinecke@5405: teichmann@5328: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: rrenkert@5312: rrenkert@5312: aheinecke@5405: SELECT id AS gauge_id, aheinecke@5405: name AS gauge_name aheinecke@5405: FROM gauges WHERE river_id = ${river_id} rrenkert@5312: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: SELECT id AS gauge_id, aheinecke@5405: name AS gauge_name aheinecke@5405: FROM gauges WHERE river_id = ${river_id} aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: FIXME: Following two macros look identical to me. aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: SELECT d.id AS dem_id, aheinecke@5405: r.a AS dem_lower, aheinecke@5405: r.b AS dem_upper, aheinecke@5405: d.name AS name, aheinecke@5405: d.projection || ' | ' || t.start_time || ' - ' || t.stop_time AS info aheinecke@5405: FROM dem d aheinecke@5405: JOIN ranges r ON d.range_id = r.id aheinecke@5405: JOIN time_intervals t ON d.time_interval_id = t.id aheinecke@5405: WHERE d.river_id = ${river_id} aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: SELECT DISTINCT aheinecke@5405: name AS hws_name, aheinecke@5405: official AS hws_official, aheinecke@5405: kind_id AS hws_kind aheinecke@5405: FROM hws_lines aheinecke@5405: WHERE river_id = ${river_id} aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: rrenkert@5312: rrenkert@5312: rrenkert@5312: rrenkert@5312: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: rrenkert@5312: rrenkert@5312: aheinecke@5405: rrenkert@5312: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: SELECT DISTINCT aheinecke@5405: name AS hws_points_name, aheinecke@5405: official AS hws_points_official, aheinecke@5405: kind_id AS hws_points_kind aheinecke@5405: FROM hws_points aheinecke@5405: WHERE river_id = ${river_id} aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: SELECT count(*) as km_exists aheinecke@5405: FROM river_axes_km WHERE river_id = ${river_id} aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5474: aheinecke@5405: aheinecke@5405: aheinecke@5474: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5466: Grab only the actual first aheinecke@5405: aheinecke@5466: SELECT DISTINCT aheinecke@5466: cs.kind_id as kind_id, aheinecke@5466: ck.name as kind_name aheinecke@5466: FROM cross_section_tracks cs aheinecke@5466: JOIN cross_section_track_kinds ck on cs.kind_id = ck.id aheinecke@5466: WHERE river_id = ${river_id} aheinecke@5466: AND kind_id=1 aheinecke@5405: aheinecke@5466: aheinecke@5466: aheinecke@5466: aheinecke@5466: aheinecke@5405: aheinecke@5466: aheinecke@5466: aheinecke@5466: aheinecke@5466: aheinecke@5466: aheinecke@5466: aheinecke@5466: Now the other tracks aheinecke@5466: aheinecke@5466: SELECT DISTINCT aheinecke@5466: cs.kind_id as kind_id, aheinecke@5466: ck.name as kind_name, aheinecke@5466: cs.name as layer_name aheinecke@5466: FROM cross_section_tracks cs aheinecke@5466: JOIN cross_section_track_kinds ck on cs.kind_id = ck.id aheinecke@5466: WHERE river_id = ${river_id} aheinecke@5466: AND kind_id=0 aheinecke@5466: aheinecke@5466: aheinecke@5466: aheinecke@5466: aheinecke@5466: aheinecke@5466: aheinecke@5466: aheinecke@5466: aheinecke@5466: aheinecke@5466: aheinecke@5466: aheinecke@5466: aheinecke@5405: aheinecke@5405: aheinecke@5477: aheinecke@5477: aheinecke@5477: aheinecke@5477: SELECT DISTINCT aheinecke@5477: ax.kind_id as kind_id, aheinecke@5477: ak.name as kind_name aheinecke@5477: FROM river_axes ax aheinecke@5477: JOIN axis_kinds ak on ax.kind_id = ak.id aheinecke@5477: WHERE river_id = ${river_id} aheinecke@5477: AND kind_id=1 aheinecke@5477: aheinecke@5477: aheinecke@5477: aheinecke@5477: aheinecke@5477: aheinecke@5477: aheinecke@5477: aheinecke@5477: aheinecke@5477: aheinecke@5477: aheinecke@5477: aheinecke@5477: aheinecke@5477: SELECT DISTINCT aheinecke@5477: ak.name as kind_name, aheinecke@5477: ax.kind_id as kind_id, aheinecke@5477: ax.name as layer_name aheinecke@5477: FROM river_axes ax aheinecke@5477: JOIN axis_kinds ak on ax.kind_id = ak.id aheinecke@5477: WHERE river_id = ${river_id} aheinecke@5477: AND kind_id <> 1 aheinecke@5477: aheinecke@5477: aheinecke@5477: aheinecke@5477: aheinecke@5477: aheinecke@5477: aheinecke@5477: aheinecke@5477: aheinecke@5477: aheinecke@5477: aheinecke@5477: aheinecke@5477: aheinecke@5477: aheinecke@5515: aheinecke@5515: aheinecke@5515: aheinecke@5515: SELECT DISTINCT aheinecke@5515: name aheinecke@5515: FROM hydr_boundaries aheinecke@5515: WHERE river_id = ${river_id} aheinecke@5515: AND kind = 2 aheinecke@5515: aheinecke@5515: aheinecke@5515: aheinecke@5515: aheinecke@5515: aheinecke@5515: aheinecke@5515: aheinecke@5515: SELECT DISTINCT aheinecke@5515: name aheinecke@5515: FROM hydr_boundaries_poly aheinecke@5515: WHERE river_id = ${river_id} aheinecke@5515: AND kind = 2 aheinecke@5515: aheinecke@5515: aheinecke@5515: aheinecke@5515: aheinecke@5515: aheinecke@5405: aheinecke@5405: aheinecke@5515: aheinecke@5515: aheinecke@5515: SELECT DISTINCT aheinecke@5515: name aheinecke@5515: FROM hydr_boundaries aheinecke@5515: WHERE river_id = ${river_id} aheinecke@5515: AND kind = 1 aheinecke@5515: aheinecke@5515: What about all other line kinds? aheinecke@5515: aheinecke@5515: aheinecke@5515: aheinecke@5515: aheinecke@5515: aheinecke@5515: aheinecke@5515: aheinecke@5515: aheinecke@5364: aheinecke@5405: aheinecke@5515: aheinecke@5515: aheinecke@5515: SELECT DISTINCT aheinecke@5515: b.sectie AS sectie_id, aheinecke@5515: sk.name AS sectie aheinecke@5515: FROM hydr_boundaries_poly b aheinecke@5515: JOIN sectie_kinds sk ON b.sectie = sk.id aheinecke@5515: WHERE b.river_id = ${river_id} aheinecke@5515: AND b.kind = 1 aheinecke@5515: aheinecke@5515: aheinecke@5515: aheinecke@5515: aheinecke@5515: aheinecke@5515: aheinecke@5515: aheinecke@5515: aheinecke@5515: aheinecke@5515: aheinecke@5515: aheinecke@5515: SELECT DISTINCT aheinecke@5515: b.sobek AS sobek_id, aheinecke@5515: sk.name AS sobek aheinecke@5515: FROM hydr_boundaries_poly b aheinecke@5515: JOIN sobek_kinds sk ON b.sobek = sk.id aheinecke@5515: WHERE b.river_id = ${river_id} aheinecke@5515: AND b.kind = 1 aheinecke@5515: aheinecke@5515: aheinecke@5515: aheinecke@5515: aheinecke@5515: aheinecke@5515: aheinecke@5515: aheinecke@5515: aheinecke@5515: aheinecke@5515: aheinecke@5515: aheinecke@5515: aheinecke@5515: aheinecke@5515: aheinecke@5515: aheinecke@5515: aheinecke@5515: aheinecke@5515: aheinecke@5515: aheinecke@5515: aheinecke@5364: aheinecke@5405: aheinecke@5404: aheinecke@5404: aheinecke@5496: SELECT DISTINCT aheinecke@5496: fp.kind_id as kind_id, aheinecke@5496: flk.name as kind_name aheinecke@5496: FROM floodplain fp aheinecke@5496: JOIN floodplain_kinds flk on fp.kind_id = flk.id aheinecke@5496: WHERE river_id = ${river_id} aheinecke@5496: AND kind_id=1 aheinecke@5404: aheinecke@5496: aheinecke@5496: aheinecke@5496: aheinecke@5496: aheinecke@5496: aheinecke@5496: aheinecke@5496: aheinecke@5496: aheinecke@5496: SELECT DISTINCT aheinecke@5496: flk.name as kind_name, aheinecke@5496: fp.kind_id as kind_id, aheinecke@5496: fp.name as layer_name aheinecke@5496: FROM floodplain fp aheinecke@5496: JOIN floodplain_kinds flk on fp.kind_id = flk.id aheinecke@5496: WHERE river_id = ${river_id} aheinecke@5496: AND kind_id <> 1 aheinecke@5496: aheinecke@5496: aheinecke@5496: aheinecke@5496: aheinecke@5496: aheinecke@5496: aheinecke@5496: aheinecke@5496: aheinecke@5404: aheinecke@5404: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: Call from a context where fed_name hws_kind hws_name and river_id is aheinecke@5405: availble aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: SELECT DISTINCT aheinecke@5405: fs.name AS fed_name, aheinecke@5405: fs.id AS fed_id aheinecke@5405: FROM hws_lines hws aheinecke@5405: JOIN fed_states fs ON hws.fed_state_id = fs.id aheinecke@5405: WHERE river_id = ${river_id} aheinecke@5405: AND hws.official=1 aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: SELECT DISTINCT aheinecke@5405: name AS hws_name, aheinecke@5405: kind_id AS hws_kind aheinecke@5405: FROM hws_lines aheinecke@5405: WHERE river_id = ${river_id} aheinecke@5405: AND official=1 aheinecke@5405: AND fed_state_id = ${fed_id} ORDER BY name aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: SELECT distinct aheinecke@5405: name AS hws_name, aheinecke@5405: kind_id AS hws_kind aheinecke@5405: FROM hws_lines aheinecke@5405: WHERE river_id = ${river_id} aheinecke@5405: AND official=1 aheinecke@5405: AND fed_state_id IS NULL aheinecke@5405: ORDER BY name aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: SELECT DISTINCT aheinecke@5405: fs.name AS fed_name, aheinecke@5405: fs.id AS fed_id aheinecke@5405: FROM hws_lines hws aheinecke@5405: JOIN fed_states fs ON hws.fed_state_id = fs.id aheinecke@5405: WHERE river_id = ${river_id} aheinecke@5405: AND hws.official=0 aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: SELECT DISTINCT aheinecke@5405: name AS hws_name, aheinecke@5405: kind_id AS hws_kind aheinecke@5405: FROM hws_lines aheinecke@5405: WHERE river_id = ${river_id} aheinecke@5405: AND official=0 aheinecke@5405: AND fed_state_id = ${fed_id} ORDER BY name aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: SELECT distinct aheinecke@5405: name AS hws_name, aheinecke@5405: kind_id AS hws_kind aheinecke@5405: FROM hws_lines aheinecke@5405: WHERE river_id = ${river_id} aheinecke@5405: AND official=0 aheinecke@5405: AND fed_state_id IS NULL ORDER BY name aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: Call from a context where fed_name hws_kind hws_name and river_id is aheinecke@5405: availble aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: SELECT DISTINCT aheinecke@5405: fs.name AS fed_name, aheinecke@5405: fs.id AS fed_id aheinecke@5405: FROM hws_points hws aheinecke@5405: JOIN fed_states fs ON hws.fed_state_id = fs.id aheinecke@5405: WHERE river_id = ${river_id} aheinecke@5405: AND hws.official=1 aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: SELECT DISTINCT aheinecke@5405: name AS hws_name, aheinecke@5405: kind_id AS hws_kind aheinecke@5405: FROM hws_points aheinecke@5405: WHERE river_id = ${river_id} aheinecke@5405: AND official=1 aheinecke@5405: AND fed_state_id = ${fed_id} ORDER BY name aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: SELECT distinct aheinecke@5405: name AS hws_name, aheinecke@5405: kind_id AS hws_kind aheinecke@5405: FROM hws_points aheinecke@5405: WHERE river_id = ${river_id} aheinecke@5405: AND official=1 aheinecke@5405: AND fed_state_id IS NULL aheinecke@5405: ORDER BY name aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: SELECT DISTINCT aheinecke@5405: fs.name AS fed_name, aheinecke@5405: fs.id AS fed_id aheinecke@5405: FROM hws_points hws aheinecke@5405: JOIN fed_states fs ON hws.fed_state_id = fs.id aheinecke@5405: WHERE river_id = ${river_id} aheinecke@5405: AND hws.official=0 aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: SELECT DISTINCT aheinecke@5405: name AS hws_name, aheinecke@5405: kind_id AS hws_kind aheinecke@5405: FROM hws_points aheinecke@5405: WHERE river_id = ${river_id} aheinecke@5405: AND official=0 aheinecke@5405: AND fed_state_id = ${fed_id} ORDER BY name aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: SELECT distinct aheinecke@5405: name AS hws_name, aheinecke@5405: kind_id AS hws_kind aheinecke@5405: FROM hws_points aheinecke@5405: WHERE river_id = ${river_id} aheinecke@5405: AND official=0 aheinecke@5405: AND fed_state_id IS NULL ORDER BY name aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: SELECT DISTINCT aheinecke@5405: b.kind_id AS building_kind_id, aheinecke@5405: bk.name AS building_kind aheinecke@5405: FROM buildings b aheinecke@5405: JOIN building_kinds bk ON b.kind_id = bk.id aheinecke@5435: WHERE b.river_id = ${river_id} aheinecke@5467: AND b.kind_id <> 0 aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5435: aheinecke@5435: aheinecke@5435: SELECT DISTINCT aheinecke@5435: b.kind_id AS building_kind_id, aheinecke@5435: b.name AS building_name, aheinecke@5435: bk.name AS building_kind aheinecke@5435: FROM buildings b aheinecke@5435: JOIN building_kinds bk ON b.kind_id = bk.id aheinecke@5435: WHERE river_id = ${river_id} aheinecke@5435: AND kind_id = 0 OR aheinecke@5435: kind_id IS NULL aheinecke@5435: aheinecke@5435: aheinecke@5435: aheinecke@5435: aheinecke@5435: aheinecke@5435: aheinecke@5435: aheinecke@5435: aheinecke@5435: aheinecke@5435: aheinecke@5435: aheinecke@5435: aheinecke@5435: aheinecke@5437: aheinecke@5437: aheinecke@5437: SELECT DISTINCT aheinecke@5437: j.kind_id AS jetty_kind_id, aheinecke@5437: jk.name AS jetty_kind aheinecke@5437: FROM jetties j aheinecke@5437: JOIN jetty_kinds jk ON j.kind_id = jk.id aheinecke@5437: WHERE river_id = ${river_id} aheinecke@5437: aheinecke@5437: aheinecke@5437: aheinecke@5437: aheinecke@5437: aheinecke@5437: aheinecke@5437: aheinecke@5437: aheinecke@5437: aheinecke@5437: aheinecke@5437: aheinecke@5437: aheinecke@5437: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: SELECT count(*) as km_exists, name as name aheinecke@5405: FROM fixpoints WHERE river_id = ${river_id} GROUP BY name aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5516: aheinecke@5516: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: SELECT count(*) as uesg_exist, name as name aheinecke@5405: FROM floodmaps aheinecke@5405: WHERE river_id = ${river_id} AND kind = 111 aheinecke@5405: GROUP BY name, kind aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: SELECT count(*) as uesg_exist, name as name aheinecke@5405: FROM floodmaps aheinecke@5405: WHERE river_id = ${river_id} AND kind = 112 aheinecke@5405: GROUP BY name, kind aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: SELECT count(*) as uesg_exist, name as name aheinecke@5405: FROM floodmaps aheinecke@5405: WHERE river_id = ${river_id} AND kind = 121 aheinecke@5405: GROUP BY name, kind aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: SELECT count(*) as uesg_exist, name as name aheinecke@5405: FROM floodmaps aheinecke@5405: WHERE river_id = ${river_id} AND kind = 122 aheinecke@5405: GROUP BY name, kind aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5464: aheinecke@5464: aheinecke@5464: aheinecke@5464: aheinecke@5464: aheinecke@5464: aheinecke@5466: aheinecke@5466: aheinecke@5466: aheinecke@5466: aheinecke@5473: aheinecke@5474: aheinecke@5477: aheinecke@5477: aheinecke@5477: aheinecke@5466: aheinecke@5466: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5466: aheinecke@5466: aheinecke@5466: aheinecke@5466: aheinecke@5466: aheinecke@5466: aheinecke@5466: aheinecke@5466: aheinecke@5405: aheinecke@5496: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5463: aheinecke@5463: aheinecke@5463: aheinecke@5463: ingo@2684: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: raimund@3614: aheinecke@5405: raimund@3614: raimund@3614: raimund@3614: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: SELECT id AS bedh_id, aheinecke@5405: year AS bedh_year, aheinecke@5405: description AS bedh_descr aheinecke@5405: FROM bed_height_single WHERE river_id = ${river_id} aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: SELECT id AS bedh_id, aheinecke@5405: time_interval_id AS bedh_interval_id, aheinecke@5405: description AS bedh_descr aheinecke@5405: FROM bed_height_epoch WHERE river_id = ${river_id} aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: aheinecke@5405: ingo@1181: ingo@1181: ingo@1181: ingo@1181: sascha@1046: sascha@1046: sascha@1046: User specific part sascha@1046: ------------------ sascha@1046: sascha@1046: ingo@1657: ingo@1657: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: Get the user and collection-id. rrenkert@5015: rrenkert@5015: felix@1879: SELECT u.id AS user_id, c.id AS collection_id, c.name as collection_name felix@1879: FROM collections c JOIN users u ON c.user_id = u.id felix@1879: WHERE u.gid = CAST(${user-id} AS uuid) felix@1879: ORDER BY c.creation DESC felix@1760: ingo@1657: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: SELECT m.id AS a_id, rrenkert@5015: m.state AS a_state, rrenkert@5015: m.gid AS a_gid, rrenkert@5015: m.creation AS a_creation, rrenkert@5015: COALESCE(ld_mode, '') AS ld_m, rrenkert@5015: COALESCE(ld_locations, '') AS ld_l, rrenkert@5015: COALESCE(ld_from, '') AS ld_f, rrenkert@5015: COALESCE(ld_to, '') AS ld_t rrenkert@5015: FROM master_artifacts_range m rrenkert@5015: WHERE m.collection_id = ${collection_id} AND m.gid <> CAST(${artifact-id} AS uuid) rrenkert@5015: AND EXISTS ( rrenkert@5015: SELECT id FROM artifact_data ad WHERE ad.artifact_id = m.id AND k = 'river' AND v = ${river}) rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: felix@3307: felix@3307: felix@3307: felix@3307: felix@3307: felix@3307: felix@3307: rrenkert@5015: SELECT m.id AS a_id, rrenkert@5015: m.state AS a_state, rrenkert@5015: m.gid AS a_gid, rrenkert@5015: m.creation AS a_creation, rrenkert@5015: ardg.v AS gaugy, rrenkert@5015: arv.v AS wqsingle rrenkert@5015: FROM master_artifacts m, rrenkert@5015: artifact_data ardg, rrenkert@5015: artifact_data arv rrenkert@5015: WHERE m.collection_id = ${collection_id} rrenkert@5015: AND m.gid = CAST(${artifact-id} AS uuid) rrenkert@5015: AND ardg.artifact_id = m.id rrenkert@5015: AND ardg.k = 'ld_gaugename' rrenkert@5015: AND arv.artifact_id = m.id rrenkert@5015: AND arv.k = 'wq_single' rrenkert@5015: AND EXISTS ( rrenkert@5015: SELECT id rrenkert@5015: FROM artifact_data ad rrenkert@5015: WHERE ad.artifact_id = m.id rrenkert@5015: AND k = 'river' rrenkert@5015: AND v = ${river}) felix@3307: felix@3307: felix@3307: felix@3307: felix@3307: SELECT ol.wst_id AS wstid, ol.wst_column_pos AS wstcolpos, ol.name AS olname, ol.value AS oval felix@3307: FROM official_q_values ol felix@3307: WHERE ol.value = CAST(${wqsingle} AS NUMERIC(10,2)) AND ol.gauge_name = ${gaugy} felix@3307: felix@3307: felix@3307: felix@3307: felix@3307: felix@3307: felix@3307: felix@3307: felix@3307: felix@3307: felix@3307: felix@3307: felix@3307: felix@3307: felix@3570: ingo@1657: felix@1879: felix@1879: SHOW W-DIFFERENCES felix@1879: ingo@1657: rrenkert@5015: felix@1879: felix@1879: felix@1879: rrenkert@5015: felix@1879: felix@1879: felix@1879: SELECT a.gid as aid, f.id AS fid, f.name AS facet_name, f.num AS facet_num, f.description as facet_description felix@1879: FROM outs as o, facets as f, artifacts as a felix@1879: WHERE f.name = 'w_differences' and f.out_id = o.id and o.artifact_id = ${a_id} and a.id = ${a_id} felix@1879: felix@1879: felix@1879: felix@1879: felix@1879: felix@1879: felix@1879: felix@1879: felix@1879: felix@1879: felix@1879: rrenkert@5015: felix@1879: felix@1879: felix@1879: rrenkert@5015: ingo@1657: felix@2722: felix@2722: SHOW REFERENCE CURVE felix@2722: felix@2722: rrenkert@5015: rrenkert@5015: felix@2722: felix@2722: felix@2722: rrenkert@5015: felix@2722: felix@2722: felix@2722: SELECT a.gid as aid, f.id AS fid, f.name AS facet_name, f.num AS facet_num, f.description as facet_description felix@2722: FROM outs as o, facets as f, artifacts as a felix@2722: WHERE f.name = 'reference_curve' and f.out_id = o.id and o.artifact_id = ${a_id} and a.id = ${a_id} felix@2722: felix@2722: felix@2722: felix@2722: felix@2722: felix@2722: felix@2722: felix@2722: felix@2722: felix@2722: felix@2722: rrenkert@5015: felix@2722: felix@2722: felix@2722: rrenkert@5015: felix@2722: felix@2722: felix@2722: SHOW COMPUTED DISCHARGE CURVES felix@2722: felix@2722: rrenkert@5015: felix@1880: felix@1880: felix@1880: rrenkert@5015: felix@1880: felix@1880: felix@1880: SELECT a.gid as aid, f.id AS fid, f.name AS facet_name, f.num AS facet_num, f.description as facet_description felix@1880: FROM outs as o, facets as f, artifacts as a felix@1880: WHERE f.name = 'computed_discharge_curve.q' and f.out_id = o.id and o.artifact_id = ${a_id} and a.id = ${a_id} felix@1880: felix@1880: felix@1880: felix@1880: felix@1880: felix@1880: felix@1880: felix@1880: felix@1880: felix@1880: felix@1880: rrenkert@5015: felix@1880: felix@1880: felix@1880: rrenkert@5015: sascha@3219: felix@2736: felix@2736: CROSS SECTION felix@2736: felix@2736: rrenkert@5015: rrenkert@5015: felix@2736: felix@2736: felix@2736: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: SELECT id AS out_id rrenkert@5015: FROM outs rrenkert@5015: WHERE artifact_id = ${a_id} AND name = 'cross_section' rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: SELECT name AS facet_name, num as facet_num, description AS facet_description rrenkert@5015: FROM facets rrenkert@5015: WHERE out_id = ${out_id} rrenkert@5015: ORDER BY num ASC, name DESC rrenkert@5015: rrenkert@5015: felix@2736: felix@2736: felix@2736: felix@2736: felix@2736: felix@2736: felix@2736: felix@2736: felix@2736: felix@2736: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: felix@2736: felix@2736: felix@2736: rrenkert@5015: ingo@1657: ingo@1657: rrenkert@5015: felix@1879: felix@1879: felix@1879: rrenkert@5015: rrenkert@5015: felix@1879: felix@1879: SELECT id AS out_id felix@1879: FROM outs felix@1879: WHERE artifact_id = ${a_id} AND name = 'longitudinal_section' felix@1879: felix@1879: felix@1879: felix@1879: felix@1879: SELECT name AS facet_name, num as facet_num, description AS facet_description felix@1879: FROM facets felix@1879: WHERE out_id = ${out_id} felix@1879: ORDER BY num ASC, name DESC felix@1879: felix@1879: felix@1879: felix@1879: felix@1879: felix@1879: felix@1879: felix@1879: felix@1879: felix@1879: felix@1879: felix@1879: felix@1879: felix@1879: felix@1879: felix@1879: rrenkert@5015: felix@1879: felix@1879: felix@1879: rrenkert@5015: ingo@1657: rrenkert@5015: rrenkert@5015: felix@3579: felix@3579: felix@3579: rrenkert@5015: felix@3579: felix@3579: felix@3579: SELECT id AS out_id felix@3579: FROM outs felix@3579: WHERE artifact_id = ${a_id} AND name = 'fix_longitudinal_section_curve' felix@3579: felix@3579: felix@3579: felix@3579: felix@3579: felix@3579: SELECT name AS facet_name, num as facet_num, description AS facet_description felix@3579: FROM facets felix@3589: WHERE out_id = ${out_id} AND ( name LIKE 'fix_deviation_ls%' OR name LIKE 'fix_sector_average_ls%' OR name LIKE 'fix_analysis_events_ls%' OR name LIKE 'fix_reference_events_ls%' ) felix@3579: ORDER BY num ASC, name DESC felix@3579: felix@3579: felix@3579: felix@3579: felix@3579: felix@3579: felix@3579: felix@3579: felix@3579: felix@3579: felix@3579: felix@3579: felix@3579: felix@3579: felix@3579: felix@3579: rrenkert@5015: felix@3579: felix@3579: felix@3579: rrenkert@5015: felix@3579: rrenkert@5015: felix@3579: felix@3579: felix@3579: rrenkert@5015: felix@3579: felix@3579: felix@3579: SELECT id AS out_id felix@3579: FROM outs felix@3582: WHERE artifact_id = ${a_id} AND name = 'fix_deltawt_curve' felix@3579: felix@3579: felix@3579: felix@3579: felix@3579: SELECT name AS facet_name, num as facet_num, description AS facet_description felix@3579: FROM facets felix@3590: WHERE out_id = ${out_id} and ( name LIKE 'fix_sector_average_dwt%' OR name LIKE 'fix_deviation_dwt%' OR name = 'fix_analysis_events_dwt' OR name = 'fix_reference_events_dwt' OR name = 'fix_analysis_periods_dwt' ) felix@3579: ORDER BY num ASC, name DESC felix@3579: felix@3579: felix@3579: felix@3579: felix@3579: felix@3579: felix@3579: felix@3582: felix@3579: felix@3582: felix@3579: felix@3579: felix@3579: felix@3579: felix@3579: felix@3579: rrenkert@5015: felix@3579: felix@3579: felix@3579: rrenkert@5015: felix@3579: rrenkert@5015: rrenkert@5015: felix@3589: felix@3589: felix@3589: rrenkert@5015: felix@3589: felix@3589: felix@3589: SELECT id AS out_id felix@3589: FROM outs felix@3589: WHERE artifact_id = ${a_id} AND name = 'fix_derivate_curve' felix@3589: felix@3589: felix@3589: felix@3589: felix@3589: SELECT name AS facet_name, num as facet_num, description AS facet_description felix@3589: FROM facets felix@4165: WHERE out_id = ${out_id} and name = 'fix_derivate_curve' felix@3589: ORDER BY num ASC, name DESC felix@3589: felix@3589: felix@3589: felix@3589: felix@3589: felix@3589: felix@3589: felix@3589: felix@3589: felix@3589: felix@3589: felix@3589: felix@3589: felix@3589: felix@3589: felix@3589: rrenkert@5015: felix@3589: felix@3589: felix@3589: rrenkert@5015: felix@3589: rrenkert@5015: rrenkert@5015: felix@3579: felix@3579: felix@3579: rrenkert@5015: felix@3579: felix@3579: felix@3579: SELECT id AS out_id felix@3579: FROM outs felix@3583: WHERE artifact_id = ${a_id} AND name = 'fix_wq_curve' felix@3579: felix@3579: felix@3579: felix@3579: felix@3579: SELECT name AS facet_name, num as facet_num, description AS facet_description felix@3579: FROM facets felix@3588: WHERE out_id = ${out_id} and ( name LIKE 'fix_sector_average_wq%' OR name = 'fix_wq_curve' OR name LIKE 'fix_analysis_events_wq%' OR name LIKE 'fix_reference_events_wq%' ) felix@3579: ORDER BY num ASC, name DESC felix@3579: felix@3579: felix@3579: felix@3579: felix@3579: felix@3579: felix@3579: felix@3583: felix@3579: felix@3583: felix@3579: felix@3579: felix@3579: felix@3579: felix@3579: felix@3579: rrenkert@5015: felix@3579: felix@3579: felix@3579: rrenkert@5015: felix@3579: rrenkert@5015: rrenkert@5015: felix@2690: felix@2690: felix@2690: rrenkert@5015: felix@2690: felix@2690: felix@2690: SELECT a.gid as aid, f.id AS fid, f.name AS facet_name, f.num AS facet_num, f.description as facet_description felix@2690: FROM outs as o, facets as f, artifacts as a felix@2717: WHERE (f.name = 'duration_curve.q' or f.name = 'duration_curve.w') and f.out_id = o.id and o.artifact_id = ${a_id} and a.id = ${a_id} felix@2690: felix@2690: felix@2690: felix@2690: felix@2690: felix@2690: felix@2690: felix@2690: felix@2690: felix@2690: felix@2690: rrenkert@5015: felix@2690: felix@2690: felix@2690: rrenkert@5015: rrenkert@5015: felix@1879: felix@1879: WATERLEVELS - ONLY SHOW Ws felix@1879: felix@1879: felix@3589: rrenkert@5015: rrenkert@5145: felix@1879: felix@1879: felix@1879: rrenkert@5015: felix@1879: felix@1879: felix@1879: SELECT id AS out_id felix@1879: FROM outs felix@1879: WHERE artifact_id = ${a_id} AND name = 'longitudinal_section' felix@1879: felix@1879: felix@1879: felix@1879: felix@1879: SELECT name AS facet_name, num as facet_num, description AS facet_description felix@1879: FROM facets felix@1879: WHERE out_id = ${out_id} and name = 'longitudinal_section.w' felix@1879: ORDER BY num ASC, name DESC felix@1879: felix@1879: felix@1879: felix@1879: felix@1879: felix@1879: felix@1879: felix@1879: felix@1879: felix@1879: felix@1879: felix@1879: felix@1879: felix@1879: felix@1879: felix@1879: rrenkert@5015: felix@1879: felix@1879: felix@1879: rrenkert@5015: felix@1879: ingo@2096: ingo@2096: SHOW FLOODMAPS ingo@2096: ingo@2096: rrenkert@5015: rrenkert@5015: ingo@2096: ingo@2096: ingo@2096: rrenkert@5015: ingo@2096: ingo@2096: ingo@2096: SELECT a.gid as aid, f.id AS fid, f.name AS facet_name, f.num AS facet_num, f.description as facet_description ingo@2096: FROM outs as o, facets as f, artifacts as a ingo@2096: WHERE f.name = 'floodmap.wsplgen' and f.out_id = o.id and o.artifact_id = ${a_id} and a.id = ${a_id} ingo@2096: ingo@2096: ingo@2096: ingo@2096: ingo@2096: ingo@2096: ingo@2096: ingo@2096: ingo@2096: ingo@2096: ingo@2096: rrenkert@5015: ingo@2096: ingo@2096: ingo@2096: rrenkert@5015: ingo@2096: bjoern@4379: bjoern@4379: MINFO bedheight difference bjoern@4379: bjoern@4379: rrenkert@5015: bjoern@4379: bjoern@4379: bjoern@4379: rrenkert@5015: bjoern@4379: bjoern@4379: bjoern@4379: SELECT a.gid as aid, f.id AS fid, f.name AS facet_name, f.num AS facet_num, f.description as facet_description bjoern@4379: FROM outs as o, facets as f, artifacts as a bjoern@4379: WHERE (f.name = 'fix_sector_average_ls_0' or f.name = 'fix_sector_average_ls_1' or f.name = 'fix_sector_average_ls_2' bjoern@4379: or f.name = 'fix_sector_average_ls_3' or f.name = 'fix_analysis_events_ls' or f.name = 'fix_reference_events_ls') bjoern@4379: and f.out_id = o.id and o.artifact_id = ${a_id} and a.id = ${a_id} bjoern@4379: bjoern@4379: bjoern@4379: bjoern@4379: bjoern@4379: bjoern@4379: bjoern@4379: bjoern@4379: bjoern@4379: bjoern@4379: bjoern@4379: bjoern@4379: bjoern@4379: bjoern@4379: rrenkert@5015: bjoern@4379: bjoern@4379: bjoern@4379: rrenkert@5015: bjoern@4379: bjoern@4538: bjoern@4538: MINFO bedheight middle bjoern@4538: bjoern@4538: rrenkert@5015: bjoern@4449: bjoern@4449: bjoern@4449: rrenkert@5015: bjoern@4449: bjoern@4449: bjoern@4449: SELECT a.gid as aid, f.id AS fid, f.name AS facet_name, f.num AS facet_num, f.description as facet_description bjoern@4449: FROM outs as o, facets as f, artifacts as a bjoern@4449: WHERE (f.name = 'longitudinal_section.w' or f.name = 'heightmarks_points') bjoern@4449: and f.out_id = o.id and o.artifact_id = ${a_id} and a.id = ${a_id} bjoern@4449: bjoern@4449: bjoern@4449: bjoern@4449: bjoern@4449: bjoern@4449: bjoern@4449: bjoern@4449: bjoern@4449: bjoern@4449: bjoern@4449: bjoern@4449: bjoern@4449: bjoern@4449: rrenkert@5015: bjoern@4449: bjoern@4449: bjoern@4449: rrenkert@5015: rrenkert@5015: rrenkert@5312: rrenkert@5312: rrenkert@5312: rrenkert@5312: SELECT id AS out_id rrenkert@5312: FROM outs rrenkert@5312: WHERE artifact_id = ${a_id} AND name = 'floodmap' rrenkert@5312: rrenkert@5312: rrenkert@5312: rrenkert@5312: rrenkert@5312: SELECT name AS facet_name, num as facet_num, description AS facet_description rrenkert@5312: FROM facets rrenkert@5312: WHERE out_id = ${out_id} and name = 'floodmap.usershape' rrenkert@5312: ORDER BY num ASC, name DESC rrenkert@5312: rrenkert@5312: rrenkert@5312: rrenkert@5312: rrenkert@5312: rrenkert@5312: rrenkert@5312: rrenkert@5312: rrenkert@5312: rrenkert@5312: rrenkert@5312: rrenkert@5312: rrenkert@5312: rrenkert@5312: rrenkert@5312: rrenkert@5312: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: rrenkert@5015: bjoern@4449: rrenkert@5312: rrenkert@5312: rrenkert@5312: felix@1879: rrenkert@5015: rrenkert@5015: sascha@1046: ingo@1657: ingo@1657: ingo@1181: ingo@1657: Include System specific part when 'load-system' is in parameters. ingo@1657: ----------------------------------------------------------------- ingo@1181: ingo@1657: ingo@1657: ingo@1657: ingo@1657: ingo@1657: sascha@1046: ingo@1657: ingo@1657: sascha@1046: ingo@1657: Include System specific part only if no user ID is given. ingo@1657: --------------------------------------------------------- sascha@1046: sascha@1046: ingo@1181: sascha@1046: sascha@1046: sascha@1046: sascha@1046: