diff src/java/de/intevation/mxd/reader/MapReader.java @ 170:b9ee44070056

Manage projections and units.
author vc11884admin@VC11884.win.bsh.de
date Wed, 06 Jul 2011 15:17:05 +0200
parents 9f74f4d36822
children 0bde090506f9
line wrap: on
line diff
--- a/src/java/de/intevation/mxd/reader/MapReader.java	Tue Jul 05 17:52:24 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/MapReader.java	Wed Jul 06 15:17:05 2011 +0200
@@ -152,19 +152,18 @@
         //Read the projection.
         try {
             ISpatialReference sr = map.getSpatialReference();
-            String projection = "";
+            int projection = 0;
             if(sr instanceof ProjectedCoordinateSystem) {
                 ProjectedCoordinateSystem pcs = (ProjectedCoordinateSystem)sr;
-                Projection p = (Projection)pcs.getProjection();
-                projection = p.getName();
+                projection = pcs.getFactoryCode();
             }
             else if(sr instanceof GeographicCoordinateSystem) {
                 GeographicCoordinateSystem gcs = (GeographicCoordinateSystem)sr;
-                projection = gcs.getName();
+                projection = gcs.getFactoryCode();
             }
             else if(sr instanceof UnknownCoordinateSystem) {
                 UnknownCoordinateSystem ucs = (UnknownCoordinateSystem)sr;
-                projection = ucs.getName();
+                projection = 0;
             }
             else{
                 logger.debug(
@@ -172,12 +171,12 @@
                     sr.getClass().toString());
             }
 
-            if(projection.equals("Unknown")) {
+            if(projection == 0) {
                 logger.warn(
                     "Unknown projection." +
                     " Please edit projection in resulting mapfile.");
             }
-            mapElement.setAttribute("projection", projection);
+            mapElement.setAttribute("projection", String.valueOf(projection));
         }
         catch(IOException ioe) {
             logger.warn(
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)