[Dive4elements-commits] [PATCH 2 of 3] merged

Wald Commits scm-commit at wald.intevation.org
Thu Apr 4 10:58:24 CEST 2013


# HG changeset patch
# User Raimund Renkert <rrenkert at intevation.de>
# Date 1365065786 -7200
# Node ID 220d12a41bfadea540bc30e69c8a1b2e5fff6b9b
# Parent  38acd82feeac0528417da02b935e9430872a0df3
# Parent  38713f32a785c0669d3cc638ee877552d1b0e7bb
merged.

diff -r 38acd82feeac -r 220d12a41bfa flys-artifacts/doc/conf/artifacts/map.xml
--- a/flys-artifacts/doc/conf/artifacts/map.xml	Thu Apr 04 10:55:46 2013 +0200
+++ b/flys-artifacts/doc/conf/artifacts/map.xml	Thu Apr 04 10:56:26 2013 +0200
@@ -26,6 +26,7 @@
                         <facet name="floodmap.hydr_boundaries_poly"/>
                         <facet name="floodmap.catchment"/>
                         <facet name="floodmap.floodplain"/>
+                        <facet name="floodmap.floodmarks"/>
                         <facet name="floodmap.lines"/>
                         <facet name="floodmap.buildings"/>
                         <facet name="floodmap.fixpoints"/>
diff -r 38acd82feeac -r 220d12a41bfa flys-artifacts/doc/conf/artifacts/winfo.xml
--- a/flys-artifacts/doc/conf/artifacts/winfo.xml	Thu Apr 04 10:55:46 2013 +0200
+++ b/flys-artifacts/doc/conf/artifacts/winfo.xml	Thu Apr 04 10:56:26 2013 +0200
@@ -563,6 +563,7 @@
                         <facet name="floodmap.lines"/>
                         <facet name="floodmap.buildings"/>
                         <facet name="floodmap.fixpoints"/>
+                        <facet name="floodmap.floodmarks"/>
                         <facet name="floodmap.floodmaps"/>
                         <facet name="floodmap.gauge_location"/>
                         <facet name="floodmap.externalwms"/>
diff -r 38acd82feeac -r 220d12a41bfa flys-artifacts/doc/conf/conf.xml
--- a/flys-artifacts/doc/conf/conf.xml	Thu Apr 04 10:55:46 2013 +0200
+++ b/flys-artifacts/doc/conf/conf.xml	Thu Apr 04 10:56:26 2013 +0200
@@ -54,6 +54,9 @@
             <artifact-factory name="wmsfixpointsfactory" description="Factory to create an artifact to be used in WINFO"
                 ttl="3600000"
                 artifact="de.intevation.flys.artifacts.WMSFixpointsArtifact">de.intevation.artifactdatabase.DefaultArtifactFactory</artifact-factory>
+            <artifact-factory name="wmsfloodmarkfactory" description="Factory to create an artifact to be used in WINFO"
+                ttl="3600000"
+                artifact="de.intevation.flys.artifacts.WMSFloodmarksArtifact">de.intevation.artifactdatabase.DefaultArtifactFactory</artifact-factory>
             <artifact-factory name="wmsfloodmapsfactory" description="Factory to create an artifact to be used in WINFO"
                 ttl="3600000"
                 artifact="de.intevation.flys.artifacts.WMSFloodmapsArtifact">de.intevation.artifactdatabase.DefaultArtifactFactory</artifact-factory>
diff -r 38acd82feeac -r 220d12a41bfa flys-artifacts/doc/conf/meta-data.xml
--- a/flys-artifacts/doc/conf/meta-data.xml	Thu Apr 04 10:55:46 2013 +0200
+++ b/flys-artifacts/doc/conf/meta-data.xml	Thu Apr 04 10:56:26 2013 +0200
@@ -1570,8 +1570,10 @@
           </dc:macro>
 
           <dc:macro name="flood-map-gaugelocations">
