diff flys-artifacts/doc/conf/meta-data.xml @ 5404:08262e0ce57a

Add buildings with kinds to datacage
author Andre Heinecke <aheinecke@intevation.de>
date Mon, 25 Mar 2013 15:02:04 +0100
parents f099ca10684e
children 5ca06120b918
line wrap: on
line diff
--- a/flys-artifacts/doc/conf/meta-data.xml	Mon Mar 25 15:01:16 2013 +0100
+++ b/flys-artifacts/doc/conf/meta-data.xml	Mon Mar 25 15:02:04 2013 +0100
@@ -1521,23 +1521,25 @@
             </dc:macro>
 
 
-              <dc:macro name="flood-map-buildings">
-                <dc:context>
-                  <dc:statement>
-                    SELECT count(*) as km_exists, name as name
-                    FROM buildings WHERE river_id = ${river_id} GROUP BY name
-                  </dc:statement>
-                   <dc:elements>
-                    <dc:if test="$km_exists>0">
-                      <building>
-                        <dc:attribute name="factory" value="wmsbuildingsfactory"/>
-                        <dc:attribute name="ids" value="${river_id};${name}"/>
-                        <dc:attribute name="name" value="${name}"/>
-                      </building>
-                    </dc:if>
-                  </dc:elements>
-                </dc:context>
-              </dc:macro>
+            <dc:macro name="flood-map-buildings">
+              <dc:context>
+                <dc:statement>
+                  SELECT DISTINCT
+                  b.kind_id AS building_kind_id,
+                  bk.name AS building_kind
+                  FROM buildings b
+                  JOIN building_kinds bk ON b.kind_id = bk.id
+                  WHERE river_id = ${river_id}
+                </dc:statement>
+                <dc:elements>
+                  <buildings>
+                    <dc:attribute name="description" value="${building_kind}"/>
+                    <dc:attribute name="factory" value="wmsbuildingsfactory"/>
+                    <dc:attribute name="ids" value="${river_id};${building_kind};${building_kind_id}"/>
+                  </buildings>
+                </dc:elements>
+              </dc:context>
+            </dc:macro>
               <dc:macro name="flood-map-fixpoints">
                 <dc:context>
                   <dc:statement>

http://dive4elements.wald.intevation.org