Mercurial > mxd2map
comparison src/java/de/intevation/mxd/writer/MapScriptWriter.java @ 297:ad05f72ef9e4
Useful debug output when setting the Projection fails
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Mon, 03 Sep 2012 17:26:02 +0200 |
parents | efab4d62ad3c |
children | 1cbc278c956b |
comparison
equal
deleted
inserted
replaced
296:72b85bac29fa | 297:ad05f72ef9e4 |
---|---|
146 } | 146 } |
147 | 147 |
148 /** | 148 /** |
149 * Create the map object and set the attributes. | 149 * Create the map object and set the attributes. |
150 */ | 150 */ |
151 private void writeMap() { | 151 private void writeMap() |
152 throws UnknownError | |
153 { | |
152 logger.debug("writeMap()"); | 154 logger.debug("writeMap()"); |
153 //Get the map. | 155 //Get the map. |
154 Element mapNode = (Element)XMLUtils.xpath( | 156 Element mapNode = (Element)XMLUtils.xpath( |
155 root, | 157 root, |
156 "/mxd/map", | 158 "/mxd/map", |
176 map.setSize(800, 600); | 178 map.setSize(800, 600); |
177 | 179 |
178 //Set the units and projection. | 180 //Set the units and projection. |
179 int proj = Integer.parseInt(mapNode.getAttribute("projection")); | 181 int proj = Integer.parseInt(mapNode.getAttribute("projection")); |
180 if(proj != 0) { | 182 if(proj != 0) { |
181 map.setProjection("epsg:" + mapNode.getAttribute("projection")); | 183 try { |
184 map.setProjection("epsg:" + mapNode.getAttribute("projection")); | |
185 } | |
186 catch(UnknownError e) { | |
187 logger.error( "Could not set projection: " + mapNode.getAttribute("projection") + | |
188 ". Please ensure that it is described in your espg file."); | |
189 throw e; | |
190 } | |
182 } | 191 } |
183 String u = mapNode.getAttribute("units"); | 192 String u = mapNode.getAttribute("units"); |
184 if(u.equals("feet")) { | 193 if(u.equals("feet")) { |
185 units = MS_UNITS.MS_FEET; | 194 units = MS_UNITS.MS_FEET; |
186 } | 195 } |