[Schmitzm-commits] r92 - trunk/src/skrueger/geotools/io

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Apr 28 12:33:41 CEST 2009


Author: alfonx
Date: 2009-04-28 12:33:41 +0200 (Tue, 28 Apr 2009)
New Revision: 92

Modified:
   trunk/src/skrueger/geotools/io/GeoImportUtilURL.java
Log:
* Added some logging

Modified: trunk/src/skrueger/geotools/io/GeoImportUtilURL.java
===================================================================
--- trunk/src/skrueger/geotools/io/GeoImportUtilURL.java	2009-04-28 10:32:16 UTC (rev 91)
+++ trunk/src/skrueger/geotools/io/GeoImportUtilURL.java	2009-04-28 10:33:41 UTC (rev 92)
@@ -27,7 +27,7 @@
  *
  */
 public class GeoImportUtilURL extends GeoImportUtil {
-	final static private Logger log = Logger.getLogger(GeoImportUtilURL.class);
+	final static private Logger LOGGER = Logger.getLogger(GeoImportUtilURL.class);
 
 	/**
 	 * Read a {@link GridCoverage2D} from an image file. .prj and .wld files are usually expected
@@ -118,7 +118,7 @@
 	public static GridCoverage2D readGridFromGeoTiff(URL geotiffURL,
 			CoordinateReferenceSystem crs) throws Exception {
 		GridCoverage2D gc = null;
-		log.debug("Loading GeoTiff from URL = " + geotiffURL + " now.");
+		LOGGER.debug("Loading GeoTiff from URL = " + geotiffURL + " now.");
 
 		// Versuchen Geo-Information aus Tiff zu lesen
 		try {
@@ -130,15 +130,24 @@
 				hints.put(Hints.DEFAULT_COORDINATE_REFERENCE_SYSTEM, crs);
 			// Reader (mit Metadaten) erzeugen
 
-			log.debug("First try to create GeoTiff reader");
+			LOGGER.debug("First try to create GeoTiff reader");
 
+			/**
+			 * Attention, Attention: The GeoTiffReader fails for URLs like:
+			 * 
+			 * jar:file:/home/sdsd/ad/atlas/raster_textur00949608497.jar!/ad/data/raster_textur00949608497/textur.tif
+			 * 
+			 * It should be converted to something like:
+			 * jar:http:///atlas/raster_textur00949608497.jar!/ad/data/raster_textur00949608497/textur.tif
+			 * jar:http://www.wikisquare.de/atlas/raster_textur00949608497.jar!/ad/data/raster_textur00949608497/textur.tif
+			 */
 			GeoTiffReader reader = new GeoTiffReader(geotiffURL, hints);
 
 			// Wenn kein Referenzsystem vorhanden, versuchen ein prj-File zu
 			// verwenden
 			if (reader.getOriginalEnvelope().getCoordinateReferenceSystem() == null) {
-				log
-						.warn("No projection information found in GeoTIFF. Using prj-file...");
+				LOGGER
+						.warn("Second try because no projection information found in GeoTIFF. Using prj-file...");
 
 				final CoordinateReferenceSystem determineProjection = determineProjection(IOUtil.changeUrlExt(
 						geotiffURL, "prj"));
@@ -147,8 +156,12 @@
 				reader = new GeoTiffReader(geotiffURL, hints);
 			}
 			gc = (GridCoverage2D) reader.read(null);
+			LOGGER.debug("... was successfull!");
 		} catch (UnsupportedOperationException err) {
-			log.warn("No GeoTIFF information found. Using simple image + world- and prj-file...");
+			LOGGER.debug("... failed.");
+			LOGGER.error(err);
+			LOGGER.warn("No GeoTIFF information found. Using simple image + world- and prj-file...");
+			LOGGER.debug("Second try to use readGridFromImage()");
 			gc = readGridFromImage(geotiffURL, crs); //TODO style
 		}
 		return gc;



More information about the Schmitzm-commits mailing list