[Dive4elements-commits] [PATCH] Quick-fix for floodmaps. Use the correct projection for DGM

Wald Commits scm-commit at wald.intevation.org
Fri Feb 15 10:57:19 CET 2013


# HG changeset patch
# User Raimund Renkert <rrenkert at intevation.de>
# Date 1360922168 -3600
# Node ID 63617e142dfecf3afaa8cb3e469747fe94731bec
# Parent  eee722bc85dac349c0a249d5fcfecf9430d43012
Quick-fix for floodmaps. Use the correct projection for DGM.

* Added projection for DGM to floodmap.xml.
* Use DGM projection to create axis.shp and qps.shp.
* Write DGM projection to wsplgen layer mapfile.

diff -r eee722bc85da -r 63617e142dfe flys-artifacts/doc/conf/floodmap.xml
--- a/flys-artifacts/doc/conf/floodmap.xml	Thu Feb 14 11:05:23 2013 +0100
+++ b/flys-artifacts/doc/conf/floodmap.xml	Fri Feb 15 10:56:08 2013 +0100
@@ -14,16 +14,19 @@
 
     <river name="Saar">
         <srid value="31467"/>
+        <dgm-srid value="31466"/>
         <river-wms url="http://example.com/cgi-bin/river-wms" layers="Saar"/>
         <background-wms url="http://osm.intevation.de/mapcache/?" layers="OSM-WMS-Dienst"/>
     </river>
     <river name="Mosel">
         <srid value="31467"/>
+        <dgm-srid value="31466"/>
         <river-wms url="http://example.com/cgi-bin/user-wms" layers="Mosel"/>
         <background-wms url="http://osm.intevation.de/mapcache/?" layers="OSM-WMS-Dienst"/>
     </river>
     <river name="Elbe">
         <srid value="31467"/>
+        <dgm-srid value="31467"/>
         <river-wms url="http://example.com/cgi-bin/elbe-wms" layers="Elbe"/>
         <background-wms url="http://osm.intevation.de/mapcache/?" layers="OSM-WMS-Dienst"/>
     </river>
diff -r eee722bc85da -r 63617e142dfe flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/FloodMapState.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/FloodMapState.java	Thu Feb 14 11:05:23 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/FloodMapState.java	Fri Feb 15 10:56:08 2013 +0100
@@ -610,9 +610,9 @@
 
     protected void setAxis(FLYSArtifact artifact, File dir, WSPLGENJob job) {
         String river = artifact.getDataAsString("river");
-        String srid    = FLYSUtils.getRiverSrid(artifact);
+        String srid    = FLYSUtils.getRiverDGMSrid(river);
         String srs     = "EPSG:" + srid;
-
+logger.debug("srs: " + srs);
         List<RiverAxis> axes = RiverAxis.getRiverAxis(river);
         if (axes == null || axes.isEmpty()) {
             logger.warn("Could not find river axis for: '" + river + "'");
@@ -649,7 +649,7 @@
 
     protected void setPro(FLYSArtifact artifact, File dir, WSPLGENJob job) {
         String river = artifact.getDataAsString("river");
-        String srid    = FLYSUtils.getRiverSrid(artifact);
+        String srid    = FLYSUtils.getRiverDGMSrid(river);
         String srs     = "EPSG:" + srid;
 
         List<CrossSectionTrack> cst =
diff -r eee722bc85da -r 63617e142dfe flys-artifacts/src/main/java/de/intevation/flys/utils/ArtifactMapfileGenerator.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/utils/ArtifactMapfileGenerator.java	Thu Feb 14 11:05:23 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/ArtifactMapfileGenerator.java	Fri Feb 15 10:56:08 2013 +0100
@@ -2,6 +2,7 @@
 
 import de.intevation.artifacts.CallContext;
 import de.intevation.flys.artifacts.FLYSArtifact;
+import de.intevation.flys.artifacts.access.RiverAccess;
 import de.intevation.flys.artifacts.model.LayerInfo;
 import de.intevation.flys.artifacts.model.map.WMSDBLayerFacet;
 import de.intevation.flys.artifacts.model.map.WMSLayerFacet;
@@ -77,7 +78,9 @@
                                             "floodmap.uesk",
                                             "Floodmap"));
         layerinfo.setStyle(style);
-        layerinfo.setSrid(wms.getSrid());
+        RiverAccess access = new RiverAccess(flys);
+        String river = access.getRiver();
+        layerinfo.setSrid(FLYSUtils.getRiverDGMSrid(river));
 
         String name = MS_LAYER_PREFIX + wms.getName();
 
diff -r eee722bc85da -r 63617e142dfe flys-artifacts/src/main/java/de/intevation/flys/utils/FLYSUtils.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/utils/FLYSUtils.java	Thu Feb 14 11:05:23 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/FLYSUtils.java	Fri Feb 15 10:56:08 2013 +0100
@@ -72,6 +72,9 @@
     public static final String XPATH_FLOODMAP_RIVER_PROJECTION =
         "/artifact-database/floodmap/river[@name=$name]/srid/@value";
 
+    public static final String XPATH_FLOODMAP_DGM_PROJECTION =
+        "/artifact-database/floodmap/river[@name=$name]/dgm-srid/@value";
+
     public static final String XPATH_FLOODMAP_SHAPEFILE_DIR =
         "/artifact-database/floodmap/shapefile-path/@value";
 
@@ -416,6 +419,23 @@
             variables);
     }
 
+    public static String getRiverDGMSrid(String rivername) {
+        Map<String, String> variables = new HashMap<String, String>(1);
+        variables.put("name", rivername);
+
+        Document cfg = Config.getConfig();
+
+        String dgm = (String) XMLUtils.xpath(
+            cfg,
+            XPATH_FLOODMAP_DGM_PROJECTION,
+            XPathConstants.STRING,
+            null,
+            variables);
+        if (logger.isDebugEnabled()) {
+            logger.debug("Use EPSG:" + dgm + " for DGM");
+        }
+        return dgm;
+    }
 
     /**
      * Return the (first) Gauge corresponding to the given location(s) of


More information about the Dive4elements-commits mailing list