changeset 4994:63617e142dfe

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.
author Raimund Renkert <rrenkert@intevation.de>
date Fri, 15 Feb 2013 10:56:08 +0100
parents eee722bc85da
children 99b452967737 86e79fbb8fa3
files flys-artifacts/doc/conf/floodmap.xml flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/FloodMapState.java flys-artifacts/src/main/java/de/intevation/flys/utils/ArtifactMapfileGenerator.java flys-artifacts/src/main/java/de/intevation/flys/utils/FLYSUtils.java
diffstat 4 files changed, 30 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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>
--- 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 =
--- 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();
 
--- 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

http://dive4elements.wald.intevation.org