[Dive4elements-commits] [PATCH] [branch: dc-km-filter] meta-data.xml: Filter wst columns by range

Wald Commits scm-commit at wald.intevation.org
Tue Jan 29 14:59:10 CET 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1359468337 -3600
# Branch dc-km-filter
# Node ID 137ff80f0a014fc9ad5a8b6d1576ce027b6cf3ef
# Parent  8cbea3354ac500248e7e8ae754277529897a9aaa
[branch: dc-km-filter] meta-data.xml: Filter wst columns by range.

diff -r 8cbea3354ac5 -r 137ff80f0a01 flys-artifacts/doc/conf/meta-data.xml
--- a/flys-artifacts/doc/conf/meta-data.xml	Tue Jan 29 12:05:12 2013 +0100
+++ b/flys-artifacts/doc/conf/meta-data.xml	Tue Jan 29 15:05:37 2013 +0100
@@ -1,19 +1,23 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <dc:template xmlns:dc="http://www.intevation.org/2011/Datacage">
 <datacage>
-<dc:macro name="SQL-wst_columns_statement">
-    <dc:statement>
-        SELECT wst_columns.id          AS prot_column_id,
-               wst_columns.name        AS prot_column_name,
-               wst_columns.position    AS prot_rel_pos,
-               wst_columns.description AS info,
-               wst_ranges.a            AS deffrom,
-               wst_ranges.b            AS defto
-        FROM wst_columns, wst_ranges
-        WHERE wst_columns.wst_id = ${prot_id} AND wst_ranges.wst_column_id = wst_columns.id
-        ORDER by wst_columns.position
-    </dc:statement>
-</dc:macro>
+  <dc:macro name="SQL-wst_columns_statement">
+      <dc:statement>
+          SELECT wst_columns.id          AS prot_column_id,
+                 wst_columns.name        AS prot_column_name,
+                 wst_columns.position    AS prot_rel_pos,
+                 wst_columns.description AS info,
+                 wst_ranges.a            AS deffrom,
+                 wst_ranges.b            AS defto
+          FROM wst_columns, wst_ranges
+          WHERE wst_columns.wst_id = ${prot_id} AND wst_ranges.wst_column_id = wst_columns.id
+          AND ( CAST(${startkm} AS DOUBLE PRECISION) BETWEEN wst_ranges.a AND wst_ranges.b
+           OR CAST(${endkm} AS DOUBLE PRECISION) BETWEEN wst_ranges.a AND wst_ranges.b
+           OR wst_ranges.a BETWEEN CAST(${startkm} AS DOUBLE PRECISION) AND CAST(${endkm} AS DOUBLE PRECISION)
+          )
+          ORDER by wst_columns.position
+      </dc:statement>
+  </dc:macro>
   <dc:macro name="load-system">
     <dc:context connection="system">
       <dc:statement>


More information about the Dive4elements-commits mailing list