diff flys-artifacts/doc/conf/meta-data.xml @ 5534:a11c6f680487

Add uesg as specified to the datacage
author Andre Heinecke <aheinecke@intevation.de>
date Wed, 03 Apr 2013 15:31:04 +0200
parents 65fa2b22dc46
children 38713f32a785 38acd82feeac
line wrap: on
line diff
--- a/flys-artifacts/doc/conf/meta-data.xml	Wed Apr 03 15:30:45 2013 +0200
+++ b/flys-artifacts/doc/conf/meta-data.xml	Wed Apr 03 15:31:04 2013 +0200
@@ -1575,82 +1575,132 @@
           </dc:macro>
 
           <dc:macro name="flood-map-uesk">
-            <uesk>
-              <calculations>
-                <current>
-                  <bfg>
-                    <dc:context>
-                      <dc:statement>
-                        SELECT count(*) AS uesg_exist, name AS name
-                        FROM floodmaps
-                        WHERE river_id = ${river_id} AND kind = 111
-                        GROUP BY name, kind
-                      </dc:statement>
+            <dc:context>
+              <dc:statement>
+                SELECT DISTINCT 1 from floodmaps where river_id = ${river_id}
+              </dc:statement>
+              <dc:if test="dc:has-result()">
+              <uesk>
+                <calculations>
+                  <dc:context>
+                    <dc:statement>
+                      SELECT DISTINCT 1 from floodmaps where river_id = ${river_id} 
+                      AND (kind = 112 OR kind = 111)
+                    </dc:statement>
+                    <dc:if test="dc:has-result()">
+                      <current>
+                        <dc:context>
+                          <dc:statement>
+                            SELECT DISTINCT name AS name
+                            FROM floodmaps
+                            WHERE river_id = ${river_id} AND kind = 111
+                          </dc:statement>
+                          <dc:if test="dc:has-result()">
+                            <bfg>
+                              <dc:for-each>
+                                <floodmaps factory="wmsfloodmapsfactory"
+                                  ids="{$river_id};{$name}"
+                                  name="{$name}"/>
+                              </dc:for-each>
+                            </bfg>
+                          </dc:if>
+                        </dc:context>
+                        <dc:context>
+                          <dc:statement>
+                            SELECT DISTINCT name AS name
+                            FROM floodmaps
+                            WHERE river_id = ${river_id} AND kind = 112
+                          </dc:statement>
+                          <dc:if test="dc:has-result()">
+                            <federal>
+                              <dc:for-each>
+                                <floodmaps factory="wmsfloodmapsfactory"
+                                  ids="{$river_id};{$name}"
+                                  name="{$name}"/>
+                              </dc:for-each>
+                            </federal>
+                          </dc:if>
+                        </dc:context>
+                      </current>
+                    </dc:if>
+                  </dc:context>
+                  <dc:context>
+                    <dc:statement>
+                      SELECT DISTINCT 1 from floodmaps where river_id = ${river_id}
+                      AND (kind = 122 OR kind = 121)
+                    </dc:statement>
+                    <dc:if test="dc:has-result()">
+                      <potential>
+                        <dc:context>
+                          <dc:statement>
+                            SELECT DISTINCT name AS name
+                            FROM floodmaps
+                            WHERE river_id = ${river_id} AND kind = 121
+                          </dc:statement>
+                          <dc:if test="dc:has-result()">
+                            <bfg>
+                              <dc:for-each>
+                                <floodmaps factory="wmsfloodmapsfactory"
+                                  ids="{$river_id};{$name}"
+                                  name="{$name}"/>
+                              </dc:for-each>
+                            </bfg>
+                          </dc:if>
+                        </dc:context>
+                        <dc:context>
+                          <dc:statement>
+                            SELECT DISTINCT
+                            name AS name
+                            FROM floodmaps
+                            WHERE river_id = ${river_id} AND kind = 122
+                          </dc:statement>
+                          <dc:if test="dc:has-result()">
+                            <federal>
+                              <dc:for-each>
+                                <floodmaps factory="wmsfloodmapsfactory"
+                                  ids="{$river_id};{$name}"
+                                  name="{$name}"/>
+                              </dc:for-each>
+                            </federal>
+                          </dc:if>
+                        </dc:context>
+                      </potential>
+                    </dc:if>
+                  </dc:context>
+                </calculations>
+                <dc:context>
+                  <dc:statement>
+                    SELECT DISTINCT
+                    source AS source
+                    FROM floodmaps
+                    WHERE river_id = ${river_id} AND kind = 200
+                  </dc:statement>
+                  <dc:if test="dc:has-result()">
+                    <measurements>
                       <dc:for-each>