-            <dc:attribute name="factory" value="externalwmsfactory"/>
-            <dc:attribute name="ids" value="http://www.pegelonline.wsv.de/webservices/gis/wms;Pegelpunkte;Pegelonline-Pegelpunkte"/>
+            <gauge_points factory="externalwmsfactory" ids="http://www.pegelonline.wsv.de/webservices/gis/wms;Pegelpunkte;Pegelpunkte (WSV)"/>
+            <gauge_names factory="externalwmsfactory" ids="http://www.pegelonline.wsv.de/webservices/gis/wms;Pegelnamen;Pegelnamen (WSV)"/>
+            <gauge_level factory="externalwmsfactory" ids="http://www.pegelonline.wsv.de/webservices/gis/wms;Pegelwasserstand;Aktueller Wasserstand (WSV)"/>
+            <gauge_tendency factory="externalwmsfactory" ids="http://www.pegelonline.wsv.de/webservices/gis/wms;TendenzWasserstand;Tendenz des Wasserstands (WSV)"/>
           </dc:macro>
 
           <dc:macro name="flood-map-uesk">
@@ -1703,11 +1705,6 @@
             </dc:context>
           </dc:macro>
 
-          <dc:macro name="flood-map-catchments">
-            <dc:attribute name="factory" value="externalwmsfactory"/>
-            <dc:attribute name="ids" value="http://geoportal.bafg.de/wmsproxy/INSPIRE/DrainageBasin;HY.PHYSICALWATERS.CATCHMENTS;Einzugsgebiet"/>
-          </dc:macro>
-
           <dc:macro name="flood-map-routing">
             <qps>
               <dc:call-macro name="flood-map-qps"/>
@@ -1719,14 +1716,33 @@
             </axis>
           </dc:macro>
 
+          <dc:macro name="floodmarks">
+            <dc:context>
+              <dc:statement>
+                SELECT DISTINCT
+                coalesce(CAST (year AS VARCHAR(64)), 'Unbekanntes Jahr') as year
+                FROM flood_marks
+                WHERE river_id = ${river_id}
+              </dc:statement>
+              <dc:if test="dc:has-result()">
+                <floodmarks>
+                  <dc:for-each>
+                    <floodmark name="{$year}"
+                      factory="wmsfloodmarkfactory"
+                      ids="{$river_id};{$year};{$year}"/>
+                  </dc:for-each>
+                </floodmarks>
+              </dc:if>
+            </dc:context>
+          </dc:macro>
+
           <dc:macro name="flood-map-complete">
             <buildings>
               <dc:call-macro name="flood-map-buildings"/>
             </buildings>
-            <catchments>
-              <dc:call-macro name="flood-map-catchments"/>
-            </catchments>
-            <dc:comment><!-- TODO: HW-Marken --></dc:comment>
+            <catchments factory="externalwmsfactory"
+              ids="http://geoportal.bafg.de/wmsproxy/INSPIRE/DrainageBasin;HY.PHYSICALWATERS.CATCHMENTS;Einzugsgebiet"/>
+            <dc:call-macro name="floodmarks"/>
             <hws>
               <dc:call-macro name="hwslines"/>
               <dc:call-macro name="hwspoints"/>
@@ -1743,6 +1759,8 @@
               <dc:call-macro name="flood-map-gaugelocations"/>
             </gaugelocations>
             <background factory="wmsbackground" ids="{$river_id}"/>
+            <pegel_had_measurement_points factory="externalwmsfactory"
+              ids="http://geoportal.bafg.de/wmsproxy/HAD/HAD_31;0;HAD Abflussmessstellen"/>
           </dc:macro>
 
         </dc:if>
diff -r 38acd82feeac -r 220d12a41bfa flys-artifacts/doc/conf/themes.xml
--- a/flys-artifacts/doc/conf/themes.xml	Thu Apr 04 10:55:46 2013 +0200
+++ b/flys-artifacts/doc/conf/themes.xml	Thu Apr 04 10:56:26 2013 +0200
@@ -212,6 +212,7 @@
         <mapping from="floodmap.lines" to="FloodmapLines" />
         <mapping from="floodmap.buildings" to="Buildings" />
         <mapping from="floodmap.fixpoints" to="Fixpoints" />
+        <mapping from="floodmap.floodmarks" to="Floodmarks" />
         <mapping from="floodmap.floodmaps" to="Floodmaps" />
         <mapping from="floodmap.gauge_location" to="GaugeLocation" />
         <mapping from="floodmap.jetties" to="Jetties" />
