简体   繁体   中英

GeoTIFF via JAI: No descriptor by name “tiff” is registered

when trying to read GeoTiff data using geotiff-jai, I am not able to register GeoTIFFDescriptor:

@Test
public void canGetTiffDecoder() {
    Iterator<ImageReader> reader = ImageIO.getImageReadersByFormatName("tiff");
    assertNotNull(reader);
    assertTrue(reader.hasNext());

    GeoTIFFDescriptor.register(); // this line is causing errors
}

When this test is executed, I am getting: No descriptor by name "tiff" is registered under mode "rendered".

Exception in thread "main" java.lang.IllegalArgumentException: No descriptor by name "tiff" is registered under mode "rendered".
   at javax.media.jai.OperationRegistry.registerFactory(OperationRegistry.java:1173)
   at javax.media.jai.ThreadSafeOperationRegistry.registerFactory(ThreadSafeOperationRegistry.java:330)
   at javax.media.jai.OperationRegistry.registerRIF(OperationRegistry.java:2176)
   at org.libtiff.jai.operator.XTIFFDescriptor.register(XTIFFDescriptor.java:132)
   at org.geotiff.image.jai.GeoTIFFDescriptor.register(GeoTIFFDescriptor.java:48)
   at in.drifted.tiler.GeoTiffFile.main(GeoTiffFile.java:18)

My POM:

<repositories>
    <repository>
        <id>jai-repo</id>
        <url>http://dev.mapfish.org/maven/repository/</url>
        <layout>default</layout>
    </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>javax.media</groupId>
        <artifactId>jai_core</artifactId>
        <version>1.1.3</version>
    </dependency>
    <dependency>
        <groupId>javax.media</groupId>
        <artifactId>jai_codec</artifactId>
        <version>1.1.3</version>
    </dependency>        
    <dependency>
        <groupId>javax.media</groupId>
        <artifactId>jai_imageio</artifactId>
        <version>1.1</version>
    </dependency>        
    <!-- installed manually  -->
    <!-- http://sourceforge.net/projects/geotiff-jai -->  
    <dependency>
        <groupId>net.sf.geotiff-jai</groupId>
        <artifactId>geotiff-jai</artifactId>
        <version>2.0</version>
    </dependency>
    <!-- http://sourceforge.net/projects/xtiff-jai/ -->  
    <dependency>
        <groupId>net.sf.xtiff-jai</groupId>
        <artifactId>xtiff-jai</artifactId>
        <version>0.3</version>
    </dependency>
</dependencies>

JDK 1.8, Win7

Any idea, why TIFF cannot be registered correctly?

Thanks, Jan

I've tracked down the issue. There is 'xtiff' GlobalName/LocalName specified in the original XTIFFDescriptor.java, but I thought it is 'tiff' (expecting there are no modifications in the following source: http://opensourcejavaphp.net/java/openjump/org/libtiff/jai/operator/XTIFFDescriptor.java.html

I got rid this issue by copying the modified class to my project which overrides that one in the xtiff-jai library.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM