[Schmitzm-commits] r1082 - in trunk/src: schmitzm/geotools/io skrueger/geotools
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Fri Oct 8 17:40:37 CEST 2010
Author: alfonx
Date: 2010-10-08 17:40:36 +0200 (Fri, 08 Oct 2010)
New Revision: 1082
Modified:
trunk/src/schmitzm/geotools/io/GeoImportUtil.java
trunk/src/skrueger/geotools/AttributeMetadataMap.java
Log:
Modified: trunk/src/schmitzm/geotools/io/GeoImportUtil.java
===================================================================
--- trunk/src/schmitzm/geotools/io/GeoImportUtil.java 2010-10-07 21:31:08 UTC (rev 1081)
+++ trunk/src/schmitzm/geotools/io/GeoImportUtil.java 2010-10-08 15:40:36 UTC (rev 1082)
@@ -29,8 +29,12 @@
******************************************************************************/
package schmitzm.geotools.io;
+import static org.junit.Assert.assertEquals;
import gtmig.org.geotools.gce.arcgrid.ArcGridRaster;
+import it.geosolutions.imageio.plugins.arcgrid.AsciiGridsImageReader;
+import it.geosolutions.imageio.plugins.arcgrid.spi.AsciiGridsImageReaderSpi;
+
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.awt.image.RenderedImage;
@@ -44,6 +48,7 @@
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
+import java.net.URISyntaxException;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
@@ -54,6 +59,7 @@
import javax.imageio.IIOException;
import javax.imageio.ImageIO;
+import javax.imageio.stream.FileImageInputStream;
import org.apache.log4j.Logger;
import org.geotools.coverage.grid.GridCoverage2D;
@@ -75,6 +81,7 @@
import org.geotools.gce.image.WorldImageReader;
import org.geotools.geometry.Envelope2D;
import org.geotools.referencing.crs.DefaultGeographicCRS;
+import org.junit.Test;
import org.opengis.feature.simple.SimpleFeature;
import org.opengis.feature.simple.SimpleFeatureType;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
@@ -163,7 +170,8 @@
* Use the {@link ArcGridReader} from "standard" GT.<br>
* <b>Note:</b>There may be problems with colorization and no data
* transparency using this import type!<br/>
- * Stefan Tzeggai 9'2010: This is still valid for GT 2.6.5: No transparency when using Reader!
+ * Stefan Tzeggai 9'2010: This is still valid for GT 2.6.5: No
+ * transparency when using Reader unless explicitly defined in the SLD!
*/
USE_ARCGRIDREADER
}
@@ -279,8 +287,7 @@
} catch (Exception err) {
LOGGER.warn(" CRS.parseWKT mit Ex\n: ", err);
LOGGER.warn(" No projection found for file. Default is used.");
- LOGGER
- .warn(" NOT calling forceSchemaCRS now... please provide a URL to an existing .prj file!");
+ LOGGER.warn(" NOT calling forceSchemaCRS now... please provide a URL to an existing .prj file!");
// store.forceSchemaCRS(DEFAULT_CRS);
}
String[] typeNames = store.getTypeNames();
@@ -321,8 +328,8 @@
*/
public static FeatureCollection<SimpleFeatureType, SimpleFeature> readFeaturesFromShapeFile(
File file) throws Exception {
- ShapefileDataStore store = new ShapefileDataStore(DataUtilities
- .fileToURL(file));
+ ShapefileDataStore store = new ShapefileDataStore(
+ DataUtilities.fileToURL(file));
File prjFile = IOUtil.changeFileExt(file, "prj");
boolean delPrjFile = false;
try {
@@ -472,6 +479,21 @@
+ getAsciiRasterImportMode());
}
+// private static GridCoverage2D readGridFromArcInfoASCII_ArcGridReaderSpi(
+// Object input, CoordinateReferenceSystem crs) {
+// final AsciiGridsImageReader reader = (AsciiGridsImageReader) new AsciiGridsImageReaderSpi()
+// .createReaderInstance();
+// reader.setInput(input);
+//
+// Hints hints = new Hints();
+// if (crs != null) {
+// hints.put(Hints.DEFAULT_COORDINATE_REFERENCE_SYSTEM, crs);
+// }
+//// WritableRaster wr = reader.getRasterReader().readRaster();
+//
+// return gc;
+// }
+
/**
* Uses the <b>{@link ArcGridReader} class</b> (standard GT) to import a
* raster from file or URL in ArcInfoASCII format. The CRS is taken from
@@ -945,8 +967,8 @@
Rectangle2D env = gc.getEnvelope2D();
RenderedImage im = gc.getRenderedImage();
WritableGridRaster raster = new WritableGridRaster(im.getData()
- .getDataBuffer().getDataType(), 0, 0, im.getWidth(), im
- .getHeight(), env, crs);
+ .getDataBuffer().getDataType(), 0, 0, im.getWidth(),
+ im.getHeight(), env, crs);
im.copyData(raster);
return raster;
@@ -1202,8 +1224,7 @@
*/
public static String readProjectionString(URL url) throws IOException {
if (url == null) {
- LOGGER
- .debug("readProjectionString returned empty String for url==null");
+ LOGGER.debug("readProjectionString returned empty String for url==null");
return "";
}
Modified: trunk/src/skrueger/geotools/AttributeMetadataMap.java
===================================================================
--- trunk/src/skrueger/geotools/AttributeMetadataMap.java 2010-10-07 21:31:08 UTC (rev 1081)
+++ trunk/src/skrueger/geotools/AttributeMetadataMap.java 2010-10-08 15:40:36 UTC (rev 1082)
@@ -145,7 +145,7 @@
*/
public List<AMD_IMPL> sortedValues() {
final List<AMD_IMPL> list = new ArrayList<AMD_IMPL>();
- Collection<AMD_IMPL> values = values();
+ final Collection<AMD_IMPL> values = values();
list.addAll(values);
Collections.sort(list);
return list;
More information about the Schmitzm-commits
mailing list