diff -r 38acd82feeac -r 220d12a41bfa flys-artifacts/doc/conf/themes/default/floodmap.xml
--- a/flys-artifacts/doc/conf/themes/default/floodmap.xml	Thu Apr 04 10:55:46 2013 +0200
+++ b/flys-artifacts/doc/conf/themes/default/floodmap.xml	Thu Apr 04 10:56:26 2013 +0200
@@ -59,15 +59,13 @@
         </inherits>
     </theme>
 
-
-    <theme name="GaugeLocation">
+    <theme name="Floodmarks">
         <inherits>
             <inherit from="MapLines" />
             <inherit from="Symbol" />
         </inherits>
     </theme>
 
-
     <theme name="Qps">
         <inherits>
             <inherit from="MapLines" />
diff -r 38acd82feeac -r 220d12a41bfa flys-artifacts/doc/conf/themes/second/floodmap.xml
--- a/flys-artifacts/doc/conf/themes/second/floodmap.xml	Thu Apr 04 10:55:46 2013 +0200
+++ b/flys-artifacts/doc/conf/themes/second/floodmap.xml	Thu Apr 04 10:56:26 2013 +0200
@@ -21,6 +21,13 @@
         </inherits>
     </theme>
 
+    <theme name="Floodmarks">
+        <inherits>
+            <inherit from="MapLines" />
+            <inherit from="Symbol" />
+        </inherits>
+    </theme>
+
     <theme name="WSPLGEN">
         <inherits>
             <inherit from="Uesk" />
diff -r 38acd82feeac -r 220d12a41bfa flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java	Thu Apr 04 10:55:46 2013 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java	Thu Apr 04 10:56:26 2013 +0200
@@ -171,6 +171,7 @@
     String FLOODMAP_LINES              = "floodmap.lines";
     String FLOODMAP_BUILDINGS          = "floodmap.buildings";
     String FLOODMAP_FIXPOINTS          = "floodmap.fixpoints";
+    String FLOODMAP_FLOODMARKS         = "floodmap.floodmarks";
     String FLOODMAP_FLOODMAPS          = "floodmap.floodmaps";
     String FLOODMAP_GAUGE_LOCATION     = "floodmap.gauge_location";
     String FLOODMAP_EXTERNAL_WMS       = "floodmap.externalwms";
diff -r 38acd82feeac -r 220d12a41bfa flys-backend/contrib/run_geo.sh
--- a/flys-backend/contrib/run_geo.sh	Thu Apr 04 10:55:46 2013 +0200
+++ b/flys-backend/contrib/run_geo.sh	Thu Apr 04 10:56:26 2013 +0200
@@ -27,6 +27,7 @@
 SKIP_UESG=0
 SKIP_DGM=0
 SKIP_JETTIES=0
+SKIP_FLOODMARKS=0
 
 # There should be no need to change anything below this line
 
@@ -63,4 +64,5 @@
     --skip_hws_lines $SKIP_HWS_LINES \
     --skip_hws_points $SKIP_HWS_POINTS \
     --skip_dgm $SKIP_DGM \
-    --skip_jetties $SKIP_JETTIES
+    --skip_jetties $SKIP_JETTIES \
+    --skip_floodmarks $SKIP_FLOODMARKS
diff -r 38acd82feeac -r 220d12a41bfa flys-backend/contrib/shpimporter/dgm.py
--- a/flys-backend/contrib/shpimporter/dgm.py	Thu Apr 04 10:55:46 2013 +0200
+++ b/flys-backend/contrib/shpimporter/dgm.py	Thu Apr 04 10:56:26 2013 +0200
@@ -1,4 +1,4 @@
-# -*- coding: utf-8 -*-
+# -*- coding: latin-1 -*-
 
 import codecs
 import utils
