diff src/java/de/intevation/mxd/writer/MapScriptWriter.java @ 307:f9e53dcc7424

Add Read/Write Support for Projections on a per Layer basis
author Andre Heinecke <aheinecke@intevation.de>
date Thu, 06 Sep 2012 18:58:41 +0200
parents ebf974199309
children 1c949a309940
line wrap: on
line diff
--- a/src/java/de/intevation/mxd/writer/MapScriptWriter.java	Thu Sep 06 18:56:20 2012 +0200
+++ b/src/java/de/intevation/mxd/writer/MapScriptWriter.java	Thu Sep 06 18:58:41 2012 +0200
@@ -296,8 +296,26 @@
             }
             layer.setMetaData("wms_title", ulname);
 
+            //Set the projection for the Layers
+            if (layerElement.hasAttribute("projection")) {
+                int proj = Integer.parseInt(layerElement.getAttribute("projection"));
+                if(proj != 0) {
+                    try {
+                        layer.setProjection("epsg:" + layerElement.getAttribute("projection"));
+                    }
+                    catch(UnknownError e) {
+                        logger.error( "Could not set projection in layer: " + layerElement.getAttribute("projection") +
+                                ". Please ensure that it is described in your espg file.");
+                        throw e;
+                    }
+                }
+            }
             // Projection metadata.
             String mproj = mapNode.getAttribute("projection");
+            if (layerElement.hasAttribute("projection")) {
+                // Overwrite the Map Projection in the layer
+                mproj = layerElement.getAttribute("projection");
+            }
             if(mproj != null && !mproj.equals("") && !mproj.equals("0")) {
                 String wmssrs = layer.getMetaData("wms_srs");
                 String owssrs = layer.getMetaData("ows_srs");
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)