I finally realized that I need to request a geotiff from WCS to do anything spatial with the image, because the response doesn't necessarily contain all the pixels for the request BBOX, like WMS.

I'm getting an error trying to read the geotiff us this code though:

GeoTiffReader  reader = new GeoTiffReader (inputStream);
GridCoverage2D gridCoverage2D = reader.read(null) ;

Caused by: javax.media.jai.util.ImagingException: All factories fail for the operation "ImageRead" at javax.media.jai.OperationRegistry.invokeFactory(OperationRegistry.java:1687) at javax.media.jai.ThreadSafeOperationRegistry.invokeFactory(ThreadSafeOperationRegistry.java:473)
    at javax.media.jai.registry.RIFRegistry.create(RIFRegistry.java:332)
    at javax.media.jai.RenderedOp.createInstance(RenderedOp.java:819)
    at javax.media.jai.RenderedOp.createRendering(RenderedOp.java:867)
    at javax.media.jai.RenderedOp.getWidth(RenderedOp.java:2179)
    at org.geotools.gce.geotiff.GeoTiffReader.read(GeoTiffReader.java:465)
at com.valtus.corridorwcs.WCSImageImpl.handleInputStream2(WCSImageImpl.java:140) at com.valtus.corridorwcs.WCSImageImpl.handleMultipart(WCSImageImpl.java:71) at com.valtus.corridorwcs.WCSImageImpl.handleMessage(WCSImageImpl.java:56)
    at com.valtus.corridorwcs.WCSImageImpl.getImage(WCSImageImpl.java:130)
    ... 25 more
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at javax.media.jai.FactoryCache.invoke(FactoryCache.java:122)
at javax.media.jai.OperationRegistry.invokeFactory(OperationRegistry.java:1674)
    ... 35 more
Caused by: java.lang.RuntimeException: java.lang.IndexOutOfBoundsException
at com.sun.media.jai.imageioimpl.ImageReadCRIF.create(ImageReadCRIF.java:317)
    ... 41 more
Caused by: java.lang.IndexOutOfBoundsException
    at java.io.RandomAccessFile.readBytes(Native Method)
    at java.io.RandomAccessFile.read(RandomAccessFile.java:322)
    at java.io.RandomAccessFile.readFully(RandomAccessFile.java:381)
at javax.imageio.stream.FileCacheImageInputStream.read(FileCacheImageInputStream.java:173) at javax.imageio.stream.ImageInputStreamImpl.readShort(ImageInputStreamImpl.java:214) at javax.imageio.stream.ImageInputStreamImpl.readUnsignedShort(ImageInputStreamImpl.java:228) at it.geosolutions.imageioimpl.plugins.tiff.TIFFIFD.initialize(TIFFIFD.java:225) at it.geosolutions.imageioimpl.plugins.tiff.TIFFImageMetadata.initializeFromStream(TIFFImageMetadata.java:141) at it.geosolutions.imageioimpl.plugins.tiff.TIFFImageReader.readMetadata(TIFFImageReader.java:358) at it.geosolutions.imageioimpl.plugins.tiff.TIFFImageReader.seekToImage(TIFFImageReader.java:332) at it.geosolutions.imageioimpl.plugins.tiff.TIFFImageReader.getImageTypes(TIFFImageReader.java:763)
    at javax.imageio.ImageReader.getRawImageType(ImageReader.java:665)
at com.sun.media.jai.imageioimpl.ImageReadOpImage.layoutHelper(ImageReadOpImage.java:228) at com.sun.media.jai.imageioimpl.ImageReadOpImage.<init>(ImageReadOpImage.java:473) at com.sun.media.jai.imageioimpl.ImageReadCRIF.create(ImageReadCRIF.java:309)
    ... 41 more

The header looks correct:
 gdalinfo Part1.TIF
Driver: GTiff/GeoTIFF
Files: Part 1.TIF
Size is 81, 81
Coordinate System is:
PROJCS["NAD83 / UTM zone 11N",
    GEOGCS["NAD83",
        DATUM["North_American_Datum_1983",
            SPHEROID["GRS 1980",6378137,298.2572221010042,
                AUTHORITY["EPSG","7019"]],
            AUTHORITY["EPSG","6269"]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433],
        AUTHORITY["EPSG","4269"]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",-117],
    PARAMETER["scale_factor",0.9996],
    PARAMETER["false_easting",500000],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AUTHORITY["EPSG","26911"]]
Origin = (600496.199999999953434,6039901.599999999627471)
Pixel Size = (10.074074074074792,-10.074074074085573)
Metadata:
  AREA_OR_POINT=Area
  TIFFTAG_XRESOLUTION=1
  TIFFTAG_YRESOLUTION=1
  TIFFTAG_RESOLUTIONUNIT=1 (unitless)
Image Structure Metadata:
  COMPRESSION=LZW
  INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left  (  600496.200, 6039901.600) (115d26'53.78"W, 54d29'48.33"N)
Lower Left  (  600496.200, 6039085.600) (115d26'54.78"W, 54d29'21.94"N)
Upper Right (  601312.200, 6039901.600) (115d26'8.44"W, 54d29'47.75"N)
Lower Right (  601312.200, 6039085.600) (115d26'9.45"W, 54d29'21.36"N)
Center      (  600904.200, 6039493.600) (115d26'31.61"W, 54d29'34.85"N)
Band 1 Block=256x256 Type=Byte, ColorInterp=Red
  NoData Value=0
Band 2 Block=256x256 Type=Byte, ColorInterp=Green
  NoData Value=0
Band 3 Block=256x256 Type=Byte, ColorInterp=Blue
  NoData Value=0
Band 4 Block=256x256 Type=Byte, ColorInterp=Undefined
  NoData Value=0

I've read through the other questions reporting this error, and I've confirmed that the JAI jars are only on the path via the pom, but it still seems like it must be a classpath issue.

I'm using:
<artifactId>gt-geotiff</artifactId>
<version>2.7.0.2</version>

Is there anything else I can check?


On 7/9/2011 12:59 AM, Andrea Aime wrote:

On Fri, Jul 8, 2011 at 10:31 PM, john poole <[email protected] <mailto:[email protected]>> wrote:

    It's 4 band, but the 4th is IR. It ended up just being this:

     RangeSubset=contents[Bands[RED_BAND,GREEN_BAND,BLUE_BAND,ALPHA_BAND]]


Searched around a bit but could not find freely downloadable data with RGB-IR structure (lots of pages
referring to the data type, no actually working download links).
Do you have a sample?


     Maybe that's what's described in the spec, but it wasn't clear to
    me.  Getting the image back from the .eml is a little fiddly too.


Yeah, unfortunately OGC thought that was a good idea. Use store=true in your request, the server will give you
back a xml document with a link where you can download the file directly

Cheers
Andrea


--
-------------------------------------------------------
Ing. Andrea Aime
GeoSolutions S.A.S.
Tech lead

Via Poggio alle Viti 1187
55054  Massarosa (LU)
Italy

phone: +39 0584 962313
fax:      +39 0584 962313

http://www.geo-solutions.it
http://geo-solutions.blogspot.com/
http://www.youtube.com/user/GeoSolutionsIT
http://www.linkedin.com/in/andreaaime
http://twitter.com/geowolf

-------------------------------------------------------

------------------------------------------------------------------------------
AppSumo Presents a FREE Video for the SourceForge Community by Eric 
Ries, the creator of the Lean Startup Methodology on "Lean Startup 
Secrets Revealed." This video shows you how to validate your ideas, 
optimize your ideas and identify your business strategy.
http://p.sf.net/sfu/appsumosfdev2dev
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to