@@ -14,11 +14,11 @@
 # <dbfield> : (<csvfield>, conversion function)
 DGM_MAP = {
     "projection"      : "Projektion",
-    "elevation_state" : latin("Höhenstatus"),
+    "elevation_state" : latin("Höhenstatus"),
     "format"          : "Format",
     "border_break"    : ("Bruchkanten",
         lambda x: True if x.lower() == "Ja" else False),
-    "resolution"      : (latin("Auflösung"), lambda x: x),
+    "resolution"      : (latin("Auflösung"), lambda x: x),
 #   "description"     : 
     "srid"            : "SRID",
     "path"            : ("Pfad_Bestand", lambda x: x),
@@ -111,7 +111,7 @@
         for line in csvfile:
             fields = line.split(";")
             if not fields: continue
-            if fields[namedict[latin("Gewässer")]] != \
+            if fields[namedict[latin("Gewässer")]] != \
                     unicode(utils.getUTF8(river_name),'UTF-8'):
                 continue
             else:
diff -r 38acd82feeac -r 220d12a41bfa flys-backend/contrib/shpimporter/floodmarks.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-backend/contrib/shpimporter/floodmarks.py	Thu Apr 04 10:56:26 2013 +0200
@@ -0,0 +1,75 @@
+# -*- coding: utf-8 -*-
+try:
+    from osgeo import ogr
+except ImportError:
+    import ogr
+
+from importer import Importer
+import logging
+import os
+import re
+
+TABLE_NAME="flood_marks"
+PATH="Hydrologie/HW-Marken"
+NAME="Floodmarks"
+
+logger = logging.getLogger(NAME)
+
+BUILDING_KINDS= {
+        "sonstige" : 0,
+        "brücken"  : 1,
+        "wehre"    : 2,
+        "pegel"    : 3,
+        }
+
+class Floodmark(Importer):
+    fieldmap = {
+            "^station$"       : "km",
+            "^km$"            : "km",
+            "^wsv-km$"        : "km",
+            "^FlussKm$"       : "km",
+            "^z$"             : "z",
+            "^z\d*"           : "z", # z02, z1890, usw.
+            "^m+NHN$"         : "z",
+            "^Ort$"           : "location",
+            "^Pegel$"         : "location",
+        }
+
+    def getPath(self, base):
+        return "%s/%s" % (base, PATH)
+
+    def getTablename(self):
+        return TABLE_NAME
+
+    def getName(self):
+        return NAME
+
+    def isGeometryValid(self, geomType):
+        return geomType == ogr.wkbPoint
+
+    def isShapeRelevant(self, name, path):
+        return "hw-marken" in name.lower()
+
+    def createNewFeature(self, featureDef, feat, **args):
+        newFeat  = ogr.Feature(featureDef)
+        geometry = feat.GetGeometryRef()
+        geometry.SetCoordinateDimension(2)
+        newFeat.SetGeometry(geometry)
+
+        self.copyFields(feat, newFeat, self.fieldmap)
+
+        newFeat.SetField("river_id", self.river_id)
+
+        filename = os.path.basename(args['path'])
+
+        # Try to extract the year from the filename
+        match = re.search(r"([_\-])(\d\d\d\d)([_\-])", filename)
+        if match:
+            year = match.groups()[1]
+            year = int(year)
+            newFeat.SetField("year", year)
+        else:
+            logger.warn(u"Could not extract year from filename: %s " % filename)
+
+        return newFeat
+
diff -r 38acd82feeac -r 220d12a41bfa flys-backend/contrib/shpimporter/shpimporter.py
--- a/flys-backend/contrib/shpimporter/shpimporter.py	Thu Apr 04 10:55:46 2013 +0200
+++ b/flys-backend/contrib/shpimporter/shpimporter.py	Thu Apr 04 10:56:26 2013 +0200
@@ -20,6 +20,7 @@
 from gauges import GaugeLocation
 from jetties import Jetties
 from dgm import insertRiverDgm
+from floodmarks import Floodmark
 
 logger = logging.getLogger("shpimporter")
 
@@ -48,6 +49,7 @@
         HWSPoints(river_id, dbconn, dry_run),
         GaugeLocation(river_id, dbconn, dry_run),
         Jetties(river_id, dbconn, dry_run),
+        Floodmark(river_id, dbconn, dry_run),
         UESG(river_id, dbconn, dry_run)
         ]
 
@@ -76,6 +78,7 @@
     parser.add_option("--skip_uesgs", type="int")
     parser.add_option("--skip_dgm", type="int")
     parser.add_option("--skip_jetties", type="int")
+    parser.add_option("--skip_floodmarks", type="int")
     (config, args) = parser.parse_args()
 
     if config.verbose > 1:
@@ -130,6 +133,8 @@
         return True
     elif config.skip_uesgs == 1 and isinstance(importer, UESG):
         return True
