comparison 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
comparison
equal deleted inserted replaced
169:d7c8493cb345 170:b9ee44070056
150 } 150 }
151 151
152 //Read the projection. 152 //Read the projection.
153 try { 153 try {
154 ISpatialReference sr = map.getSpatialReference(); 154 ISpatialReference sr = map.getSpatialReference();
155 String projection = ""; 155 int projection = 0;
156 if(sr instanceof ProjectedCoordinateSystem) { 156 if(sr instanceof ProjectedCoordinateSystem) {
157 ProjectedCoordinateSystem pcs = (ProjectedCoordinateSystem)sr; 157 ProjectedCoordinateSystem pcs = (ProjectedCoordinateSystem)sr;
158 Projection p = (Projection)pcs.getProjection(); 158 projection = pcs.getFactoryCode();
159 projection = p.getName();
160 } 159 }
161 else if(sr instanceof GeographicCoordinateSystem) { 160 else if(sr instanceof GeographicCoordinateSystem) {
162 GeographicCoordinateSystem gcs = (GeographicCoordinateSystem)sr; 161 GeographicCoordinateSystem gcs = (GeographicCoordinateSystem)sr;
163 projection = gcs.getName(); 162 projection = gcs.getFactoryCode();
164 } 163 }
165 else if(sr instanceof UnknownCoordinateSystem) { 164 else if(sr instanceof UnknownCoordinateSystem) {
166 UnknownCoordinateSystem ucs = (UnknownCoordinateSystem)sr; 165 UnknownCoordinateSystem ucs = (UnknownCoordinateSystem)sr;
167 projection = ucs.getName(); 166 projection = 0;
168 } 167 }
169 else{ 168 else{
170 logger.debug( 169 logger.debug(
171 "Unknown SpatialReference: " + 170 "Unknown SpatialReference: " +
172 sr.getClass().toString()); 171 sr.getClass().toString());
173 } 172 }
174 173
175 if(projection.equals("Unknown")) { 174 if(projection == 0) {
176 logger.warn( 175 logger.warn(
177 "Unknown projection." + 176 "Unknown projection." +
178 " Please edit projection in resulting mapfile."); 177 " Please edit projection in resulting mapfile.");
179 } 178 }
180 mapElement.setAttribute("projection", projection); 179 mapElement.setAttribute("projection", String.valueOf(projection));
181 } 180 }
182 catch(IOException ioe) { 181 catch(IOException ioe) {
183 logger.warn( 182 logger.warn(
184 "Could not read map projection." + 183 "Could not read map projection." +
185 " Setting map projection to unknown."); 184 " Setting map projection to unknown.");
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)