changeset 4900:137ff80f0a01 dc-km-filter

[branch: dc-km-filter] meta-data.xml: Filter wst columns by range.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Tue, 29 Jan 2013 15:05:37 +0100
parents 8cbea3354ac5
children aa67a88314f2
files flys-artifacts/doc/conf/meta-data.xml
diffstat 1 files changed, 17 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- 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>

http://dive4elements.wald.intevation.org