+    elif config.skip_floodmarks == 1 and isinstance(importer, Floodmark):
+        return True
 
     return False
 
diff -r 38acd82feeac -r 220d12a41bfa flys-backend/doc/documentation/de/importer-geodaesie.tex
--- a/flys-backend/doc/documentation/de/importer-geodaesie.tex	Thu Apr 04 10:55:46 2013 +0200
+++ b/flys-backend/doc/documentation/de/importer-geodaesie.tex	Thu Apr 04 10:56:26 2013 +0200
@@ -269,6 +269,9 @@
 \textbf{SKIP\_JETTIES}
 \\Bei gesetztem Wert `1` werden keine Informationen über Buhnen importiert.
 
+\textbf{SKIP\_FLOODMARKS}
+\\Bei gesetztem Wert `1` werden keine Informationen über HW-Marken importiert.
+
 \subsection{Starten des Geodaten Importers}
 \label{Starten des Geodaten Importers}
 Der Geodaten Importer wird mittels eines Shellskripts von einer Konsole
diff -r 38acd82feeac -r 220d12a41bfa flys-backend/src/main/java/de/intevation/flys/backend/FLYSCredentials.java
--- a/flys-backend/src/main/java/de/intevation/flys/backend/FLYSCredentials.java	Thu Apr 04 10:55:46 2013 +0200
+++ b/flys-backend/src/main/java/de/intevation/flys/backend/FLYSCredentials.java	Thu Apr 04 10:56:26 2013 +0200
@@ -28,6 +28,7 @@
 import de.intevation.flys.model.FedState;
 import de.intevation.flys.model.Fixpoint;
 import de.intevation.flys.model.Floodmaps;
+import de.intevation.flys.model.Floodmark;
 import de.intevation.flys.model.Floodplain;
 import de.intevation.flys.model.FloodplainKind;
 import de.intevation.flys.model.FlowVelocityMeasurement;
@@ -148,6 +149,7 @@
         ElevationModel.class,
         FedState.class,
         Fixpoint.class,
+        Floodmark.class,
         Floodplain.class,
         FloodplainKind.class,
         Floodmaps.class,
diff -r 38acd82feeac -r 220d12a41bfa flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java	Thu Apr 04 10:55:46 2013 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java	Thu Apr 04 10:56:26 2013 +0200
@@ -1186,5 +1186,17 @@
 
     String measurements();
 
+    String floodmarks();
+
+    String pegel_had_measurement_points();
+
+    String gauge_points();
+
+    String gauge_names();
+
+    String gauge_level();
+
+    String gauge_tendency();
+
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
diff -r 38acd82feeac -r 220d12a41bfa flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties	Thu Apr 04 10:55:46 2013 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties	Thu Apr 04 10:56:26 2013 +0200
@@ -472,6 +472,13 @@
 sobek_flooded = SOBEK-Boundary flooded / not flooded
 sobek_areas = SOBEK-Areas
 measurements = Measurements
+floodmarks = Flood Marks
+pegel_had_measurement_points = HAD Discharge-Measurement points
+# No translation for the pegelonline wms service layer names.
+gauge_points = Pegelpunkte (WSV)
+gauge_level = Aktueller Wasserstand (WSV)
+gauge_names = Pegelnamen (WSV)
+gauge_tendency = Tendenz des Wasserstands (WSV)
 
 startcolor = Colorrange start color
 endcolor = Colorrange end color
diff -r 38acd82feeac -r 220d12a41bfa flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties	Thu Apr 04 10:55:46 2013 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties	Thu Apr 04 10:56:26 2013 +0200
@@ -473,6 +473,12 @@
 sobek_flooded = SOBEK-Grenzlinie durchflutet / nicht durchflutet
 sobek_areas = SOBEK-Bereiche
 measurements = Messungen
+floodmarks = HW-Marken
+pegel_had_measurement_points = HAD Abflussmessstellen
+gauge_points = Pegelpunkte (WSV)
+gauge_level = Aktueller Wasserstand (WSV)
+gauge_names = Pegelnamen (WSV)
+gauge_tendency = Tendenz des Wasserstands (WSV)
 
 startcolor = Farbverlauf Startfarbe
 endcolor = Farbverlauf Endfarbe


More information about the Dive4elements-commits mailing list