Hi,

I am trying to load an ECW map with GeoTools but I am having some problems
so I have been unable to achieve this.

As I read in the GeoTools user's guide, I have downloaded and configured
the imageio and imageio-ext libraries, and I have added the Maven
dependencies to my project.
I have also copied the GDAL native libraries and installed de ECW SDK for
read only (downloaded form the ERDAS page)

When executing gdalinfo I can see that GDAL is correctly installed and
reviewing the project libraries I found the imageio-ext libraries (version
1.0.8). I am using GeoTools 2.7.2 version in Windows XP

My code is based on the ImageLab tutorial, but when executing the following
instance:

AbstractGridFormat format = GridFormatFinder.findFormat( rasterFile )

I get this exception

Exception in thread "main" java.lang.UnsupportedOperationException: Trying
to get a reader from an unknown format.
 at
org.geotools.coverage.grid.io.UnknownFormat.getReader(UnknownFormat.java:62)
 at org.geotools.test.LoadECWMap.displayLayers(LoadECWMap.java:87)
 at org.geotools.test.LoadECWMap.getMapAndDisplay(LoadECWMap.java:134)
 at org.geotools.test.LoadECWMap.main(LoadECWMap.java:139)

This code works perfectly with TIF maps.


If I change the code to use directly an ECWFormat object:

  ECWFormat format = new ECWFormat();
    reader = format.getReader(rasterFile);

it raises the following exception:

Exception in thread "main" java.lang.RuntimeException: The Provided input
is not supported by this reader
 at
it.geosolutions.imageio.gdalframework.GDALImageReader.setInput(GDALImageReader.java:851)
 at
it.geosolutions.imageio.plugins.ecw.ECWImageReader.setInput(ECWImageReader.java:60)
 at javax.imageio.ImageReader.setInput(ImageReader.java:380)
 at
org.geotools.coverageio.BaseGridCoverage2DReader.<init>(BaseGridCoverage2DReader.java:171)
 at
org.geotools.coverageio.gdal.BaseGDALGridCoverage2DReader.<init>(BaseGDALGridCoverage2DReader.java:83)
 at org.geotools.coverageio.gdal.ecw.ECWReader.<init>(ECWReader.java:67)
 at org.geotools.coverageio.gdal.ecw.ECWFormat.getReader(ECWFormat.java:92)
 at org.geotools.coverageio.gdal.ecw.ECWFormat.getReader(ECWFormat.java:44)
 at
org.geotools.coverageio.gdal.BaseGDALGridFormat.getReader(BaseGDALGridFormat.java:163)
 at org.geotools.test.LoadECWMap.displayLayers(LoadECWMap.java:87)
 at org.geotools.test.LoadECWMap.getMapAndDisplay(LoadECWMap.java:134)
 at org.geotools.test.LoadECWMap.main(LoadECWMap.java:139)


The ECW map is ok and a can see it with IrfanView using the appropriate
plugin.

What am I doing wrong? Is there anything that I am missing?


Thanks in advance.

Regards.
------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to