-                        <dc:if test="$uesg_exist&gt;0">
-                          <floodmaps factory="wmsfloodmapsfactory"
-                                     ids="{$river_id};{$name}"
-                                     name="{$name}"/>
-                        </dc:if>
-                      </dc:for-each>
-                    </dc:context>
-                  </bfg>
-                  <land>
-                    <dc:context>
-                      <dc:statement>
-                        SELECT count(*) AS uesg_exist, name AS name
-                        FROM floodmaps
-                        WHERE river_id = ${river_id} AND kind = 112
-                        GROUP BY name, kind
-                      </dc:statement>
-                      <dc:for-each>
-                        <dc:if test="$uesg_exist&gt;0">
-                          <floodmaps factory="wmsfloodmapsfactory"
-                                     ids="{$river_id};{$name}"
-                                     name="{$name}"/>
-                        </dc:if>
+                        <year name="{$source}">
+                          <dc:context>
+                            <dc:statement>
+                              SELECT DISTINCT
+                              name AS name
+                              FROM floodmaps
+                              WHERE river_id = ${river_id} AND kind = 200 AND source =
+                              ${source}
+                            </dc:statement>
+                            <dc:for-each>
+                              <floodmaps factory="wmsfloodmapsfactory"
+                                ids="{$river_id};{$name}"
+                                name="{$name}"/>
+                            </dc:for-each>
+                          </dc:context>
+                        </year>
                       </dc:for-each>
-                    </dc:context>
-                  </land>
-                </current>
-                <potentiel>
-                  <bfg>
-                    <dc:context>
-                      <dc:statement>
-                        SELECT count(*) AS uesg_exist, name AS name
-                        FROM floodmaps
-                        WHERE river_id = ${river_id} AND kind = 121
-                        GROUP BY name, kind
-                      </dc:statement>
-                      <dc:for-each>
-                        <dc:if test="$uesg_exist&gt;0">
-                          <floodmaps factory="wmsfloodmapsfactory"
-                                     ids="{$river_id};{$name}"
-                                     name="{$name}"/>
-                        </dc:if>
-                      </dc:for-each>
-                    </dc:context>
-                  </bfg>
-                  <land>
-                    <dc:context>
-                      <dc:statement>
-                        SELECT count(*) AS uesg_exist, name AS name
-                        FROM floodmaps
-                        WHERE river_id = ${river_id} AND kind = 122
-                        GROUP BY name, kind
-                      </dc:statement>
-                      <dc:for-each>
-                        <dc:if test="$uesg_exist&gt;0">
-                          <floodmaps factory="wmsfloodmapsfactory"
-                                     ids="{$river_id};{$name}"
-                                     name="{$name}"/>
-                        </dc:if>
-                      </dc:for-each>
-                    </dc:context>
-                  </land>
-                </potentiel>
-              </calculations>
-            </uesk>
+                    </measurements>
+                  </dc:if>
+                </dc:context>
+              </uesk>
+            </dc:if>
+            </dc:context>
           </dc:macro>
 
           <dc:macro name="flood-map-catchments">

http://dive4elements.wald.intevation.org